我正在尝试为reaction角色构建一个不和谐的机器人。为此,我尝试结合使用on_reaction_add和fetch_message来检查添加的反应是否是机器人发送的消息,但我不断收到fetch_message的各种错误。代码如下: @bot.command()
async def createteams(ctx):
msg = await ctx.send("React to get into your teams")
await msg.add_reaction("1️⃣")
await msg.add_reaction("
我的目标是做一个小小的“轮盘赌”游戏。每个想玩游戏的成员都应该能够对任何表情做出反应。但我的代码似乎只检测到第一反应。我想得到一个列表,哪个成员对哪个表情符号有反应,然后在代码中使用它。但目前的目标是为每个反应运行我的IF语句。希望你能理解我想要的^^
@commands.command()
async def roulette(self, ctx, value: int):
msg = await ctx.send(f"Choose a color. Make sure you have at least {value} Kakera in your wallet!"
我在写一个不和谐的机器人。我有以下代码:
@client.event
async def on_reaction_add(reaction, user):
print("on_reaction_add called")
@client.event
async def on_reaction_remove(reaction, user):
print("on_reaction_remove called")
# same problem if I remove this part
@client.event
async def on_raw_r
但不是为我工作.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import random
from discord import Game
import math, time
from discord.ext import commands
from discord.utils import get
Client = discord.client
client = commands.Bot(command_p
我制作了超级简单的票证系统,但它不起作用:c。这是我的代码:
@client.event
async def on_reaction_add(reaction, user):
if 'React with to create a ticket' in reaction.message.embeds and reaction.emoji == '':
role = discord.utils.get(user.guild.roles, name="@everyone")
chan = await user.
我从某个github用户那里学习了如何制作一个票务系统,并且我实现了与创建一个票务通道完全相同的代码,但是当我单击反应关闭我的票务并删除由bot创建的票务通道,但它没有删除该通道时,出现了一个问题。
以下是代码:
@client.event
async def on_reaction_add(reaction, user):
if 'React with :ticket: to create a ticket' in reaction.message.embeds[0].description and reaction.emoji == '' and n
每当我们对在机器人启动之前发送的消息添加一个响应,它就不会被检测到。有什么解决办法吗?
代码:(与问题无关)
@client.event
async def on_reaction_add(reaction, user):
if not user.bot:
if reaction.message.author.id == bot_id:
global reactions
if f'{reaction}' in reactions:
await VoteAdded(reaction, user)
await re
所以,我找到了这个问题I want to make a multi-page help command using discord.py,但答案让我产生了怀疑。我尝试了一个类似的代码来尝试这个东西,但在循环进行期间,我实际上不能使用任何其他命令。我应该怎么做才能让所有的命令在循环进行时都能工作? import discord
import datetime
from datetime import timedelta
import pytz
from discord.ext import commands
client = discord.Client()
client = comman
我正在开发一个不和谐的机器人来创建投票,我的代码在这里:
@bot.command(name="newpoll")
async def new_poll(ctx, question, *options):
if len(options) > 12:
await ctx.send("You can have a maximum of 12 choices in your poll")
else:
embed = discord.Embed(title = "Poll",
我正在创建一个机器人,其中有一个命令,它为消息添加了一个反应。我想知道如何创建所有点击特定反应的人的列表。我一直不确定用来回收反应堆的变量。
@client.command(pass_context=True)
@has_permissions(administrator=True)
async def reaction(ctx):
msg = await ctx.send("**React '✅' to this message to sign up!**")
reactions = ['✅']
for emoji in
我想要创建一个模因机器人,当一个人点击这个反应时,机器人会在他/她的dm中发送这个模因。我找不到办法做到这一点!有人能帮我吗?
@client.event
async def on_reaction_add(reaction, user):
if user != client.user:
if str(reaction.emoji) == "➡️":
我有一个命令,可以禁用特定通道中的特定命令。因此,我将其保存在一个json文件中。然后,我要检查是否执行了一个命令,以及该命令是否在json文件中。如果这个命令在json文件中,它应该打印一条消息。否则,它应该执行该命令。
我的代码:
@bot.event
async def on_command(ctx):
with open('commandchannels.json', 'r') as fcheck:
check = json.load(fcheck)
if f'{ctx.guild.id}' in chec
我是编程新手,最近开始尝试编写我自己的机器人。然而,我看过的几乎所有教程都使用ctx命令,每当我使用它时,我都会收到以下错误: "NameError: name 'ctx' is not defined" 下面是使用ctx命令的部分代码。这样做的目的是让它删除最后发送的3条消息。 @client.event
async def purge(ctx):
"""clear 3 messages from current channel"""
channel = ctx.message.cha