summaryrefslogtreecommitdiff
path: root/src/commands/general/convert.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-02 07:00:24 -0500
committerseth <[email protected]>2023-12-15 16:41:13 -0500
commit0025ad5ea8d412aacc3184d18063fd5ff3de0175 (patch)
tree1d2b5ac5c04a092756180722358d929feeae50aa /src/commands/general/convert.rs
parentac32ec2a0ba37deb0ad82b4f2ee9c1e1b359cc88 (diff)
feat: add per guild configuration
Diffstat (limited to 'src/commands/general/convert.rs')
-rw-r--r--src/commands/general/convert.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/commands/general/convert.rs b/src/commands/general/convert.rs
new file mode 100644
index 0000000..60135c4
--- /dev/null
+++ b/src/commands/general/convert.rs
@@ -0,0 +1,55 @@
+use crate::Context;
+use bottomify::bottom;
+use color_eyre::eyre::Result;
+
+#[poise::command(
+ slash_command,
+ subcommands("to_fahrenheit", "to_celsius", "to_bottom", "from_bottom")
+)]
+pub async fn convert(_ctx: Context<'_>) -> Result<()> {
+ Ok(())
+}
+
+/// ask teawie to convert °F to °C
+#[poise::command(slash_command)]
+pub async fn to_celsius(
+ ctx: Context<'_>,
+ #[description = "what teawie will convert"] degrees_fahrenheit: f32,
+) -> Result<()> {
+ let temp = (degrees_fahrenheit - 32.0) * (5.0 / 9.0);
+ ctx.say(temp.to_string()).await?;
+ Ok(())
+}
+
+/// ask teawie to convert °C to °F
+#[poise::command(slash_command)]
+pub async fn to_fahrenheit(
+ ctx: Context<'_>,
+ #[description = "what teawie will convert"] degrees_celsius: f32,
+) -> Result<()> {
+ let temp = (degrees_celsius * (9.0 / 5.0)) + 32.0;
+ ctx.say(temp.to_string()).await?;
+ Ok(())
+}
+
+/// teawie will translate to bottom 🥺
+#[poise::command(slash_command)]
+pub async fn to_bottom(
+ ctx: Context<'_>,
+ #[description = "what teawie will translate into bottom"] message: String,
+) -> Result<()> {
+ let encoded = bottom::encode_string(&message);
+ ctx.say(encoded).await?;
+ Ok(())
+}
+
+/// teawie will translate from bottom 🥸
+#[poise::command(slash_command)]
+pub async fn from_bottom(
+ ctx: Context<'_>,
+ #[description = "what teawie will translate from bottom"] message: String,
+) -> Result<()> {
+ let decoded = bottom::decode_string(&message)?;
+ ctx.say(decoded).await?;
+ Ok(())
+}