【发布时间】:2021-11-03 01:00:12
【问题描述】:
我正在编写一个机器人,这里是整个代码:
print("Loading bot...")
import discord
import time
import asyncio
import datetime
import requests
from discord.ext import commands
from discord.ext import tasks
from discord.utils import get
from webserver import keep_alive
import os
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="t.", intents=intents)
bot.remove_command('help')
[Other code]
#Purge command
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def purge(ctx, limit: int):
await ctx.channel.purge(limit=limit)
await ctx.send("Messages purged ????")
await ctx.message.delete()
keep_alive()
bot.run('TOKEN)
我的错误: Click here
是的,我在 python 3.8.5 上使用 repli 有什么问题? 希望你能回答我的问题。 我真的不知道该怎么办,discord.py 是一种很奇怪的编程语言:/ 谢谢 进化
【问题讨论】:
-
[Other code]中有什么内容?您可能已经覆盖了commands并以某种方式使其成为命令 -
@MrSpaar 我删除了代码,因为我认为这没有必要。正如您在编辑历史记录中看到的,OP 有一个名为
commands的命令,这可能会导致错误。 -
是的,这可能是导致错误的原因,
commands不再指代discord.ext.commands而是指函数
标签: python discord discord.py command bots