more error logic
parent
f99c6df770
commit
20dca04361
10
bot.py
10
bot.py
|
@ -227,6 +227,7 @@ async def mute(ctx, target_user:discord.User):
|
|||
muting_users.remove(target_user)
|
||||
|
||||
if vote_passed:
|
||||
try:
|
||||
# Add to muted_users
|
||||
muted_users.append(target_user)
|
||||
# add temp. role for mute, edit role position to take precedence over other roles
|
||||
|
@ -249,6 +250,8 @@ async def mute(ctx, target_user:discord.User):
|
|||
|
||||
# Remove from muted_users
|
||||
muted_users.remove(target_user)
|
||||
except discord.ext.commands.errors.CommandInvokeError:
|
||||
await error_admin_targeted(ctx)
|
||||
|
||||
@bot.command()
|
||||
async def kick(ctx, target_user:discord.User):
|
||||
|
@ -265,7 +268,10 @@ async def kick(ctx, target_user:discord.User):
|
|||
vote_passed = await take_vote(ctx, "Kick `{}`?".format(target_user), KICK_VOTE_TIME, MIN_KICK_VOTERS)
|
||||
|
||||
if vote_passed:
|
||||
try:
|
||||
await ctx.guild.kick(target_user)
|
||||
except discord.ext.commands.errors.CommandInvokeError:
|
||||
await error_admin_targeted(ctx)
|
||||
|
||||
kicking_users.remove(target_user)
|
||||
|
||||
|
@ -285,8 +291,12 @@ async def ban(ctx, target_user:discord.User):
|
|||
vote_passed = await take_vote(ctx, "Ban `{}`?".format(target_user), BAN_VOTE_TIME, MIN_BAN_VOTERS)
|
||||
|
||||
if vote_passed:
|
||||
try:
|
||||
await ctx.guild.ban(target_user)
|
||||
await ctx.send(":crab: :crab: `{}` IS GONE :crab: :crab:".format(target_user.name))
|
||||
except discord.ext.commands.errors.CommandInvokeError:
|
||||
await error_admin_targeted(ctx)
|
||||
|
||||
|
||||
banning_users.remove(target_user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue