#AttributeError: type object 'Interaction' has no attribute 'respond'. Did you mean: 'response'?

1 messages · Page 1 of 1 (latest)

young cove
#

Hello,
i have an discord bot with the following error:

Traceback (most recent call last):
  File "/home/container/wp_bot_main.py", line 2, in <module>
    from discord.commands import Option
  File "/home/container/.local/lib/python3.13/site-packages/discord/commands/__init__.py", line 26, in <module>
    from .context import *
  File "/home/container/.local/lib/python3.13/site-packages/discord/commands/context.py", line 69, in <module>
    class ApplicationContext(discord.abc.Messageable):
    ...<276 lines>...
            return self.command.cog
  File "/home/container/.local/lib/python3.13/site-packages/discord/commands/context.py", line 271, in ApplicationContext
    @discord.utils.copy_doc(Interaction.respond)
                            ^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Interaction' has no attribute 'respond'. Did you mean: 'response'?
#

Code:

import discord, random, time
from discord.commands import Option
import os, json
from dotenv import load_dotenv
from cogs.extras import logs
import wpDB
from datetime import datetime
from pycord.multicog import Bot
random.seed()

intents = discord.Intents.default()
intents.members = True
intents.message_content = True #kann auf Nachrichten Kontent zugreifen


status = discord.Status.dnd
activity = discord.Activity(type = discord.ActivityType.playing, name = "den Weltuntergangs Editor.")


bot = Bot(
    intents = intents,
    status = status,
    activity = activity,
    debug_guilds = [1049000414827266159, 1109866171022462986]
)


prefix = "[Bot]"

def load_cogs():
    cogs = [
        "cogs.cms.country",
        #"cogs.cms.sperren",
        #"cogs.cms.freigeben",

        "cogs.pms.logout_system",
        "cogs.pms.login_system",

        "cogs.extras.data_system",
        "cogs.extras.error",
        "cogs.extras.logs",
        "cogs.extras.messageLogger",
        "cogs.extras.admin",
        #"cogs.extras.auto_update",

        "cogs.is.liste",
        "cogs.is.help",
        
        "cogs.rps.roll",
        "cogs.rps.travelsystem",
        "cogs.rps.country_system",
        "cogs.rps.eventsystem",
        "cogs.rps.comsystem",
        "cogs.rps.spysystem",
        "cogs.rps.parliament",
        "cogs.rps.research"
        "cogs.rps.tourism",
        "cogs.rps.infrastructure"

    ]
    
    if not wartungsarbeiten:
            for cog in cogs:
                try:
                    bot.load_extension(cog)
                    print(f"{prefix} Modul: {cog} wurde geladen.")
                except Exception as e:
                    print(f"{prefix} Modul: {cog} konnte nicht geladen werden. Fehler: {e}")
    else:
        for cog in cogs:
            if cog == "cogs.extras.error":
                pass
            else:
                bot.load_extension(cog)

#
wartungsarbeiten = True
@bot.event
async def on_ready(): #gibt was aus,w enn ready
    print(f"{prefix} {bot.user} Bot ist online")

    guild = bot.guilds[1]  # Annahme: der Bot ist in mindestens einem Server
    bot_member = guild.get_member(bot.user.id)
    try:
        db = wpDB.get_connection()
        cursor = db.cursor()
        print(f"{prefix} Datenbank verbindung erfolgreich.")
    except:
        print(f"{prefix} Datenbankverbindung fehlgeschlagen.")

    dt = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    cmd_values = f"[Der Bot wurde neugestartet.]"
    logs.addentry(dt, str(bot.user), "Neustart", cmd_values)

load_cogs()


load_dotenv()
bot.run(os.getenv("TOKEN"))
inner vesselBOT
# young cove ``` wartungsarbeiten = True @bot.event async def on_ready(): #gibt was aus,w enn...

1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y

2a. Install py-cord
python -m pip install py-cord

2b. Update py-cord
python pip install -U py-cord

Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.

Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

waxen chasmBOT
latent siren
#

why is there so much stuff that is declared but unused

young cove
#

Edit: I use the python egg for the pterodactyl panel

latent siren
#

just install py-cord, and before that, uninstall discord or discord.py if installed

young cove
latent siren
#

install audioop-lts

young cove
#

Now its working

#

thank you very much