我创建了一个discord机器人,基本上我想要一个清除所有通道的命令 .clear
我对其他命令没有任何问题,没有其他明确的命令。但是当我使用 .help
,它不显示clear命令&它不工作。哦,是的,我得到的错误是“忽略命令中的异常无:discord.ext.commands.errors.commandnotfound:command“clear”未找到”我的代码:
import discord
from discord.ext import commands
import random
from discord import Permissions
from colorama import Fore, Style
import asyncio
# imports for reference
@client.command
@commands.is_owner()
async def clear(ctx):
await ctx.message.delete()
guild = ctx.guild
for channel in guild.channels:
try:
await channel.delete()
print (Fore.GREEN + f"{channel.name} was deleted" + Fore.RESET)
except:
print (Fore.RED + f"{channel.name} was not deleted" + Fore.RESET)
return
# I fixed it, what I had to do was instead of @client.command I was meant to put @client.command()
暂无答案!
目前还没有任何答案,快来回答吧!