You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
938 B
Rust
36 lines
938 B
Rust
|
2 years ago
|
|
||
|
|
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
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|