summaryrefslogtreecommitdiff
path: root/07_sample_bot_structure/src/commands/math.rs
blob: ce7beedb901bdee5eb9e96911a980a9ef3f00875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use serenity::prelude::*;
use serenity::model::prelude::*;
use serenity::framework::standard::{
    Args, CommandResult,
    macros::command,
};

#[command]
pub fn multiply(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
    let one = args.single::<f64>().unwrap();
    let two = args.single::<f64>().unwrap();

    let product = one * two;

    let _ = msg.channel_id.say(&ctx.http, product);

    Ok(())
}