summaryrefslogtreecommitdiff
path: root/src/commands/convert.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-15 23:43:45 -0500
committerseth <[email protected]>2023-11-16 05:41:54 +0000
commitfe9bcd7dc1833d5ba5ad75a84794217d8d840d56 (patch)
tree03a15f34255b8bca4570477553082b23716d7e2f /src/commands/convert.rs
parentab794da608dc35f4a63825fdbe5226840b80e822 (diff)
refactor: merge bottom & convert
Diffstat (limited to 'src/commands/convert.rs')
-rw-r--r--src/commands/convert.rs37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/commands/convert.rs b/src/commands/convert.rs
index c7e09c9..4e5d71c 100644
--- a/src/commands/convert.rs
+++ b/src/commands/convert.rs
@@ -1,6 +1,10 @@
use crate::{Context, Error};
+use bottomify::bottom::{decode_string, encode_string};
-#[poise::command(slash_command, subcommands("to_fahrenheit", "to_celsius"))]
+#[poise::command(
+ slash_command,
+ subcommands("to_fahrenheit", "to_celsius", "to_bottom", "from_bottom")
+)]
pub async fn convert(_ctx: Context<'_>) -> Result<(), Error> {
Ok(())
}
@@ -26,3 +30,34 @@ pub async fn to_fahrenheit(
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<(), Error> {
+ let encoded = 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<(), Error> {
+ let d = decode_string(&message);
+ match d {
+ Ok(decoded) => {
+ ctx.say(decoded).await?;
+ Ok(())
+ }
+ Err(why) => {
+ ctx.say("couldn't decode that for you, i'm sowwy!! :((".to_string())
+ .await?;
+ Err(Box::new(why))
+ }
+ }
+}