python 3.x – discord not registering commands anymore

I have read all the help files online.. i’ve done TONS of research and still nothing helps me.. i HAD a command that ran whats inside “on_raw_reaction_add”, basically same code. I edited the command to be “better” and had some more functionallity and now the entire bot won’t take ANY command. heres my code for the bot

from discord.ext.commands import Bot
import discord
from discord.ext import tasks
intents = discord.Intents().all()
intents.reactions = True
intents.members = True
import os.path
import requests
import asyncio
import random
from import vision


bot = Bot(command_prefix="p-", intents=intents)
token = 'TOKEN'

async def on_raw_reaction_add(payload):
    channel = bot.get_channel(payload.channel_id)
    if isinstance(channel, discord.DMChannel):
    message = await channel.fetch_message(payload.message_id)
    guild = bot.get_guild(payload.guild_id)
    user = guild.get_member(payload.user_id)
    emoji =
    reaction = discord.utils.get(message.reactions, emoji=emoji)
    member = payload.member
    if emoji == '🔍':
        msg = await channel.fetch_message(payload.message_id)
        if msg.attachments:
            uri = msg.attachments[0].url
            embed=discord.Embed(title="Warning: Error Detected!")
            embed.add_field(name="Error", value="Index out of Range", inline=False)
            embed.add_field(name="What does this mean?", value="Sometimes the way the bot is programmed just simply doesn't get the URL from the reaction :mag: to get around this manually scan the URL with `-search [url]` in a DM with the bot!", inline=False)
            embed.set_footer(text="Sent by ReversernCome order bots from killaxia:")
            await member.send(embed=embed)

        fmatches = []
        lfull = 0
        lpar = 0
        images = []
        visually = []
        lvisual = 0
        web = []
        result = []
        partials = []
        client = vision.ImageAnnotatorClient()
        image = vision.Image()
        image.source.image_uri = uri

        response = client.web_detection(image=image)
        annotations = response.web_detection
        if annotations.best_guess_labels:
            for label in annotations.best_guess_labels:
                print('nBest guess label: {}'.format(label.label))
            thelabel = label.label

        for url in annotations.full_matching_images:
        lfull = len(fmatches)

        for url in annotations.partial_matching_images:
        lfull = len(partials)

        for url in annotations.visually_similar_images:
        lvisual = len(visually)

        if annotations.web_entities:
            web = len(annotations.web_entities)

            for entity in annotations.web_entities:
                result.append(f"{entity.score} - {entity.description}<br>")

        foldername = random.randint(1, 50000000)
        endname = random.randint(5000,5000000)
        directory = f"{foldername}_{endname}"
        parent_dir = "/var/www/html/searches"
        path = os.path.join(parent_dir, directory)
        print("Directory '% s' created" % directory)
        f = open(f"/var/www/html/searches/{foldername}_{endname}/all_info.txt", 'w+')
        all_info = f"{foldername}_{endname}/all_info.txt"
        f = open(f"/var/www/html/searches/{foldername}_{endname}/partial_links.txt", 'w+')
        f.write("Partial Matching URLs:nn")
        partial_info = f"{foldername}_{endname}/partial_links.txt"
        f = open(f"/var/www/html/searches/{foldername}_{endname}/full_links.txt", 'w+')
        f.write("Full Matching URLs:nn")
        full_info = f"{foldername}_{endname}/full_links.txt"
        f = open(f"/var/www/html/searches/{foldername}_{endname}/similar_links.txt", 'w+')
        f.write("Visually Similar Images:nn")
        visual_info = f"{foldername}_{endname}/similar_links.txt"

        if len(str(lfull)) < 0:
            lfull = 0
        if len(str(lpar)) < 0:
            lpar = 0
        if len(str(lvisual)) < 0:
            lvisual = 0
        score = int(lfull) + int(lpar) + int(lvisual)
        if score >= 12:
            catfish = True
            catfish = False

        embed=discord.Embed(title="Reverse Image Search Results", description="Did you spot a catfish?")
        embed.add_field(name="Full Matches", value=f"{lfull}", inline=False)
        embed.add_field(name="Partial Matches", value=f"{lpar}", inline=False)
        embed.add_field(name="Visually Similar Matches", value=f"{lvisual}", inline=False)
        embed.add_field(name="Score and thoughts", value=f"Score: {score}nCatfish status: {catfish}n", inline=False)
        embed.add_field(name="Additional Information", value=f"Entire history of image:n{all_info}nnFull Matching Links on this images:n{full_info}nnPartial Mathing Links on this image:n{partial_info}nnVisually Similar Matching Links on this image:n{visual_info}n", inline=False)
        embed.add_field(name="Web Entities", value=f"{web}", inline=False)
        embed.add_field(name="Web Score/Description", value=f"{result}", inline=False)
        embed.add_field(name="Best Guess", value=f"{thelabel}", inline=False)
        embed.add_field(name="Add the bot", value=f"", inline=False)
        embed.set_footer(text=f"Wanna support the developer and keep this project online?nCashapp: $allusivegold - Paypal:")
        await member.send(embed=embed)

for filename in os.listdir('/var/bots/rev/rev-cogs'):
    if filename.endswith('.py'):
        print(f"{filename} loaded!")

async def on_ready():
    print('Member count updated')
    print("Bot in server: {}".format("Success"))
    print("Bot name: {}".format(
    ip = requests.get('').text
    members = 0
    for guild in bot.guilds:
        members += guild.member_count - 1
    await bot.change_presence(activity=discord.Activity(
        type=discord.ActivityType.watching, name=f'.help with {members} members'))


#run token

This part works just fine! It says the cog is loaded, too.. heres the cog..

from discord.ext.commands import Bot
import discord
from discord.ext import tasks
intents = discord.Intents().all()
intents.reactions = True
intents.members = True
from datetime import date
from import vision


class Imager(commands.Cog):
    def __init__(self, bot): = bot

    async def test(self, ctx):

def setup(bot):

This code worked JUST FINE before something happened.. now all i get, for evertything is this: Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command “test” is not found

Even if i replace all the file names, command names, clear ubuntu cache, restart server, reload server to an earlier date (snapshot).. remove commands, etc etc.. this is just broken. I have tried literally everything..please..please help me 🙁

Leave a Comment