Development · Downloadables · Programming · Project

Megabot

Bad-ass and playful console environment, pretty clean written .NET Discord bot launcher.

Started with an experimental idea that my boyfriend came up with. Playing video-games with friends and chatting using Discord and Team Speak, he asked me about the idea of a bot that is customized to do stuff at specific times and record scores, etc. This didn’t sound too heavy to do, came with a prototype which was already functional within a day, then I realized that I can grow this in a full project and as I use to enjoy doing, extend it to be easy to use, plug-and-play features to it’s fullest.

Bots, Mods & Database

Individually, mods are plugins which can depend to each-other. They are compiled and then the DLLs are loaded with the reflection.

Data – Megabot.Data.dll

This is the root reference of a bot or a mod for a bot. The DLL contains all the logic on how to create your own custom and simplistic bot or mod, so you only have to create a class, inherit the BaseBot/BaseMod class, add the info attribute (which sets a name, description, version, etc of a mod or bot), override contact details and add your own logic for what the bot/mod is for. Then just compile the DLL and place only your bot/mod plugin in the Bots folder, then other references in the folder where the Megabot.Launcher.exe is.

A list of the helpful components and elements of the root plugin are:

  • Bot Creation: The internal logic of a bot is quite complex, when talking about syncing mods with the bot and bot with discord. Everything’s handled safely.
  • Mod Creation: The internal logic of a mod is quite just descriptive and extensive. Tools are available to customize and easily manage end-user commands and features.
  • Console Commands: Able to create your own bot/mod priority based console commands which can be executed by users in Discord.
  • Background Activity: Allow bots or mods to run processes or execute repeating tasks in async threads. Which means that mods can stay live, and up to date in real-time.
  • Serializer: This being obviously required, mods and bots can save data stored, like accounts made by users in Discord, using the bot, or score in Discord games like Tic Tac Toe.
  • GameMod Support: Extension header class which can be inherited for mods, if they’re exclusively game mods. Use GameMod<T> instead of BaseMod<T>.

Launcher – Megabot.Launcher.exe

Is self explanatory, except it does more than needed because why not. It reads the Bots folder and imports all the plugins for bots and mods, it’ll print that when the console is started and show the bot/mod count.

What you need to do is to get your Discord bot application access token (and be sure it is a public bot), and type it in console as “token <your token here>“.

Type “start <bot id here>” in the console, and if everything’s set well, it’ll automatically generate .main files for each bot and mods under the bot in the background, as their configs are being loaded (and if it doesn’t exist, the bot automatically generates a new config for each). Console should print @discord log messages as Connected, that means the bot is live.

You can stop a running bot by calling “stop” in the console, or “q” to shut down the bot safely and then quit the console after it.

Tip: For easier launch of bots and not always have to type the token and start a bot, you can create a shortcut of the launcher, open it’s properties and edit Target by adding the commands you’d add when launching the bot. E.g.:

Megabot.Launcher.exe -token "<your token here>" -start "<your bot-id here>"

One thought on “Megabot

Comments are closed.