diff options
| author | seth <[email protected]> | 2023-04-07 19:39:22 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-04-07 20:00:57 -0400 |
| commit | 83f885ee8d762551a6c5d8ea5ab3719cde76464a (patch) | |
| tree | b81ee4ed2b6c935023b51be22de7591bf654c1c5 /src/commands/bottom_decode.rs | |
| parent | 4ee540028b3bbc9671db597e761033865c7ed6d1 (diff) | |
add bottom encode/decode
Diffstat (limited to 'src/commands/bottom_decode.rs')
| -rw-r--r-- | src/commands/bottom_decode.rs | 35 |
1 files changed, 35 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) + }) +} |
