Skip to content

Instantly share code, notes, and snippets.

Avatar

112 112RG

  • Australia
View GitHub Profile
@112RG
112RG / microservice.md
Created Oct 21, 2018
Discord bot. Microservice a love hate
View microservice.md

Please read this gist by DasWolke it goes into a much better explanation of why you should use microservice Discord bots.

This is about my experience in making a microservice discord bot.

To start let's look at the core design I was looking for in creating my bot

(https://i.imgur.com/bWxXyc3.png)

I was looking to have multiple gateways that serve different shards groups this design could allow for a beta or premium version of the bot to be hosted on the same service more easily. I also wanted plug and play workers that don't store any information and could be restarted or crash without having any downtime and be scaled just by changing the replica value in docker swarm.

View Program.cs
class Program
{
private Logger _log;
private CommandService commands;
private DiscordShardedClient client;
private DependencyMap map;
string token = File.ReadAllText(@"token.txt");
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
View Program.cs
class Program
{
private Logger _log;
private CommandService commands;
private DiscordShardedClient client;
private DependencyMap map;
string token = File.ReadAllText(@"token.txt");
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();