Clone/download the repository here -> https://github.com/eduardozgz/member-counter-bot
If you have any problem during the process, join in this discord server and feel free to ask in the support channel
You must have already a bot account created in the Discord Developer Portal and enabled all the privileged intents (in the bot tab)
Be familiarized with the CLI (cmd.exe, bash)
Use linux if you wanna host this bot 24/7 (unless you already know how to do it in your OS)
You need nodejs 14.0 or higher
You can downlaod and install the mongoDB community server for free or rent a mongoDB Atlas instance (there is also some free plans) I strongly recommend to install mongoDB in your machine due to a easier and faster access.
Copy and paste the
.env.example file and rename it to
.env (if you can't do this, then you must set the variables directly, search on internet how to do it in your platform, e.g: "how to set env vars in linux" or "how to set env vars in heroku"), then create a
dist folder and move the
.env file there, and open it with a text editor. Below I will explain what does each necessary variable.
DISCORD_TOKEN Paste here your bot's token, and remember to keep it secret!
DISCORD_CLIENT_ID Paste here your bot's id and add an
* at the end.
DB_URI If you installed mongodb, this varaible should be set to
DISCORD_DEFAULT_LANG There are 3 available languages: English (en_US), Spanish (es_ES) and Portuguese (pt_BR).
DISCORD_PREFIX feel free to change its value to your favorite bot prefix, but be careful to don't use the same as other bots
BOT_OWNERS Right click your username in the discord client and press "Copy ID" and paste it here and add an
* at the end, you can add as many users as you want separated by a comma (
,). Any user added here will have always full access to the bot's commands without any restriction.
UPDATE_COUNTER_INTERVAL (Seconds) This value will change the frequency of some counter updates.
FOSS_MODE Set this to
true, the bot wont kick itself when it join in a no premium server
PREMIUM_BOT Set this to
true, to enable all the premium counters
YOUTUBE_API_KEY Paste here your youtube API key, you can get it here
TWITCH_CLIENT_SECRET Paste here your twitch app credentials, you can get them here
npm installnpm build
Start it in your terminal with '
npm start' or '
Add the bot to your server (you can generate a link in the Discord Developer Portal -> click in your bot, click in OAuth2, in the scope section click 'bot' and then will appear more options, click in 'Administrator' and copy the generated link)
Testing the bot: (remember to replace
mc! with your custom prefix)
If you were able to run the commands succesfully without any error, congrats, the bot wroks.
cd to the bot folder and then cd to the
index.js has execution permissions for you (and try it by running the bot directly in ther terminal with
res/member-counter-bot.service file, change the path of
WorkingDirectory to the real one and change the
Group values to yours.
Copy this file to
sudo cp res/member-counter-bot.service /etc/systemd/system
Enable the service and start it
sudo systemctl enable member-counter-bot.service && sudo systemctl start member-counter-bot.service
Check the logs with
sudo journalctl -u member-counter-bot.service
Repeat the steps of 4.3
Discard changes of member-counter-bot.service of this repo to avoid conflicts if you update the bot in a future.
git checkout res/member-counter-bot.service