In the process of adding SM Server commands
parent
3befd3f001
commit
8fcdcef2cb
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
use serenity::prelude::*;
|
||||||
|
use serenity::model::prelude::*;
|
||||||
|
use serenity::model::channel::Message;
|
||||||
|
|
||||||
|
|
||||||
|
use crate::utils;
|
||||||
|
|
||||||
|
pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId)
|
||||||
|
{
|
||||||
|
if msg.content == ".randomizer"
|
||||||
|
{
|
||||||
|
let item = utils::get_random_item();
|
||||||
|
if let Err(why) = msg.channel_id.say(&ctx.http, format!("You found {}!", item)).await
|
||||||
|
{
|
||||||
|
println!("Error sending message: {:?}", why);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let command_lower = msg.content.to_lowercase();
|
||||||
|
let mut command_iter = command_lower.split_whitespace();
|
||||||
|
let command_start = command_iter.next();
|
||||||
|
|
||||||
|
if command_start == Some(".color")
|
||||||
|
{
|
||||||
|
if let Some(arg) = command_iter.next()
|
||||||
|
{
|
||||||
|
match arg
|
||||||
|
{
|
||||||
|
// TODO: add color roles
|
||||||
|
_ => utils::Logger::log_error(ctx, &format!("unknown .color argument: {}", arg)).await
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue