【发布时间】:2021-03-20 09:53:03
【问题描述】:
(对不起我的英语)我的机器人必须通过对表情符号的反应来扮演角色,但它不起作用并且会出现这个错误:
line 13, in on_ready
Moji = await client.send_message(Channel,Text)
AttributeError: 'Bot' object has no attribute 'send_message'
这是我的代码:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = ".",intents = discord.Intents.all())
@client.event
async def on_ready():
print(discord.__version__)
Channel = client.get_channel(815949348948934716)
Text= "Выбери свою роль????"
Moji = await client.send_message(Channel,Text)
await client.add_reaction(Moji, emoji='????')
@client.event
async def on_reaction_add(reaction, user):
Channel = client.get_channel(815949348948934716)
if reaction.message.channel.id != Channel:
return
if reaction.emoji == "????":
Role = discord.utils.get(user.server.roles, name="PUBG")
await client.add_roles(user, Role)
client.run("My token")
请帮帮我
【问题讨论】:
标签: python discord discord.py