ivan-ristovic / the-godfather

Feature-rich general-purpose Discord bot written in C# using DSharpPlus
GNU General Public License v3.0
17 stars 6 forks source link
csharp discord discord-bot dotnet dotnet-core dsharpplus godfather visual-studio

# the-godfather

Codacy Badge Build Status Issues PRs Discord Server LICENCE Stable release Latest release Docker URL Docker Image Size

Just another general-purpose Discord bot developed with the goal to remove all other bots from the guild and create one that will do everything as efficiently as possible while keeping simplicity in mind when it comes to usage. Written in C# using DSharpPlus.

TheGodfather

Discord bots have grown very rapidly over the past few years and due to that growth it usually becomes hard to use them because of the unintuitive command system or due to performance issues. I have had a scenario where we had ten bots in the guild, because every bot did a unique job. Managing many bots and permissions for those bots quickly became overwhelming. Apart from that, only a handful of bots provided a customizable protection system against common destructive actions on Discord, yet it was still not enough - either the performance was poor due to it being a public bot instance, or the system was not customizable enough - that is if the system worked well to begin with. So, I have decided to create TheGodfather - one bot that will oversee and be in charge of everything.

TheGodfather became a side project for me, and it developed quite quickly. I have always intended it to be a private bot, however I realised over time that there are surely people like myself frustrated of public bot instances and dozens of narrow-purpose bots with web-based management interfaces. So, after a long time, even though this project was open sourced from the start, I decided to "open" the bot to the public - make it easier to setup and use for people who do not have programming background.

TheGodfather is powered by the community that uses it - I do not have any financial gain from it. For that reason, the bot is meant to be self-hosted, but that might change in future if there are enough contributions from the community.

Features:


TheGodfather listens for commands inside guilds and in DM. However, some commands cannot be invoked in DM and vice versa.

Commands are invoked by sending a message starting with the bot "prefix" or by mentioning the bot at the start of the message. The default prefix for the bot is !, however it can be configured separately for each guild.

For example, valid command calls are:

!ping
@TheGodfather ping

Command list

Command list is available at the Documentation directory.

Note: It is advised to read the explanation below in order to use TheGodfather in his full potential.

Command naming system

Commands are divided into command groups for easier navigation and due to large amount of commands.

For example, command group user contains commands which are used for administrative tasks on Discord users. Some subcommands of this group are kick , ban etc. For example, in order to call the kick command, one should always provide the "parent" group name first and then the actual command name, in this case:

!user kick @Someone

The same applies if the command has multiple parent groups, such as:

!config antispam exempt @Someone

Aliases are synonyms for a command. Aliases are usually shorter than regular names and are meant for faster invocation of the commands. Some people like it short and some people like it descriptive - with this, everyone is covered. Here is an example, for the commands above:

!u k @Someone
!cfg as ex @Someone

Command arguments

Almost all commands require additional information apart from their names, that information is from here on called command arguments.

For example, the kick command requires a Discord member as an argument, so the bot can know who to kick from the guild. Command arguments are strictly typed - meaning that you cannot pass anything other than a valid Discord member to a kick command.

A command argument can have exactly one of the following types (only the the most common types have been listed):

Note: Discord entity IDs can only be seen in the Discord client by enabling the Developer appearance option in Discord settings.

Arguments can be marked as (optional) in the documentation. If this is the case, you can omit that argument in your command call.

For example, the user kick command described above also accepts a string... argument after the user , which corresponds to a reason for the action. However, since it is marked as optional, both of the following invocation attempts will succeed:

!user kick @Someone
!user kick @Someone I have kicked him because I can!

Command overloads

Each command can be invoked in various ways, each of those ways being called an overload in the documentation.

For example, let's consider the bank transfer command. The logic of this command is to transfer currency from your account to another user's account. One way to use it is to provide a user to pass the currency to and an int which corresponds to the amount of currency to transfer. The ordering of these arguments can sometimes be hard to remember, especially if there are more than two arguments. The purpose of an overload is to give alternate ways of invoking the same command. In this example, another way to use the bank transfer command is to pass the amount first and the user second. This way, the ordering of the arguments does not matter and therefore does not need to be remembered - both invocation attempts will succeed. This works as long as there is a clear distinction between the argument types (e.g. if a command has two arguments of the same type, overloading is not possible).

Note: string... argument always comes last in queue because it captures raw text until the end of the message. Therefore it cannot come before any other argument.

Note: It is always preferred to surround arguments of type string with quotes, although not nececary. This prevents the accidental misinterpretation of the second word in a given string as a different argument. Also note that, in case of string... type, the quotes will also be captured.