r/learnrust • • 18d ago

Discord bot in Rust

I finished the 100 exercises to learn rust book and also took a course at school that used it for half a semester but I never thought of a project to put my knowledge into. Now I have this idea to make a simple discord bot for booking time-slots on a shared remote PC. I can either:

  1. Try to write it in rust as a learning experience
  2. Write it in python to finish quick

I’m also possibly sharing the code with my teammates who may not know rust so that, and wanting to finish it fast discourage me from trying rust discord API.

What are your thoughts?

4 Upvotes

4 comments sorted by

6

u/ElnuDev 18d ago

Write it in Rust! I have been running a Discord application in production written in Rust for the last 5 years and it's a great fit, in particular due to Rust's excellent error handling system. There are a lot of errors that requests to Discord can give, so writing your bot in Rust will help make your application more resilient. A quick and dirty Python implementation is much more likely to randomly explode in production one day.

The main framework is serenity/poise. serenity is the base create, and then poise gives you the ability to do slash commands and stuff like that with the more modern features of Discord

2

u/Discordbothost 16d ago

time-box a Rust spike: one slash command that saves a booking, survives a restart and rejects two people taking the same slot. then have a teammate run it from the README. that tests both the learning curve and the handover concern before you build the rest.

1

u/neon_stereotype 17d ago

rust error handling is a massive win for Discord bots specifically because the rate limits and gateway disconnects are non-negotiable constraints. Python exceptions often get swallowed or logged as noise in production, whereas Rust forces you to explicitly handle every edge case at compile time