- Log entry "Red Discord Bot - How it all began I"

> Author: Twentysix
> Inserted on: 2018-12-31 04:28:55 +0000
> Total words: 1409
> Estimated reading time: 7 minutes
> Estimated reader's enjoyment: ERROR: Division by zero.
> Tags: red discord

At the time of writing it’s been 1092 days since I have created the Red Discord bot community server. A lot happened in 3 years… but how did it all start? Buckle up, you’re about to find out!

> Once upon a time…

Deep narrating voice
The year was 2015. It was an uncertain time for a group of old time internet friends from Italy. Our continuous search for a digital home to hangout in the day-to-day brought us from the now dead MSN Messenger, to Skype and finally to the bare lands of IRC. Except for MSN (a constant presence during our teenage years) none of them lasted long. Sure, it was mostly due to pickiness: they were all decent options after all. But not a single one of them excelled at text chat, voice chat, UI, apps and sharing media at the same time. Then Discord showed up. And everything changed.

> The Skype era

I know what you’re thinking: “Skype? I thought this story would start on Discord!” Plot twist: that’s not when I first developed a bot! My first shot at bot development was on Skype, at that point I had been a hobbyist programmer for the better part of my life. I had a lot of fun hacking up a small chatbot for my small group of friends: it offered games like trivia quizzes, QoL features such as YouTube link previews and some more fun commands. It had the code quality of someone who never published anything before, so akin to a bundle of overcooked spaghetti, but hey, it worked. I was at that stage: confident that if I banged my head against a problem enough I would eventually figure out the solution, as ugly as it might turn out to be. The following is a code excerpt from my Skype bot… Be advised, it’s not a pretty sight:

# > A little excerpt from the terrible code of my old Skype bot
def ParseMsg(msg):
	global currentAnswer, parsedIDs
	msglist = msg.Chat.RecentMessages

	for msg in msglist:
		if msg.Datetime > startup:
			if not msg.Id in parsedIDs:
#				print msg.Body #DEBUG
				if msg.Body.lower() == currentAnswer and msg.Chat == triviachat:
					currentAnswer = False
				if msg.Body[0:7] == "!26bot ":
					ParseCmd(msg.Id, msg.Body, msg.Sender.Handle, msg.Chat)
				elif msg.Body.find("youtu.be/") != -1 or msg.Body.find("v=") != -1:
					ParseYTLink(msg.Id, msg.Body, msg.Chat)
				if (logging): print "%s: %s" % (msg.Sender.Handle, Sanitize(msg.Body))

def ParseCmd(id, body, sender, chat):
	global triviachat

	if settings["owner-only"]:
		if sender != settings["owner"]:
			return False

	body = body.split(" ")

	if body[1] == None:
		chat.SendMessage("[26bot]: Comando errato. Per una lista: !26bot help")
	elif body[1] == "online" and settings["command-online"]:
		chat.SendMessage("[26bot]: Sono online. (bow)")
	elif body[1] == "google" and settings["command-google"]:
		CreateGoogleLink(body, sender, chat)
	elif body[1] == "wiki" and settings["command-wiki"]:
		WikiSummary(body, sender, chat)
	elif body[1] == "morra" and settings["command-morra"]:
		MorraCinese(body, sender, chat)
	elif body[1] == "trivia" and trivia == False and settings["command-trivia"]:
		triviachat = chat
	elif body[1] == "stoptrivia" and settings["command-stoptrivia"]:
		if chat == triviachat:
			triviachat = False
			chat.SendMessage("[26bot]: Ok. (bow)")
	elif body[1] == "help":

Sadly at one point Microsoft pulled the plug from the old Skype Desktop API. The unoriginally named 26bot was no more.

> It lives!

I first heard about Discord in a Twitch chat. From a user perspective I was instantly captivated: I never used the strikingly similar Slack before that time, so from my point of view it was like someone extrapolated the best features from Skype and TeamSpeak and built the perfect mix. It was, and still is, everything and more I ever wanted from a IM platform. If until that point I was simply enthusiastic about the sheer amount of convenience Discord offers, when I found out it also offered a API for bots I knew that our search for a better IM was over. After some quick research I found the ever popular Discord API Python wrapper discord.py, it offered great documentation and plenty of example to get started right away. Not even a day passed and I had already started building a new iteration of my old hunk of junk: a day later it could tell random proverbs and allow people to create custom commands, four days later it was capable of hosting a trivia game. Looking around the popular bots at the time there was already a lot of choice: music bots, moderation bots… However, I noticed that there was a distinct lack of multi function bots. Bots that you could host yourself on your own machine and have total control over were even fewer. Furthermore, I could not find any bot that offered trivia with customizable lists like mine. I was sure that at least someone would find what my bot offered interesting, however, the idea of publishing the revived 26bot made me a bit anxious, as I never shared anything I made up to that point. The thought of other people using something I made was too exciting to pass and, even if I didn’t know it at the time, I had already made my decision.

> First time sharing

“How does this GitHub thing actually work?” “How do I make the installation process straightforward for the user?” “… Wait, this thing is fully in Italian, it has to be translated first!”

Luckily for me there were a myriad of resources to start using git and some open source bots to take as an example. I didn’t fully grasp how git worked yet but I was able to upload my now translated bot to GitHub. I put together a readme file that highlighted the main features, included some basic installation instructions (Windows only!) and some humor sprinkled on top. Fun fact: part of the installation process was to configure the bot by editing the code, which is now a huge no no. But it didn’t matter, it worked and it was good enough. Up to that point I wasn’t trying to build a community… In fact, the plan was to tell people to just DM me for issues with the bot. Luckily a friend pointed out to me that it was pretty silly not to have a dedicated Discord server for it. So, I made one, and it would later reveal itself crucial for what happened next. Stay tuned for the next part!