rfalias / project_zomboid_bot

Discord bot for managing your PZ server.
18 stars 7 forks source link

discord.ext.commands.errors.CommandNotFound: Command "pzplayers" is not found #34

Open PaddiSson opened 2 years ago

PaddiSson commented 2 years ago

Hello. I get an error when I type any command in the channel where the bot is connected. Only the "!help" command works and it doesn't show the names of the other commands. It seems that it can't take into account the commands contained in the "Cogs collection".

Error output:

ERROR    discord.ext.commands.bot Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "pzplayers" is not found

So I tried to copy a command outside of the "Cogs collection" and it works correctly. Like :

@bot.command(pass_context=True)
async def pzplayers(ctx):
        """Show current active players on the server"""
        await IsChannelAllowed(ctx)
        c_run = ""
        c_run = await rcon_command(ctx, ["players"])
        print(c_run)
        if not c_run:
            return
        c_run = "\n".join(c_run.split('\n')[1:-1])
        results = f"Current players in game:\n{c_run}"
        await ctx.send(results)

After several hours of testing and searching I still can't figure out what's wrong with the code. If someone has an idea?

Discord output: pz-bug

Shell output: pz-bug-2

Topdog1221 commented 1 year ago

Sorry if this is late, I am having the same problem, the only command I got to work was !help, this bot is completely broken.