Toying With This Week (Feb 7 - Feb 13)
Added 2021-02-07 18:59:09 +0000 UTCThis past week I got the Lovense USB dongle working. The other toys I planned on working on adding support for still haven't shown up.
So instead I went back to work on the XToys Discord bot!
Discord Bot
The bot as currently planned is going to have 4 ways of interacting with it.
- Reactions to a main bot message
- Reactions to any messages the user sends
- Any messages from anyone with a certain keyword
- Messages directed at the bot
What functionality is active depends on what script you're running on the XToys side.
The script can also clear reactions on your main XToys status message, and send updates to Discord.
I've implemented all of that functionality but now I'm on to the more time consuming bit before I can actually release it:
- Playing nicely with Discord's rate limits. Processing user messages and reactions is fine and won't have any limitations, but I'd really love for the bot to update the post when the toy is active or not, or when there's a new vote. Discord has a couple major bot rate limits though of (what I think are) 5 edits/5s/channel, and 50 requests/1s period across the entire use of the bot.
I'm going to try out leveraging Discord webhooks in combination with the bot as a way of not hitting the global limits. And I already rate limit per user message updates. Hopefully that will work ok and if not I might have to drop the ability for scripts to edit the Discord message. - Reaction limits. I currently have a command for clearing all vote reactions but leaving the bots initial reactions in place. This works great but probably won't on mass because of rate limits. I'll likely have to drop that functionality and users will just have to do the first reaction of each vote themselves.
- Error handling and such. The bot does handle sanitizing user input currently but I imagine there's still a ton of ways someone could crash the bot that I need to cover.
- Hosting. I'm still not sure where to host it. Probably need to set up a VPS.
- Sharding. I don't technically need to get this working before release but it would be nice. I need to implement the ability for the bot to run on multiple servers while also having XToys know which bot instance to communicate with. I'm not sure how to go about this.
- Costs. I'm fairly certain I'm going to be charging for each Discord guild the bot is hosted in. It's going to be too expensive to run the bot without somehow limiting how fast it spreads. But I need to actually figure out how to implement that limitation.


It would also be nice for the bot to somehow grant users access to the session if the user wants. But I'll leave that bit for later.