我试图制造一个不和谐的机器人,我正在遵循一个简单的教程,任何我不能得到最简单的命令来工作。 我在Python3.6上运行discord.py版本0.16.12
#Imports
import time
import discord
import asyncio
from discord.ext import commands
#Initialize
client = discord.Client()#Creates Client
bot = commands.Bot(command_prefix='!')#Sets prefix for commands(!Command)
#Code
@bot.command()
async def SendMessage(ctx):
await ctx.send('Hello')
代码应该可以工作,但是它给了我一个错误discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing.
默认情况下,Discord.py命令不会传递上下文。您指定希望通过将so作为参数传递给decorator来传递上下文。
从documentation:
相关问题 更多 >
编程相关推荐