Skip to main content

What is a Discord Bot?

A "Discord Bot" refers to a user-like member of your server that you can use to automate various actions. It's denoted by a "Bot" tag next to its name. Bots use Discord's public "API" to do actions like send messages, modify roles, etc.

How to Use Bot Commands

Commands are the various operations that you can have a bot perform through sending messages in Discord. Statbot's commands primarily focus on displaying stats and configuring settings.

Prefix

The prefix is the most important part of the command. Bots watch for the prefix to know that the message contains a command that it needs to run. In regards to commands, Statbot ignores messages that don't start with the server's prefix or @Statbot.

Statbot's default prefix is s? (not case-sensitive). You can also use @Statbot instead of the prefix, which is helpful if you ever forget your prefix and want to check it in Discord rather than the Dashboard.

Below are some examples of Statbot commands illustrating how a prefix is used:

# With default prefix
s?help
s?aliases
s?stats members
s?statdocks setup

# With bot @mention
@Statbot help
@Statbot aliases
@Statbot stats members
@Statbot statdocks setup

Setting a custom prefix for your server is covered later in this guide under 5. Common Settings.

Required Permissions

Information on what Discord permissions are required by features. This is a more in-depth version of the previous guide page.

Tracking

The following Discord permissions are required to track stats:

  • Read Messages: Required on text channels to track sent messages and see commands.
  • See Channel: Required on voice channels to track voice minutes and update Statdock channel counters.

Responding to Commands

The following Discord permissions are required to respond to commands in Discord:

  • Send Messages: Required to send any response.
  • Embed Links: Required to send responses. All commands use tidy embeds which use this permission.
  • Attach Files: Required for commands that send graphs and .csv files.

Statroles

The following permission is required for the Statroles feature:

  • Manage Roles: Required to assign and remove roles to/from members.

Statroles rely on stats tracked by the bot, so make sure that the bot has the permissions noted above on the channels you want stats for.

caution

A member's highest role must be higher than the role they're trying to assign. This is true for bots as well. Make sure that Statbot has a role higher than the one you want it to assign. The editor on the website will show only roles that the bot can assign but roles are often reorganized.

Statdocks

The following are required for the Statdocks feature:

  • Manage Channels: Required to both create and edit channels.
  • See Channel: Required to edit channels.
  • Connect: Required to edit channels (including channel name).

Advanced Commands

Aliases

An Alias is a command that acts as a shortcut for another. For example, one of the Aliases for the stats messages command is m, so s?stats messages and s?m return the same output. Aliases accept the same Parameters as the full command. (e.g. s?m @**User)**

You can find a list of all the Aliases by running the aliases command.

caution

The help command doesn't accept Aliases as a Parameter.
โœ• s?help me
โœ“ s?help stats me

Command Parameters

Commands often accept "Parameters", "arguments", or "options". These terms are interchangeable and mean that the command accepts additional input.

The most common example is the help command. It can take a Statbot command as a Parameter. For example, help prefix will return the help information for the prefix command.

You will often use Parameters to target specific channels, members, or roles. In most cases, commands will accept names, @ or # mentions, and Discord IDs. You can view valid Parameters with examples for all Statbot commands via the help command and in these docs in the commands section.

Below you'll find a labelled diagram of different parts of the command structure with what we now know about commands.


Statbot has many simple commands to get you started on your stats journey. Below are 5 common commands that you can use to get familiar with Statbot:

  • help - Shows a categorized list of all the commands.
  • user - Shows stats information of a given user including their top message and voice channel and the date they joined the server.
  • me - A shortcut for stats user @you. Optionally accepts "messages" and "voice" as Parameters. Supports the Aliases of the messages and voice commands as well.
    • me messages - A shortcut for stats messages @you. Alias example: me msg
    • me voice - A shortcut for stats voice @you. Alias example: me v
  • members - Shows information about the member growth of the server including a graph.
  • counter setup - Creates a set of preset channel counters displaying various stats about the server.
info

Sometimes commands will change. While we try our best to support backwards compatibility, you should make it a habit to run the help command whenever a command isn't working.

Privileged Commands

Privileged Commands (aka: "Admin Commands") are commands that require the member using the command to have certain Discord permissions or Role-Based Access Control (RBAC) overrides. By default, members with the Administrator or Manage Server Discord permissions can edit all Statbot settings with the only one exception controlled by the Elevate Manage Server setting.

When running the help command, take care to notice the * asterisk on categories and individual commands, These commands require that the member to have elevated privileges to use them. They will not respond to regular members.

User Privacy

Finally, because of the importance that Discord places on this topic, it is worth highlighting the toggle userprivacy command. This command allows a user to anonymize their stats across all servers. This process was explained earlier in the Welcome page's section about privacy.

When turning on User Privacy, you will be sent the following message and prompted for confirmation:

We greatly value your privacy. By activating User Privacy, we will anonymize your message and voice data. Users are limited to toggling this setting only once every 24 hours. After toggling User Privacy "On", a process will begin to anonymize all of the aforementioned data. The entire process can take some time to complete and once started, can not be stopped. You will receive a notification on this website letting you know when you have been successfully anonymized.

By anonymizing your data, Statbot may not be able to accurately determine your activity in a server when executing services like Smart Prune and Statroles. Anonymizing your data may result in decreased user experience. If you understand and wish to continue...

Technical Stuff

Shard

Without going into the complicated details, Discord has large bots connect to it over many connections so that it can split events between them. All of the bot's servers (like the one you've added the bot to) are divided amongst these connections. A Shard refers to one of these connections. Typically, a Shard for Statbot will have 1000 or so servers on it.

This is useful to know because sometimes parts of Discord's API or the bot may go offline, but that doesn't necessarily mean that the entire bot is down.

info

Sometimes Discord's API goes offline and is inaccessible. When this happens, bots may be unable to function properly until the issues are resolved on Discord's side. These "API outages" will often be felt by users as well. If the Statbot team detects an outage, an announcement will be made in the [support server].