Skip to content

emre1702/BonusBot

Repository files navigation

BonusBot

Discord bot written in C# using the framework Discord.Net.

What exactly is BonusBot?

BonusBot has been written to do some stuff in Discord like for example:

  • Play music from YouTube
  • Delete multiple messages at once
  • Ban people for a specific time and inform them
  • Announce game planings for one of our Discord servers
  • Output when someone leaves the server
  • ... and much more

My previous repository could do all of them and maybe more (depends on at which date you are reading this).
But the code was terrible so I decided to rewrite the whole code.
Well, atleast it was much better than my first BonusBot :)

How can I get the bot?

You can't invite the bot I'm already running for my private servers.
I honestly don't have a server with enough resources to be able to handle many guilds.

But you can:
Clone this repository
or
Use my Docker image directly.

Environment variables:

  1. BONUSBOT_TOKEN
    The token of the bot.
  2. BONUSBOT_CLIENT_ID
    The "CLIENT ID" of the bot (needed for WebDashboard.
  3. BONUSBOT_CLIENT_SECRET
    The "CLIENT SECRET" of the bot.
  4. BONUSBOT_WEB_BASE_URL
    The base url where the ASP.NET Core server is running.
    E.g. my base url is "http://bonusbot.net".
  5. BONUSBOT_ACTIVITY
    Activity of the bot when started.
  6. BONUSBOT_CONNECTION_STRING
    Connection string for PostgreSQL.

How is the code structured?

There are the main, systems and module projects.

The main projects contain the logic to make BonusBot function for any functionality:

  • Core:
    Startup, Initialization, Dependency Injection, module references
  • Common:
    Common logic for everything.
  • Database:
    Entity Framework Core using PostgreSQL.
  • Services:
    Services needed for BonusBot to work.

System projects are wrapper for Discord classes to mostly improve speed of the bot with caching and make the code better.

Modules contain all the functionalities and commands.
They can be added and removed easily, need to be referenced from Core and need to end with 'Module'.
The module 'ModulesControllingModule' allows the guild administrators to enable and disable the modules for their guild.

Other used dependencies:

  • Lavalink:
    Used in AudioModule for sending audio from e.g. YouTube or Soundcloud
  • gRPC with Google.Protobuf:
    For my private modules to allow sending to and receiving from my other project.
  • Npgsql Entity Framework Core Provider
    Provider for EF Core and PostgreSQL.
  • Macross.Json.Extensions:
    To be able to convert string to enum or vice versa with custom names in System.Text.Json.
  • Colorful.Console:
    Enhanced styling functionality for the console.
  • MoreLINQ:
    More functionalities for LINQ.
  • Docker:
    This code is written to work in a Docker container. If you don't want to use it, you can modify the code - it should be pretty easy.
    E.g. the ConnectionString in BonusDbContextFactory.cs uses an absolute path for a Docker volume, modify it.
  • ... and more from .NET Team

About

Discord bot written in C# and Discord.Net

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published