How to self-host Member Counter
(With screenshots!)

Recommendations

    Have patience and read carefully this guide
    Be familiarized with the CLI (cmd.exe, bash, zsh)
    If you need help, feel free to ask in this discord server in #support , but READ THE WHOLE GUIDE FIRST!

Creating a bot account

Go to the Discord Developer Portal, and click "New Application", type a name and click the "Create" button
Now go to the bot tab, and click "Add Bot", and confirm by clicking "Yes, do it!"
Now enable all the privileged gateway intents, change the bot icon if you wish and click "Save Changes", and copy the bot token by clicking "Copy" under the "Token" section, save it in a safe place for future steps

Install docker

Download and install Docker and Docker Compose for your OS

Install git

Download and install git for your OS: https://git-scm.com/download

Install Member Counter

Open your terminal (cmd.exe, Terminal.app, etc) and run this command to download Member Counter
1
git clone -b master https://github.com/eduardozgz/member-counter-bot.git
Copied!
Now open the downloaded directory
1
cd member-counter-bot
Copied!

Configuring Member Counter

Open the bot folder in your terminal and create a .env file from the .env.example file
Windows
Linux / macOS
1
copy .env.example .env
Copied!
1
cp .env.example .env
Copied!
A new .envfile will appear in the folder, open it with your favorite text editor (like notepad.exe, vim, vscode, etc)
You might have to toggle the hidden files visibility in your file explorer
You will see a bunch of variables to set, but at least, you only need to set one: DISCORD_CLIENT_TOKEN (in the second line), after the equal character (=) paste here the bot token, and save the file
.env
1
# Minimal config:
2
DISCORD_CLIENT_TOKEN=PASTE HERE THE TOKEN
3
4
# General discord related configuration
5
# Don't set DISCORD_CLIENT_ID manually, this will be automatically set at runtime
6
# DISCORD_CLIENT_ID=
7
DISCORD_PREFIX=mc!
8
DISCORD_DEFAULT_LANG=en_US
9
# and more variables...
Copied!

Optional configuration

In order to use counters like {youtubeSubscribers} or {twitterFollowers} you must set the following variables:
    YOUTUBE_API_KEY Paste here your YouTube API key, you can get it here
    TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET Paste here your Twitch app credentials, you can get them here
    MEMERATOR_API_KEY Paste here your Memerator API key, you can get it here, remember to check mark "Get Profiles - View Profiles."
    TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_TOKEN_SECRET Paste here your Twitter API credentials, you can get them here

Start Member Counter

Open again your terminal and use this command
1
docker-compose up
Copied!
This step will take a long time, be patient
If you see a message like this, that means you successfully installed Member Counter, else, it will give you errors that you must fix (stop the bot with Ctrl+C and check the previous steps)
1
Member-Counter-App | Database connection ready
2
Member-Counter-App | Bot ready
3
Member-Counter-App | Invite link: https://discord.com/oauth2/authorize?client_id=787989722009174066&permissions=269864023&scope=bot
Copied!
Invite the bot to your discord server using the provided link, and check commands like mc!help, mc!status
If the bot is working well, let's make the bot auto start when your PC or server boots up, focus your terminal window and hit Ctrl+C to stop the bot and then run it again in the background with this:
1
docker-compose up -d
Copied!
The bot will run in background, to stop it you can use
1
docker-compose down
Copied!

Updating Member Counter

Open the bot's folder in a terminal, and stop and destroy the bot
Don't worry, all the DB data is stored in ./storage
1
docker-compose rm -s -f
Copied!
Download the latest version
1
git pull
Copied!
Rebuild and start everything again except the bot
1
docker-compose up -d --force-recreate --build --scale member-counter-bot=0
Copied!
Run the bot image, but running the update scripts, not the actual bot
1
docker-compose run --rm --name bot_update --entrypoint sh member-counter-bot -c 'for file in /app/res/updateScripts/*; do $file; done'
Copied!
Finally, start the bot
1
docker-compose up -d --scale member-counter-bot=1
Copied!
Last modified 3mo ago