The ServerProBot is a custom bot, developed for Server.pro's official Discord server. It is written in C# and can be hosted on any server with a .NET environment pre-configured, such as Mono.
This tool is still in development, and is available under the GPLv3 License.
The bot comes with a number of pre-configured commands, all of which must be prepended with a period to be recognized and processed.
Command | Argument | Description |
---|---|---|
help |
- | Displays a list of commands with their descriptions. |
- | -c <command> |
Shows detailed information about a specified command, along with any available flags and an example. (Optional) |
ping |
- | Used to test whether or not the bot is online. |
- | -c <channel> |
Specify the channel in which the bot will respond. (Optional - will respond in current channel if not specified) |
sendraw |
- | Sends a manual POST request to the discord API from the bot. The contents of this request must be properly-formatted JSON in a code block. |
- | -c <channel> |
Specify the channel in which the bot will respond. (Optional - will respond in current channel if not specified) |
suggestion |
- | Formally sends a suggestion to #suggestions. |
- | -t <title> |
Add a brief explanation of the suggestion (Required) |
- | -b <body> |
The body portion of the suggestion (Required) |
support |
- | Displays info on how to get support. |
- | -c <channel> |
Specify the channel in which the bot will respond (Optional - will respond in current channel if not specified) |
advertise |
- | Creates an ad for your server in the server ads channel. |
- | -id <serverID> |
The id of your server. This can be found in your url when in your control panel. |
- | -d <description> |
Custom message to add to your advertisement |
The commands below are specific to Ubuntu 20.04 LTS. If you are using a different distribution, please modify the process accordingly.
- If Git is not already installed on the server, install it.
sudo apt install git -y
- Download this repository to your server.
git clone https://github.com/CatSandwich/ServerProDiscord.git
- Navigate into the downloaded folder.
cd ServerProDiscord
- Install nuget.
sudo apt-get install nuget -y
- Install .NET Core.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb;
sudo dpkg -i packages-microsoft-prod.deb;
rm packages-microsoft-prod.deb;
sudo apt-get update -y && apt-get upgrade -y;
sudo apt-get install apt-transport-https dotnet-sdk-3.1 aspnetcore-runtime-3.1 -y;
- Install Mono
sudo apt install gnupg ca-certificates -y;
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;
sudo apt update -y && apt upgrade -y;
sudo apt install mono-devel -y;
- Install Discord.NET
nuget restore
-
Obtain bot token and create
config.json
- Firstly navigate to the Discord Developer Portal. Once there, click "New Application" and fill in the details requested (including a name, icon and description).
- Next, select "Bot" in the menu, and click "Add Bot", followed by "Yes, do it!". You should receive a confirmation message. Under Token, select "Click to Reveal Token".
- Navigate back to the OAuth2 tab. Scroll down to the "OAuth2 URL Generator" and enable
bot
under Scopes. Next, under "Bot Permissions" enable theAdministrator
permission (or be more granular if you wish). - Copy the URL that is displayed further up the page, navigate to that URL, and add the bot to your server.
- Lastly, rename
config.example.json
to beconfig.json
. Then, open the file with your favourite text editor, and configure it to your liking. If you want to enable the developer environment, then leave DevEnv astrue
. Insert the Token for your server in theToken
field, and do the same forDevToken
if you have a separate development / testing server. Next, create abot-rcon
channel on your server and insert the ID for this channel in theRconChannel
field - please be aware that this can cause problems due to Discord's Rate Limiting. - Once you bring the bot online, it should be working in Discord.
-
Build the project
msbuild
We will run the bot inside a GNU Screen. If you don't already have this installed, run sudo apt install screen -y
to do so.
Firstly, create a new screen:
screen
Then, navigate to the runpath:
cd ServerProDiscord/bin/Debug/netcoreapp3.1
and run it.
./ServerProDiscord
To detach from the screen, press Ctrl+a+d
. You can reconnect to the screen by finding the screen's ID with screen -list
, and then entering the command screen -R <ID>
.
If you have any issues with installing or running the bot, please open an issue.