问题描述
我正试图使一些“有趣”的命令被机器人调用,并且我想嵌入它们。但是,它不会吐出任何东西,甚至不会引起不和谐或命令提示符下的错误,这使我对如何改进代码一无所知。我还想实现一种使用成员的方法:commands.Greedy[discord.Members]
代码,以便我可以找到谁是该命令的目标,但我想我需要首先解决这个问题。有什么建议吗?
我也很困惑,因为我使用了.format
和f
字符串来尝试使用参数,并且我也尝试了使用message
,但这给了我语法错误'Error'list '对象没有属性'提及'。我真的不能理解命令中的文档,因为它们没有提供任何实际代码示例,而且我很想了解新内容。有人可以弄清楚吗?
from discord.ext import commands
import discord
bot= commands.Bot(command_prefix='0!')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith('Sample Text'):
await message.channel.send('Sample Text')
@bot.command()
async def slap(ctx):
embed = discord.Embed(color=0x00ff00,title='OH! Z E S L A P !',description="ooh,that hurt.")
embed.add_field(name="Man behind the slaughter:",value="test")
await ctx.send(embed=embed)
bot.run('token here')```
-During this edit,when I just had the 'bot command' area,It seemed to have functioned still. This makes it even more confusing...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)