我的清除所有频道命令似乎不起作用。 (discord.py)

时间:2021-07-09 06:01:22

标签: python discord discord.py

我创建了一个 discord bot,我想要一个清除所有频道的命令,基本上是 .clear 我对其他命令的问题为零 + 没有其他明确的命令。但是,当我使用 .help 时,它不显示 clear 命令并且它不起作用。 哦,是的,我得到的错误是“忽略命令 None 中的异常: discord.ext.commands.errors.CommandNotFound:未找到命令“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()

0 个答案:

没有答案