During a hackathon, I used SadConsole + MonoGame and DSharpPlus to create a Discord bot that renders a PNG of colorful text. Since MonoGame isn't intended to be used like that, I had to find a few workarounds.
1. I created a static List<Action> of "jobs"
2. The Discord user sends a command to render some colored text
3. We create a SadConsole.Console instance; draw the text onto the Console; and push a job to the job list.
4. When the MonoGame instance enters the "Render" call, it runs each job in the job list.
5. The job we pushed then saves the Console to a PNG in a memory stream (file operations were substantially slower in thread for some reason), and then calls Discord API to send the response.
I'm personally proud of this because I used MonoGame in a way that it was not intended for.
The code worked at the time it was written. Unfortunately, it does not work anymore at this time (likely due to some API update).
I am a recently-graduated software engineer and independent game developer. I prefer to use C# for most things. I am looking for full-time remote-first work in general software development.
1. I created a static List<Action> of "jobs"
2. The Discord user sends a command to render some colored text
3. We create a SadConsole.Console instance; draw the text onto the Console; and push a job to the job list.
4. When the MonoGame instance enters the "Render" call, it runs each job in the job list.
5. The job we pushed then saves the Console to a PNG in a memory stream (file operations were substantially slower in thread for some reason), and then calls Discord API to send the response.
I'm personally proud of this because I used MonoGame in a way that it was not intended for.
The code worked at the time it was written. Unfortunately, it does not work anymore at this time (likely due to some API update).
The code is available here: https://github.com/INeedAUniqueUsername/Colorbot/blob/master...