async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
global verstuurd_id
global game
print(payload)
#await message.channel.send('Er is een emoji toegevoegd')
if payload.message_id == verstuurd_id and game == True and payload.user_id != s
我正在做一个机器人不和谐,我想让我的机器人在删除消息之前计算对它的反应数
@client.event
async def on_raw_reaction_add(payload):
if payload.channel_id == 614467771866021944:
if payload.emoji.name == "":
# if number of reactions > 4:
# delete the message
我在discord.py中并不是很新,但我不太了解重写版本,heroku强迫我使用它。如果有人对on_raw_reaction_add事件作出反应,我会尝试添加一个角色。我的bot有所有的作用域,无论何时有人对此错误作出反应,都会从web钩子和guilds.join中得到预期的范围:discord.errors.NotFound: 404 Not Found (error code: 10011): Unknown Role
以下是代码:
@client.event
async def on_raw_reaction_add(payload: discord.RawReactionAction
@client.event
async def on_raw_reaction_add(payload):
#the embedded msg that was sent
global msg
message_id1 = payload.message_id
#checks if the message that was sent is the message the reaction was added to
if message_id1 == msg.id:
..code..
我还告诉机器人将反应(从1到9之间的所有反
Part of the code:
def change_1_letter(word, l, r):
word_a = ""
for s in list(word):
if s != l:
word_a = word_a + s
if s == l:
word_a = word_a + r
return word_a
@bot.event
async def on_raw_reaction_add(payload):
channel = bot.get_channel(payload.channel_id)
文件: 78573462558784356 #这是一个id 异步定义: @bot.event
async def on_raw_reaction_add(payload):
with open("createteam.txt", "r", encoding = "utf-8") as file: # id is in a file
author_id = file.read() #the id in str()
author_user = ???author_id.User??? #how to tran
因此,我希望当用户使用特定表情符号对消息做出反应时,机器人可以自动分配角色。但是我的代码不能工作。我怎么解决这个问题? @client.event
async def on_raw_reaction_add(payload):
messgae_id = payload.message_id
if messgae_id == "759765065380659261":
user = payload.user_id
for roles in user.roles:
if roles in DefaultRo
我已经编写了一个不和谐机器人,它为对消息做出反应的用户添加了一个角色。机器人还会回复消息“Hallo bot”。但当我关闭机器人并重新打开它时,在我对另一条消息做出反应之前,该机器人不会回复该消息。 async def on_raw_reaction_add(self, payload):
mitglied = discord.utils.get(payload.member.guild.roles, name="Mitglied")
if str(payload.emoji) == "?":
a
我使用一个json文件来存储行会的星板频道。下面是我的代码: @client.event
async def on_raw_reaction_add(payload):
star = await get_star_channels()
if str(payload.message.guild.id) not in star:
return
starchannel = client.get_channel(star[str(payload.message.guild.id)])
if payload.emoji == &
我需要从他的私人频道得到用户的反应。这是正确的方法吗? @bot.event
async def on_raw_reaction_add(payload):
reactioneer = payload.member
emoji = payload.emoji
if emoji.name == "?":
msg = await reactioneer.send("Hi! Which greeting would you like to hear every morning? Click the reaction of it. He
我希望我的discord机器人能够根据用户的反应在服务器中返回特定的消息:?或?。
我对discord.py不是很熟悉,而且我读过的文档有点混乱,我按照youtube的教程进行了编辑。我可以在控制台中看到打印的反应,但是我得到了错误消息:
Instance of 'Bot' has no 'channel' member
下面是我的代码:
import os
import datetime
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_do
我只是在用discord.py为我的不和谐服务器构建一个不和谐的机器人。我做了个密码,但没用。它创造了信息,你可以做出反应。甚至第一条调试消息也会出现:用户对消息的反应。
但这不能让我扮演这个角色。这是我的密码:
async def reactMsg(ctx):
send_sub = await ctx.message.channel.send("React to this message to subscribe NPT.")
reactions = ['✅']
for i in reactions:
await se
我正在用python编写一个不和谐的机器人,我有一个问题。下面是我的代码:
import discord
from discord.utils import get
from discord.ext import commands
#Créer une instance du bot
bot = commands.Bot(command_prefix='!')
#Donner le jeton pour l'identifier
jeton = "Here is the token"
#Detecter quand le bot est allum