bot.py 文件源码

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

项目:discord-raid-coordinator 作者: dandesousa 项目源码 文件源码
def invite_user_to_raid(channel, user):
    """Invites a user to the raid channel."""
    global should_refresh_active_raids

    # don't invite bots and webhooks
    if user.bot:
        return

    # refresh active raids in future
    should_refresh_active_raids = True

    # adds an overwrite for the user
    perms = discord.PermissionOverwrite(read_messages=True)
    await client.edit_channel_permissions(channel, user, perms)

    # invite user to role
    role = get_raid_role(channel)
    if role:
        await client.add_roles(user, role)

    # sends a message to the raid channel the user was added
    await client.send_message(channel,
                              "{}, you are now a member of this raid group.".format(user.mention),
                              embed=get_success_embed('{} has joined the raid!'.format(user.display_name)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号