IT LIVES! My Discord Bot Development has Begun

nonsensetwice
{nonsensecodes}
Published in
4 min readDec 25, 2019

--

This is an update to my participation in the #100DaysOfCode Challenge.

What a fitting way to hit the midpoint of 100 Days of Code: finally beginning the development of my Discord bot. I set out on this journey a few months ago, and stalled for momentarily when faced with learning JavaScript. It wasn’t until I stumbled across this daily coding challenge that I found the motivation to show up every day and learn. Within this time, I completed the JavaScript Algorithms and Data Structures certification on freeCodeCamp, as well as the Basic Node and Express module. Armed with this newfound knowledge, I put my head down and picked back up where I started.

… sort of.

Months ago, I subscribed to a droplet with Digital Ocean, and had set up an infantile development platform consisting of Node.js and Discord.js, and that’s it. Not knowing what I was doing at the time left me with not much more to go off of. Also, given that it’s been some time since I’ve worked in the droplet, I didn’t quite remember where I had left off, so I wiped the droplet and started over.

It took me about two days worth of working through several tutorials to figure out how I was going to get this development environment set up. I have in mind future development and want to be able to scale to that. And while I don’t currently know all that this will entail, I want to at least have the things up and running that I know I’ll make use of later. I had already set aside a subdomain with my current web host and attached it to the droplet. From that point, it was a matter of understanding how to get a server up and running to display web pages. I wanted to lay the foundation for serving up a User Interface later on, when I arrived at that point.

Using the Termius app, I was able to connect to my droplet from my iPad and manage all of the command-line work I needed in order to get Nginx installed and configured with a firewall and SSL authentication.

With all that out of the way, I went ahead and setup the environment I would need to actually develop and run my bot. I installed the latest stable release of Node.js (currently 12.x), created a project folder and the associated package.json, and then installed discord.js as a dependency within that file. I already had the bot established from back when I first embarked on this journey, so from this point, it became a matter of understanding how to write the code and get it onto the server.

Now comes the fun part. Setting up the server with Digital Ocean was one monster, creating a development workflow from script to execution on my iPad was another. I needed to be able to write and test the code locally, and then upload the code to the server to run it. Writing the code was simple enough; I’ve been doing that all along as I worked through the JavaScript cert. My main tool of choice has been play.js, a JavaScript coding app operating over Node with React and React Native tools baked right in. As for uploading files to the server … well, that was something I wasn’t quite familiar with.

Termius has file uploading protocols built right in to the app. However, that shit costs money. Once the free trial ends, you’re looking at $9.99/mo or $99.99/yr, neither of which works for me at the moment. Perhaps when I start making money from the development stuff, I’ll pick up a subscription. Truth is, I think it’s totally worth it — the app is well designed, functional, feature-rich, and gorgeous! I’m a sucker for good design. It’s just not feasible for me at the moment. Which means I needed to find another solution.

Enter Shellfish, an SFTP client for iOS. Once I figured out how to get the SSH keys worked out and get a connection open between the app and my server, I was pretty much good to go. The beautiful thing about this app is that it links right in with my Files app, so I have file browser access to my server. Termius offers this same functionality, but again, Termius costs major money compared to Shellfish, which is a one-time charge of $9.99, to keep it running without having to continually extend the trial.

Once I had this all figured out, it was game on. I worked through the first few pages of the Discord.js guide and was able to get my bot live and running! Create the files and code in play.js, upload them to my server with SFTP via Shellfish and the Files app, and troubleshoot with the console in both play.js and Termius. Pretty solid workflow, methinks.

I’m doing the damn thing. And I’m so fucking excited.

50/100

--

--

nonsensetwice
{nonsensecodes}

Reading & Writing. Music & Movement. Coffee & Code. Chaotic Great.