【发布时间】:2020-07-07 09:30:34
【问题描述】:
是的,我都是通过客户端完成的,但我不需要输入命令,我只是想进行一个小游戏“僵尸”,其中用户ping其他用户将他们变成僵尸。为此,机器人必须为在消息中被此人 ping 的人赋予特定角色。我得到了您正在 ping 的人的 ID(也许这会有所帮助)。提前致谢。
代码在这里:
import discord
from discord import utils
client = discord.Client()
@client.event
async def on_ready():
print('Connected')
@client.event
async def on_message(message):
if message.author == client.user:
return
role = discord.utils.get(message.guild.roles, name='Hot pink') # i get role
user = message.mentions[0].id #i get id of mention people
# await .add_roles(mute_role) PROBLEM IS HERE (me need, to give role, to mentioned people)
【问题讨论】:
-
到目前为止你尝试了什么?
标签: python discord roles member