With forced functional programming, you may be referring to serenity's builders? For example
.send_message(|m| m
.content("text")
.embed(|e| e
.description("...")
.timestamp("...")
)
.components(|c| c
.create_action_row(|r| r
.create_button(|b| b
.style(ButtonStyle::Primary)
.label("press me")
.custom_id("button1")
)
)
)
).await?;
In the next breaking release (`next` branch in git), we have a new by-value builder style which has
turned out to be a better design in many ways:
And a PR is open to make the API even better (replace redundant CreateComponents with Vec<CreateActionRow>) and more will be coming presumably.
Does this seem more rusty to you? We're open to more criticism - developmenet on serenity is quite active currently (e.g.
52 PRs merged in the last month)
shuttle has released support for Serenity (a Rust library for the Discord API) a while back and now we have a tutorial ready for anyone willing to give it a go: https://www.shuttle.rs/blog/2022/09/14/serentity-discord-bot (creating a simple Discord bot, extending it to a weather forecast bot and deploying it with shuttle, for free).
To give you some context on shuttle; it is a Rust-native cloud development platform (open-source) that allows you to deploy your Rust app (or Discord bot, in this case) by adding a single annotation to your main file. Once you do that, you can run `cargo shuttle deploy` and your app/bot is all set!
This looks really cool! I've written a music bot with Serenity before and have been hosting it on a VPS. I was looking on migrating to serverless infra, but Cloudflare workers sadly didn't work with streaming audio over a voice channel for a sustained period. Is this use case supported by Shuttle?
One thing that would help me have confidence in shuttle would be pricing somewhere between the $0 and "ask us" tiers. Something to consider after exiting your alpha.
I suppose that's what the "host for yourself on AWS" approach is for, it would be great to see some docs written for that too!
This is neat. I'm a huge fan of serverless as a backend. I happen to enjoy writing JavaScript, so my needs are fairly well meet, but I'm increasingly using rust for side projects so I'm glad to see someone taking the time to make it easy to use and deploy in a serverless environment.
Our current pricing model is currently in progress and we are shaping our billing around the needs of our users while we are in alpha. This is subject to change in the near future depending on how shuttle evolves over the next couple of weeks/months.
And thank you for the feedback re: AWS approach being documented, this is definitely something that we'll cover in the near future.
Glad you like it! :) Lmk if you have any other questions.
shuttle is on AWS under the hood although we make the process much easier for people (not having to deal with the console and other its and bits). There is (almost) no runtime penalty in using shuttle, vs deploying this yourself.
Other than that, we've got GH actions you can use, you get GitOps for free, you don't have to write Containerfiles and we have a centralised build system which will reduce build time by hitting the cache!
It felt like someone was trying to force functional programming on rust, with typenames from java.
Sure it works but the code looked very verbose, and the ridiculous types like 'ApplicationCommandInteractionDataOptionValue' definitely did not help.
Serenity works well, it's just definitely not rust-style.