Alia is a feature-rich Discord bot with 45 commands. Games, memes, dice, trivia, AI, and more.
SocialGitHub @drobatiOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Repository information has not been collected yet.
No updates detected yet. GitHub releases will appear here.
Discord bot for me.
Translation pending
Taken from the repository README
Loading the full README.
Read the full README ↗My personal Discord bot.
Clone the Repository
git clone [Your Repository URL]
cd alia-bot
Install Dependencies
npm install
Environment Setup
.env file in the root directory with the following content:
BOT_TOKEN=your_discord_bot_token
NODE_ENV=development
MYSQLDB_DATABASE=aliadb
MYSQLDB_USER=aliabot
MYSQLDB_PASSWORD=your_mysql_password
MYSQLDB_ROOT_PASSWORD=your_mysql_root_password
MYSQLDB_LOCAL_PORT=3307
MYSQLDB_DOCKER_PORT=3306
NODE_LOCAL_PORT=6868
NODE_DOCKER_PORT=8080
your_discord_bot_token, your_mysql_password, and your_mysql_root_password with your actual credentials..env file to source control to maintain security.Start the MySQL Database
docker-compose up -d mysqldb
Run the Application
npm run start
npm run lint to start ESLint.npm run test to start the Jest test runner.Developing and testing a Discord bot can be exciting and challenging. However, it's crucial to do so in a safe and controlled environment. Using a test guild allows you to rigorously test and debug your bot without the risk of impacting your main guild or exposing your production bot token. This setup is especially important to keep your production token off your local machine, ensuring higher security and peace of mind.
Another key reason for this setup is to avoid the confusion and frustration of having two bots (development and production) responding to the same commands. If both your development and production bots are active in the same guild, they might both respond to commands, making it difficult to distinguish which bot's changes are being tested. Additionally, you don't want to turn off your production bot while developing, as it may be serving a live community.
By using a test guild, you can freely experiment, make changes, and encounter errors without any real-world consequences for your bot's users and without the confusion of overlapping bot responses.
DiscordJS Guide has a great guide on this if you need a second reference Setting up a bot application
Create a New Discord Guild:
Create a New Discord Application:
Enable Guild Messages Intent:
Get the Bot Token:
Invite the Bot to Your Test Guild:
Configure the Development Environment:
.env file or other environment variable configurations.Run the Bot in the Test Guild:
When setting up alia-bot for the first time, or after making significant changes to the database structure, it's important to ensure that your database is properly configured. This can involve initializing tables, loading initial data, or applying migrations. To simplify this process, an onboarding script can be used.
The onboarding script should automate the following tasks:
You can create a script (e.g., onboarding.js) in your project's root directory with the necessary logic and then include instructions in the README on how to run it.
####### TODO: WRITE THE ONBOARDING SCRIPT
After setting up your .env file and starting the MySQL database, run the onboarding script to set up your database:
The goal of this onboarding script will be to prepopulate the database with test data.
node onboarding.js
If you encounter issues connecting to the MySQL database, it might be due to stale data in the Docker volume. This can happen if the initial configuration fails or if there are changes in the database setup. To resolve this:
docker-compose down
This will delete the existing database data, so make sure you have backups if needed. Find the volume name using docker volume ls. Remove the volume using
docker volume rm [VOLUME_NAME]
After removing the volume, start the services again to create a fresh database.
docker-compose up -d
Once the services are up, rerun the onboarding script to set up the database.
For those new to programming or certain technologies, here's a quick guide to some of the terms used in this project:
A good way to learn these technologies is to read the documentation and follow the installation instructions. Through trial and error, you will learn how to use these technologies.
You could follow my usage guide on this bot and when you dont understand something use this section to learn more about it.
Git: A free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
NVM (Node Version Manager): A version manager for node.js, designed to be installed per-user, and invoked per-shell.
nvm install latest to install the latest version of Node.js.nvm install 20 to install Node.js version 20.nvm use 20 to use Node.js version 20.nvm alias default 20 to set Node.js version 20 as the default version.Node.js: An open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser.
node -v to check the version.npm -v to check the version of npm.npm install to install the dependencies.npm run start to start the bot.npm (Node Package Manager): A package manager for JavaScript, allowing users to install and manage libraries and tools for their projects.
package.json and package-lock.json.Docker: A set of platform-as-a-service products that use OS-level virtualization to deliver software in packages called containers.
any types in the codebase.Discord.js: A powerful JavaScript library for interacting with the Discord API. It's used to build the bot's core functionality.
MySQL: A widely used open-source relational database management system (RDBMS) that uses Structured Query Language (SQL).
Sequelize: A promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server.
Lodash: A modern JavaScript utility library delivering modularity, performance, & extras.
_.map(), _.filter(), _.reduce()If you want a PR merged into this repo you need to make sure it works. I want evidence of this in the form of tests and screenshots. Because my code is live and actually deploys somewhere, you need to make sure your code works.
Jest: A delightful JavaScript Testing Framework with a focus on simplicity.
npm run test to start Jest.
ESLint: A static code analysis tool for identifying problematic patterns found in JavaScript code.
npm run lint to start ESLint.Optional as long as you aren't working with these features. Fuse is used quite frequently in autocomplete functions. Axios is used for gathering data from third-party services to use in commands.
Feel free to ask me for help by creating issues. It doesn't matter if it's not a bug, it's a great way to ask for help. I'll try to respond as soon as I can.
Docker Compose: A tool for defining and running multi-container Docker applications.
docker-compose.yml..env File: A simple text file used in projects to load environment variables for storing configuration settings and secrets, separate from your code.