discord-kurante/src/commands/clap.rs

24 lines
667 B
Rust

use serenity::framework::standard::{macros::command, Args, CommandResult};
use serenity::model::channel::Message;
use serenity::prelude::Context;
#[command]
async fn clap(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
let resp = match args
.iter()
.map(|e: Result<String, _>| e.unwrap())
.collect::<Vec<_>>()
.as_slice()
{
[] => ":clap:".to_string(),
[_] => "You can't clap a single word."
.split_whitespace()
.collect::<Vec<_>>()
.join(" :clap: "),
args => args.join(" :clap: "),
};
msg.channel_id.say(ctx, resp).await?;
Ok(())
}