Issue
My code is like this, I want it to send a message and react to it, but after running it, nothing happens in the channel, and there's no error either.
@client.event
async def on_ready():
Channel = client.get_channel(775355712271941647)
Text = "React to get role"
moji = await Channel.send(Text)
await moji.add_reaction(emoji='🏃')
Solution
I found out the problem is I have two on_ready
, and I should also use bot.event
instead of client.event
(because I named the client as bot).
So the following code would work if you have same problem as me:
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
moji = await bot.get_channel(775355712271941647).send("bot is online")
await moji.add_reaction(emoji='🏃')
Answered By - Shane Li
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.