我试图使齿轮组织我的机器人,但我有一个错误,我不知道如何修复。机器人在cog中成功地执行了find命令,但当我编写该命令时,出现以下错误:
你能帮我吗?下面是我的代码:
import discord
import asyncio
import re
import os
import random
from discord.ext import commands
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot
#Purge
@commands.command()
async def purge(ctx, amount=10):
await ctx.channel.purge(limit=amount)
发布于 2020-09-06 07:41:33
您的第一个参数必须为self
。
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot
#Purge
@commands.command()
async def purge(self, ctx, amount=10):
await ctx.channel.purge(limit=amount)
发布于 2020-09-05 22:25:58
在purge函数中添加self作为参数。
异步延迟清除(自身、ctx、amount=10):等待ctx.channel.purge(limit=amount)
https://stackoverflow.com/questions/63758974
复制