Open comments for this post
Devlog 2:
I finally finished adding the core message tracking features! I made some slash commands that let users track the top chatters over different time periods.
I created the /last-hour, /last-day, and /last-week commands. I used Python’s datetime module to calculate an exact time period and then look back through the channel history to count up the messages. I also added a defer() function to each command so the bot can safely process the data without timing out or breaking.
When implementing the /all-time command, I realized that downloading every single message ever sent could easily crash the bot. To fix this, I built a custom warning button using. Now, the bot sends a warning message with a Confirm & Run button, and it will only start the process if a user explicitly clicks it.
I ran into a frustrating issue with Git where my .env file kept getting included in my commits even though it was listed in my .gitignore. I learned that because Git tracked the file early on, it was ignoring the ignore rules. I used the terminal to untrack it and was able to keep it ignored.
Next I will be working on moving the bot away from API scraping and into local storage. I will be working on the following thiings:
- Setting up a SQLite database within the project.
- Logging and counting messages in real-time as they are sent.
- Rewriting the leaderboard commands to pull from the database instead of loading history from discord APIs.
Thank you for reading my 2nd devlog!
Open comments for this post
Devlog 1:
I was able to get the discord bot online and running! Set up the basic framework using Python and the discord.py library. I got it connected to discord and online and made it print a confirmation message to terminal when it’s online.
I also used canva to make some custom art for the discord profile picture and the banner to make it look more professional and give it some personality.
I ran into some SSL certificate verification errors when running the bot which was annoying to debug and fix. I used Github Copilot to help me debug and solve the issues and I figured out that I had to point Python to the certifi certificate bundle. Once I restarted and ran it again, the bot connected successfully.
Next I will be working on the core features of the bot which are:
- A command that lets you see who has the most messages in a server within the last day.
- A command for most within the last week.
- A command for most messages all time in the server.
These are the core basic features I plan to implement, I have other ideas like commands to see who spent time in vc (voice chat) in the same pattern as the messages commands and more things like that.
Thank you for reading my 1st devlog!
Open comments for this post
I started the guide on making my 1st ever slack bot (as the title suggest its amazing and the best beginner one you’ll ever see).
Ran into 1 issue with commands where I renamed the commands on the slack api website (to distinguish it from the million other slack bots in the stardance slack channel). After doing this I kept getting an error when running commands.
After some trial and error and testing, I was able to figure out that the problem was within my code. I was using the base code the slack bot guide gives you and that gives you the basic command names (/dsb-ping). I had to go in the code and rename the command names to match what they were on the api wesbite.
Next I’m going to integrate more free apis (like a cool dog one) and publish it on nest.