Abstract

To learn more about social media APIs and new programming languages, I designed a bot that helps users call bases from within reddit during Clash of Clans Clan Wars. I wanted to let users manage Clan Wars from within reddit without using another website. Furthermore, by being a third party, the bot helps with accountability among Clan members.

Procedure

I forked a project that uses both Python and PRAW, then modified it to scan comments looking for a particular string, parse the string for relevant data, store the data in a MySQL/MariaDB database, and both comment in the subreddit and PM the user after a given amount of time has passed.

Pycharm window with reddit bot rewrite project open

There were no instructions for setting up the database, so I had to infer the database format from the code of the source project; however, this gave me enough understanding of the source project to submit a pull request on GitHub for it.

Materials

VirtualBox manager window with reddit bot virtual machines

I developed it on an Ubuntu VirtualBox VM, ported the release to a CentOS VirtualBox VM, then ported it to a shared host server running CloudLinux OS without root access.

Result

The bot has been successfully rewritten to v2.0.0 in approximately 3 weeks using the latest praw v6.0.0 package.

reddit thread with bot replying to comment reddit messages with bot PMs

Conclusion

More features need to be added since the rewrite, and the code needs to be refactored to be more readable. It is still in closed beta until it is proven to be stable and then it can be migrated to an Amazon EC2 instance

All development documentation is available at josealermaiii.github.io/clashcallerbot-reddit.

Dec 2018 Update

EC2 instance with htop output

v2.4.6 is stable and running on an Amazon EC2 instance, but still on closed beta until I add more useful features.

Follow my development updates on /r/ClashCallerBot!

Jan 2019 Update

EC2 t3.micro instance with htop output

v2.6.0 is stable and has been running on a t3.micro instance since around v2.5.0. The t3.micro instance features 2 vCPU cores and a slight cost savings compared to a t2.micro instance. This release also brings us into open beta!

As always, keep up with the latest updates on /r/ClashCallerBot.

Feb 2019 Update

v2.6.7 marks the successful migration to the latest Amazon Linux 2 AMI which will be supported until the year 2023.

Instructions can be found in the amazon2_setup docs. No time to rest as new features like systemd integration can now be implemented.