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)))
评论列表
文章目录