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

git clone -b master https://github.com/eduardozgz/member-counter-bot.git

Now open the downloaded directory

cd member-counter-bot

Configuring Member Counter

Open the bot folder in your terminal and create a .env file from the .env.example file

Windows
Linux / macOS
Windows
copy .env.example .env
Linux / macOS
cp .env.example .env

A new .envfile will appear in the folder, open it with your favorite text editor

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 , after the equal character (=) paste here the bot token, and save the file

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

docker-compose up

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)

Member-Counter-App | Database connection ready
Member-Counter-App | Bot ready
Member-Counter-App | Invite link: https://discord.com/oauth2/authorize?client_id=787989722009174066&permissions=269864023&scope=bot

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:

docker-compose up -d

The bot will run in background, to stop it you can use

docker-compose down

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

docker-compose rm -s -f

Download the latest version

git pull

And start the bot again, but rebuilding the bot

docker-compose up -d --force-recreate --build