Cebt-o-Bot was by product of re-ignition of old gaming clan. With Discord openly supporting third-party bots and recent introduction to NodeJS I decided to attempt my hand at making a bot for Discord. It wasn't as strait forward as I thought but with so many different libraries available for the purpose I got it up and running in few hours.
Your wish is my command
First requirement for a bot is implementation of chat commands. Parsing user chat messages has it's quirks and making the matching of chat messages to commands can be made in few different ways, most of which are inefficient. My method was simply to use array with the command as a string based key and point them to the actual functions.
My first few commands were for debugging purposes. As I wanted the program to run on raspberry pi headless it required getting used to both the Discord API and 'os' library. So first was simple /sys command to tell how long the bot has been running and some generic information about system specs.
Implementation of persistent information was also a challenge on linux based system as running the node as super user caused the target directory for 'fs' library to be different.
Characters and Caves
As with every other language, eventually I will make simple 2D map generator just for practice. Outputting a 2D map on the chat was quite the challenge as not all characters took the same space on the screen.
So I made simple command that prints out characters based on their numeric index. With a simple command I managed to find massive amounts of characters in the font used by Discord, including all the emoticons. It was only after many hours later I found out you could just use: "```Markdown```" to include text area with even sized characters.
Birds and Tweets
I don't usually use twitter so this is completely new for me. I actually only follow few bots on twitter, so I made my own twitter bot...
It was mostly just laziness that I used Cebt-o-Bot for this project as I already had some code base, so why not use it. It simply tweets when someone uses command /tweet.
ex. "/tweet hello from discord" tweets "username says: hello from discord"
Sadly because sources contain twitter credentials and discord app credentials I cannot share the source code here.