【发布时间】:2021-02-11 15:01:25
【问题描述】:
我尝试运行此代码(请参阅下面的代码)。
代码:
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
Channel = client.get_channel('406473869424328736')
Text= "REACT TO ME"
Moji = await Client.send_message(Channel, Text)
await client.add_reaction(Moji, emoji='question')
@client.event
async def on_reaction_add(reaction, user):
Channel = client.get_channel('406473869424328736')
if reaction.message.channel.id != Channel:
return
if reaction.emoji == "question":
Role = discord.utils.get(user.server.roles, name="test")
await client.add_roles(user, Role)
client.run("NzcxMDQxMzcwNjU5MjI1NjMw.X5mWPA.oiEvo4otmA3lThVzCBxQHunugO4")
Moji = await client.send_message(Channel, Text)
但是,我收到如下错误 错误:
AttributeError: 'Client' object has no attribute 'send_message'
【问题讨论】: