Added audit command + bad bot reacion
+ clippy + fmt
This commit is contained in:
parent
b14c1e8278
commit
137f01a9b2
@ -26,16 +26,28 @@ pub fn get_user_wallet(cfg: &mut BotConfig, discord_id: UserId) -> &mut Wallet {
|
||||
|
||||
#[command]
|
||||
#[description("Get your current balance")]
|
||||
#[aliases("audit")]
|
||||
#[only_in(guilds)]
|
||||
async fn balance(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
async fn balance(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
let mut data = ctx.data.write().await;
|
||||
let global_data = data.get_mut::<GlobalData>().unwrap();
|
||||
|
||||
let wallet = get_user_wallet(&mut global_data.cfg, msg.author.id);
|
||||
let user = args.parse::<UserId>().unwrap_or(msg.author.id);
|
||||
|
||||
let wallet = get_user_wallet(&mut global_data.cfg, user);
|
||||
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
format!("Your current balance is {} fren coins!", wallet.coin_count),
|
||||
format!(
|
||||
"{}'s current balance is {} fren coins!",
|
||||
msg.guild(&ctx.cache)
|
||||
.unwrap()
|
||||
.member(&ctx.http, user)
|
||||
.await
|
||||
.unwrap()
|
||||
.mention(),
|
||||
wallet.coin_count
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
@ -98,6 +98,10 @@ impl EventHandler for Handler {
|
||||
}
|
||||
}
|
||||
|
||||
if new_message.content.to_lowercase().contains("bad bot") {
|
||||
new_message.react(&ctx.http, '😭').await.unwrap();
|
||||
}
|
||||
|
||||
give_coin(&ctx, new_message.author.id, 0.05, 5)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user