mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-16 07:18:54 +00:00
y2!kick now actually kicks instead of ban (#17)
Fix formatting y2!kick now actually kicks instead of ban
This commit is contained in:
parent
20a15efcc4
commit
99c7888dfb
1 changed files with 6 additions and 14 deletions
|
@ -58,7 +58,7 @@ fn clean(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||
#[command]
|
||||
#[required_permissions(ADMINISTRATOR)]
|
||||
#[description = "Ban an user with a certain reason."]
|
||||
#[usage = "ban user#1234 spam"]
|
||||
#[usage = "@user#1234/spam"]
|
||||
#[min_args(1)]
|
||||
#[max_args(2)]
|
||||
#[only_in("guilds")]
|
||||
|
@ -83,26 +83,18 @@ fn ban(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||
|
||||
#[command]
|
||||
#[required_permissions(ADMINISTRATOR)]
|
||||
#[description = "Kick an user with a certain reason."]
|
||||
#[usage = "kick user#1234 spam"]
|
||||
#[min_args(1)]
|
||||
#[max_args(2)]
|
||||
#[description = "Kick an user."]
|
||||
#[usage = "@user#1234"]
|
||||
#[num_args(1)]
|
||||
#[only_in("guilds")]
|
||||
fn kick(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult {
|
||||
let user = args.single::<UserId>()?.to_user(&ctx)?;
|
||||
let reason = args
|
||||
.remains()
|
||||
.map(|v| format!("`{}`", v))
|
||||
.unwrap_or("no provided reason".to_owned());
|
||||
|
||||
msg.reply(
|
||||
&ctx,
|
||||
format!("🔫 Kicking user {} for {}.", user.tag(), reason),
|
||||
)?;
|
||||
msg.reply(&ctx, format!("🔫 Kicking user {}.", user.tag()))?;
|
||||
|
||||
msg.guild_id
|
||||
.ok_or("Can't get guild from message?")? // we had a contract
|
||||
.ban(&ctx.http, user, &reason)?;
|
||||
.kick(&ctx.http, user)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue