A Discord bot designed to enhance the online experience for players using * *PSDK's online features**.
Before installing and running the bot, ensure you have the following:
- Node.js (version 16.9.0 or higher is recommended, as required by
discord.jsv14). - npm (comes with Node.js).
- A Discord bot token (available in the Discord Developer Portal).
- Your bot's client ID and bearer token.
Follow these steps to set up and run the bot:
Clone this repository to your local machine:
git clone https://github.com/PokemonWorkshop/OnlineDiscordBot.git
cd OnlineDiscordBotIn the root folder of the project, create a .env file to store your bot's credentials. The file should look like this:
TOKEN=<your-bot-token>
CLIENT_ID=<your-bot-client-id>
BEARER=<your-bearer-token>
BOT_VERSION=1.0
Replace <your-bot-token>, <your-bot-client-id>, and <your-bearer-token> with your actual values.
The token & client id are from the Discord Developer Portal, and the
bearer token is provided by the Online Server.
Run the following command to install all required dependencies:
npm installStart your bot with:
node bot.js- Bot permissions: Make sure your bot has the required permissions to function. You can use the Discord Permissions Calculator to set up the necessary permissions.
- Bot settings: You can edit
settings.jsin order to change the bot settings. - Environment variables: Do not share your
.envfile publicly to protect sensitive data like your token.
/commandsto list available commands./playersto list the players./giftsto list mystery gifts./aboutto display bot information.- Log actions in a dedicated channel.
If you encounter any issues during setup or usage, consider the following:
- Dependencies: Ensure all dependencies are installed correctly. Run
npm installagain if needed. - Node.js version: Make sure you're using a compatible version of Node.js (16.9.0+).
- Bot token: Verify your token and other credentials in the
.envfile. - Bot settings: Verify your settings in
settings.jsfile. - Logs: Check the console to see if the message is relevant to your error.
To host your Discord bot, you can choose between local hosting or a remote server. For local hosting, ensure you have Node.js installed and run your bot using node bot.js or a similar command in your terminal. However, for a more reliable solution, consider hosting on a VPS (like those provided by OVH, DigitalOcean, or AWS). Install the necessary dependencies, upload your bot files, and use a process manager like PM2 or a tool like screen to keep your bot running persistently. Additionally, ensure your hosting environment is secure by setting up a firewall and keeping your token and sensitive data private.
You may want to check the Online Server README file for more informations about hosting.
This project is licensed under the MIT License.
Contributions are welcome! Feel free to submit a pull request or open an issue for any bugs or improvements.