我正在使用一个使用python和discord.py的discord机器人。我在discord上启用了TTS,甚至当我使用标记tts=False时,只要我让机器人向通道发送消息,它就会使用tts读出消息。我不知道如何禁用它,因为文档中只简单地说要使用tts=False,这就是我正在做的。因此,在下面的示例中,当输入.ping时,tts读出"Bot says My ping is 10ms“,并向通道发送相同的消息,我希望它只向通道发送消息,而不是读出它。 import discord
from discord.ext import commands
client = command
这个命令应该做的是删除指定数量的消息,但是我得到了一个错误:
Ignoring exception in command clear:
Traceback (most recent call last):
File "C:\Users\dimit\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 62, in wrapped
ret = yield from coro(*args, **kwargs)
File "c:/
多亏了discord.py插件,我已经用python3开发了一个小机器人,它必须向Discord服务器中的所有用户发送一条私人消息。 @bot.event
async def on_message(message):
if message.content.startswith('!mmb'):
channel = message.channel
x = message.guild.members
text = 'Test'
for member in x:
prin
如何让我的机器人删除我在discord.py中回复的消息?我只有标准清除命令的代码
@commands.has_permissions(manage_messages=True)
@bot.slash_command(description="Clears X messages.")
@discord.option("num", description="amount of messages")
@discord.option("target", description="from specific member"
@client.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def clear(ctx,amount=1000):
await ctx.channel.purge(limit=amount)
@clear.error
async def clear_error(ctx,error):
if isinstance(error, MissingPermissions):
text = "Sorry {}, you do not have per
我试着用discord.py做了一个机器人
bot = commands.Bot(command_prefix='$', description="This is a test bot")
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
@bot.command(name='ping')
async def ping(ctx):
await ctx.send("pong
我创建这个机器人已经2个月了,然后我停了1个月。当我再次尝试运行我的机器人时,我总是得到这个错误(在真实的代码中,我用真实的token替换了'TOKEN‘。):
File "main.py", line 10, in <module>
bot.run('TOKEN')
File "venv\lib\site-packages\discord\client.py", line 640, in run
return future.result()
File "venv\lib\site-pack
我正在开发我的第一个discord机器人,我甚至没有进入复杂的命令就遇到了很多问题……我以前用过python,但没有用过discord.py,我发现它很难。我遇到了这个恒定的错误代码,它真的让我很困扰。下面是我的代码: async def on_member_join(member, ctx, channel):
channel = client.get_channel(753699172237967440)
await channel.send(f'HQ has sent another employee to help us with our tasks, eve
我正在使用Python3.9.6和Discord.py制作一个不和谐的机器人。我正在使用两个命令处理齿轮;一个用于从函数外部的列表中发送随机字符串,另一个用于将字符串添加到消息列表中。当我尝试传递消息变量时,似乎一切正常,但当我在不一致的情况下测试命令时,出现了以下错误消息: discord.ext.commands.errors.MissingRequiredArgument: messages is a required argument that is missing. 我认为这意味着机器人期望用户给出messages,所以我尝试删除messages参数。但是,当我这样做时,我得到了这