summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/bottom_decode.rs35
-rw-r--r--src/commands/bottom_encode.rs35
-rw-r--r--src/commands/mod.rs2
3 files changed, 72 insertions, 0 deletions
diff --git a/src/commands/bottom_decode.rs b/src/commands/bottom_decode.rs
new file mode 100644
index 0000000..fb91756
--- /dev/null
+++ b/src/commands/bottom_decode.rs
@@ -0,0 +1,35 @@
+use crate::utils;
+use serenity::builder::CreateApplicationCommand;
+use serenity::model::prelude::command::CommandOptionType;
+use serenity::model::prelude::interaction::application_command::{
+ CommandDataOption, CommandDataOptionValue,
+};
+
+pub async fn run(options: &[CommandDataOption]) -> String {
+ let err_msg = "expected a copyasta";
+ let option = options
+ .get(0)
+ .expect(err_msg)
+ .resolved
+ .as_ref()
+ .expect(err_msg);
+
+ if let CommandDataOptionValue::String(msg) = option {
+ return utils::bottom_decode(msg).await;
+ }
+
+ "did you forget to enter a message?".to_string()
+}
+
+pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
+ command
+ .name("bottom_decode")
+ .description("teawie will translate something from bottom for you 🥺")
+ .create_option(|option| {
+ option
+ .name("message")
+ .description("what you want teawie to translate")
+ .kind(CommandOptionType::String)
+ .required(true)
+ })
+}
diff --git a/src/commands/bottom_encode.rs b/src/commands/bottom_encode.rs
new file mode 100644
index 0000000..741adc7
--- /dev/null
+++ b/src/commands/bottom_encode.rs
@@ -0,0 +1,35 @@
+use crate::utils;
+use serenity::builder::CreateApplicationCommand;
+use serenity::model::prelude::command::CommandOptionType;
+use serenity::model::prelude::interaction::application_command::{
+ CommandDataOption, CommandDataOptionValue,
+};
+
+pub async fn run(options: &[CommandDataOption]) -> String {
+ let err_msg = "expected a copyasta";
+ let option = options
+ .get(0)
+ .expect(err_msg)
+ .resolved
+ .as_ref()
+ .expect(err_msg);
+
+ if let CommandDataOptionValue::String(msg) = option {
+ return utils::bottom_encode(msg).await;
+ }
+
+ "did you forget to enter a message?".to_string()
+}
+
+pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
+ command
+ .name("bottom_encode")
+ .description("teawie will translate something to bottom for you 🥺")
+ .create_option(|option| {
+ option
+ .name("message")
+ .description("what you want teawie to translate")
+ .kind(CommandOptionType::String)
+ .required(true)
+ })
+}
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index d3ec259..7005ae2 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -1,3 +1,5 @@
pub mod ask;
+pub mod bottom_decode;
+pub mod bottom_encode;
pub mod copypasta;
pub mod random_teawie;