utility.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:aryas 作者: lattkkthxbbye 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号