diff options
| author | Leah Amelia Chen <[email protected]> | 2023-07-09 18:38:31 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-09 20:38:31 -0400 |
| commit | 445822efad6682edbe0b1e27448b997fae9564c5 (patch) | |
| tree | f95ffa8dac7845e9ee42a1a686c6e627e5a08195 /src/commands/bottom.rs | |
| parent | 9b65da1265b3d6f5d38382012e6abc3936b8a45f (diff) | |
Refactors + add pin board module (#32)
* refactor according to the rules of the cone school of rustâ„¢
* Add pin board module
* cargo fmt
* More cleanups + appease clippy
Diffstat (limited to 'src/commands/bottom.rs')
| -rw-r--r-- | src/commands/bottom.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/commands/bottom.rs b/src/commands/bottom.rs index d25eab1..dbe74b9 100644 --- a/src/commands/bottom.rs +++ b/src/commands/bottom.rs @@ -5,9 +5,8 @@ use serenity::model::prelude::interaction::application_command::{ CommandDataOption, CommandDataOptionValue, }; -pub async fn run(options: &[CommandDataOption]) -> String { +pub fn run(options: &[CommandDataOption]) -> String { let err = "failed to get nested option in"; - let mut ret = "did you forget to enter a message?".to_string(); let data = options .get(0) @@ -16,6 +15,7 @@ pub async fn run(options: &[CommandDataOption]) -> String { // get subcommand to decide whether to encode/decode let subcommand = data.name.as_str(); + // TODO: this is horrendous // get message content let option = data .options @@ -27,19 +27,13 @@ pub async fn run(options: &[CommandDataOption]) -> String { if let CommandDataOptionValue::String(msg) = option { match subcommand { - "encode" => { - ret = bottom_encode(msg).await; - } - "decode" => { - ret = bottom_decode(msg).await; - } - _ => { - ret = "something went wrong :(".to_string(); - } - }; + "encode" => bottom_encode(msg), + "decode" => bottom_decode(msg), + _ => "something went wrong :(".to_owned(), + } + } else { + "did you forget to enter a message?".to_owned() } - - ret } pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { |
