The Adventures of Coding a Discord Bot

Me starting to write the basic code of my own mining discord bot!

Everyone uses Discord, right? No? Well, quite the majority do. So I’ve decided to turn my game into a Discord Bot! Creating a Discord Bot seemed like a good way to spread my coding influence, so I started creating one!

The Beginning

I wanted to start quickly and add a lot of stuff! I asked some people around Discord for tutorials and one pointed me towards Dapper Dino’s Bot Tutorials. I watched thru majority of them not understanding much, but my bot was set up and I could flip coins and roll dice.

That wasn’t enough so I followed a few more and added the music part to The Kepler Bot, then I wasn’t sure where to go from here. Until one day on my “Recreating Discord Miner into a Game” video, someone commented or DM’ed me, I can’t remember anymore. But they suggested that I turn my Miner Game back into a Discord Bot. Then I started to think…

The Completion

So I soon realized I was programming in Node.js, which was real similar to what I was used to programming in. Known as processingJS, which was linked to JavaScript, which is also what Node.js was also linked to, basically a lot of the stuff I knew could be used here too, which I thought was pretty neat. I soon figured my way thru Custom Emojis with some help from the mighty SpongeJr, who has also created a bot that acts like a role-play game!

I started using for loops, if statements, variables, math commands (well those were a little different but I still got used to them) and a lot more! Obviously rect(); or ellipse(); wouldn’t work as I was dealing with Discord.js and that was made completely of text and emojis, so I had to think a little creative if I wanted to create a mining scenario. Soon enough there were a lot of files in a lot of folders and it was hard to get around. But there was a working mining system, inventories, multiplayer mining, regeneration of land, and plenty more! But I soon realized that the basic code that Dapper Dino provided plus my code didn’t work too well, and things got easily confused like there were two help pages and classes everywhere which I currently don’t understand but I assume they are similar to functions (Which they probably are not :/), so I decided that it was time for a full rewrite of the entire code! Well I’d still have the data separate so there wouldn’t be a thousand lines to scroll thru if I wanted to add something new. The reason I wanted to rewrite the code is I was trying to access the Client (Known as bot in code) variable from the main file, but the other files were in a big folder. So it would be hard to access a file outside of the folder. I spent half an hour figuring it out but no luck.

The Rewrite

Thru the day I added the necessary basics like for when the bot turns on, the message function, and the commando classes. The rewrite was going great! Everything was working out! I created functions for each of the commands, everything would sync a lot better than before because they could access the same variables which saves a lot of code! I decided not to keep the music functions as I don’t see my bot as a music bot, more of a fun and helpful bot! All of the commands work fine and the command I got stuck on one point now will work much better!

And even today I’m still working on the rewrite and adding more commands! Like finishing up the top list command, adding support to check each others inventories, trading, bonuses and possibly moderation commands! I’ll put the link down here to the second and third videos when they are released, but for now, stay tuned!

Don’t forget to subscribe!: https://www.youtube.com/channel/UCocmE7xT6REn0p1kBEgmz2Q

Or follow my instagram!:
https://www.instagram.com/thekeplerteddy/

Thanks for reading! Or watching if you watched the videos!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s