Added some better error messages
+ Clippy + fmt
This commit is contained in:
parent
6693cb4f98
commit
e343c97306
@ -8,7 +8,6 @@ use serenity::model::channel::Message;
|
|||||||
pub struct ADMIN;
|
pub struct ADMIN;
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
#[owners_only]
|
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn reload(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
async fn reload(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||||
let mut data = ctx.data.write().await;
|
let mut data = ctx.data.write().await;
|
||||||
|
|||||||
@ -345,9 +345,23 @@ async fn bet(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
msg.reply(&ctx.http, "Race not in progress").await?;
|
msg.reply(&ctx.http, "Race not in progress").await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let racer = args.parse::<EmojiIdentifier>()?;
|
let racer = match args.parse::<EmojiIdentifier>() {
|
||||||
|
Ok(emoji) => emoji,
|
||||||
|
Err(e) => {
|
||||||
|
msg.reply(&ctx.http, format!("Invalid emoji: {}", e))
|
||||||
|
.await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
args.advance();
|
args.advance();
|
||||||
let amount = args.parse::<u32>()?;
|
let amount = match args.parse::<u32>() {
|
||||||
|
Ok(amount) => amount,
|
||||||
|
Err(err) => {
|
||||||
|
msg.reply(&ctx.http, format!("Invalid bet amount: {}", err))
|
||||||
|
.await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let send = race_msg_channel.send.lock().await;
|
let send = race_msg_channel.send.lock().await;
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,14 @@ async fn gift(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
|
|
||||||
args.advance();
|
args.advance();
|
||||||
|
|
||||||
let amount = args.parse::<u32>()?;
|
let amount = match args.parse::<u32>() {
|
||||||
|
Ok(amount) => amount,
|
||||||
|
Err(err) => {
|
||||||
|
msg.reply(&ctx.http, format!("Invalid coin amount: {}", err))
|
||||||
|
.await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let mut data = ctx.data.write().await;
|
let mut data = ctx.data.write().await;
|
||||||
let global_data = data.get_mut::<GlobalData>().unwrap();
|
let global_data = data.get_mut::<GlobalData>().unwrap();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user