Skip to content

paul-mueser/stats-bot

Publish Docker Image GitHub release GitHub license

Basic discord bot using discord js

General

This is a basic Discord bot primarily used for gathering statistics from a channel in a Discord server called "zitate" or "quotes", where users can post quotes. The bot can do a variety of things, such as counting the number of quotes per user and per hour of the day.

Features

  • Moderation: you can timeout, kick and ban users
  • Quotes: get stats of the authors of the quotes, get all quotes of a specific author and much more

Before starting

Prerequisites

To run the bot, you need to have Node.js installed on your machine. You can download it from the official Node.js website.

Setup

To set up the bot, you need to create a new application on the Discord Developer Portal, create a .env file in the root directory of the project and copy the token of the bot and it's id into the file like this:

TOKEN=xxx
BOT_ID=xxx

Developing & testing

For testing, you can change the testServer and devs properties in config.json file to your test server id and your developers discord id's. There you can also change the quoteLeaderRoleName, which is the role for the person with the most quotes in the current week.
Now you can run the bot with the argument --test to start the bot in development mode, where new commands only get registered on your testServer.
Pay attention, that the already registered commands will still be available on all servers.

Running the bot

To run the bot, you need to open a terminal in the root directory of the project and run the command node src/index.js.

If you want to run the bot in development mode, you can run the command node src/index.js --test.

If you don't want to develop the bot, you can also run the bot as a docker container from docker hub with the command docker run -d -e TOKEN=xxx -e BOT_ID=xxx paulmueser/statsbotdocker.

If you don't want to run the bot yourself you can directly invite the bot to your server.

Commands

Misc

  • leaderboard - replies with the leaderboard of the whole server
  • ping - Pong!

Moderation

  • ban {target-user} {reason} - bans a member from the server
  • kick {target-user} {reason} - kicks a member from the server
  • timeout {target-user} {duration} {reason} - timeout a user for the specified time

Quotes

  • authorstats - replies with the authorstats of "zitate"/"quotes"
  • quote {date} {content} {author} - create a new quote
  • quoteby {author} - replies with the quotes of a specific person
  • stats - replies with the stats of "zitate"/"quotes"