def kick_user(user, mod, server, bot, reason):
"""
Kicks a user and then logs it to the 'mod_log' channel
:param user: Member object of the user who needs to be kicked
:param mod: Member object of the responsible moderator
:param server: Server object of the server
:param bot: Bot instance to kick and log
:param reason: Reason why user is being kicked
"""
config = bot.cogs['Config']
channel = get_channel_by_name(server, config['aryas']['mod_log_channel_name'])
try:
await bot.kick(user)
msg = '{} was kicked by {}. Reason: {}'.format(user.name, mod.mention, reason)
send(bot, msg, channel, False)
except Exception as e:
config.logger.error(e)
send(bot, 'Failed to kick {} for {}'.format(user.mention, reason), channel, False)
评论列表
文章目录