Discord Bot

Setting up the Bot Account

To get started you will need to follow this link: https://discord.com/developers/applications. After logging in click on the “New Application” button. Type the name for the bot and hit “Create”. From there you will be on the “General Information” page for the application. On the left side you will see a “bot” option. Click this and then select “Add Bot”. This will create your bot and allow you to set up some things for it.

When you have created it, you will see Token under the Username. You will need this for later, so don’t forget where to find it. Scroll down and you will see “Privileged Gateway Intents”, enable all three of them (Presence Intent, Server Members Intent, Message Content Intent). These will allow ServerUtils to change the presence of the bot, get information about server members in order to format messages, and get the messages sent to deliver them to the server. You can then change the bot icon and/or the username. When you are finished customizing the bot you will want to invite it to your server. To do this select “OAught2” on the left side, then click on “URL Generator”. In the “Scopes” section, select “bot” as well as “application.commands”, and in the “Bot Permissions” section (that shows up after selecting “bot”) select “Administrator”

This will give the bot admin perms. Alternatively you could select the following:

  • Manage Roles
  • Manage Channels
  • Read Messages/View Channels
  • Send Messages
  • Manage Messages
  • Read Message History

When you have done so, click “Copy” at the bottom of the page and paste it into a new window. Select the server you want to invite it to and then hit “Authorize”. This will add your new bot to the server.

Enabling Developer Mode

Enabling/Disabling developer mode is fairly easy. On discord click on the gear to open your settings. On the left side under App Settings click on Advanced. Once in there toggle the Developer Mode setting to enable or disable it. Enabling it will allow you to get the ids for the discord server and channels.

Configuring the Bot

Firstly, to enable the bot you must set the discord bot option, in the feature config, to true.

After that you will want to edit the Discord.toml. This file will allow you to edit what, where, and how the bot does things.

Token

The token is what links the bot to the mod. You get it from the bot’s application page (see Setting up the Bot Account).

Under the username, you will see token. Click copy and then paste the contents between the quotes in the config.

UUID

The uuid should be left blank at first. This value will be generated when the bot first runs and will be used when the bot sends a message on the server. It isn’t very important and can be left alone.

Guild ID

The Guild ID is the ID of your discord server. To find it you will need to have developer mode enabled (see Enabling Developer Mode). When it is enabled you will be able to right click on either the server icon or name on discord and clicking Copy ID at the bottom of the menu. Replace the 0 with that.

Channel IDs

To get the IDs for the various channels you will need to also have developer mode enabled (see Enabling Developer Mode ). If it is then you right click on the channel in your server and hit Copy ID at the bottom of the menu and replace the 0 next to the config option.

  • Chat Channel – This is the channel that will act as the bridge between the server chat and the discord chat
  • Staff Channel – This channel will bridge the discord channel with the staff chat on the server.
  • Info Channel – This will be where the server sends informational messages like the server starting or stopping and when players join or leave.
  • Command Channel – This is where the bot will listen for commands to be run. You may use !run [cmd] to have the bot run the command from the server.

Server Name

This is what the bot will display when it is running. The format will be “Playing [server name]”. For example, if you put “Test Server” as your server name, the bot would display “Playing Test Server”.

Formatting

These will affect how the bot formats things.

  • Show Rank – If true it will display the players rank on the server in the chat channel on discord.
  • Show Nicknames – If true it will display the nicknames of the players, if false it will show their usernames instead.
  • Discord Tag – This will be the prefix on chat that is said on the discord chat channel when it is sent to the server.