Closed joshuangdev closed 7 months ago
Cannot edit a message using the function .edit
"Dropping existing records..\nApplying new records..." basically returns this: Ignoring exception in command <nextcord.application_command.SlashApplicationSubcommand object at 0x0000022FF5DE32F0>: Traceback (most recent call last): File "C:\Users\ng_jo\AppData\Local\Programs\Python\Python312\Lib\site-packages\nextcord\application_command.py", line 918, in invoke_callback_with_hooks await self(interaction, *args, **kwargs) File "C:\Users\ng_jo\OneDrive\Backup\Desktop\joshuang\coding.GITHUBCLONE\Testing-Bot\cogs\tickets__init__.py", line 319, in register_config await msg.edit( File "C:\Users\ng_jo\AppData\Local\Programs\Python\Python312\Lib\site-packages\nextcord\interactions.py", line 1180, in edit message = await self._state._interaction.edit_original_message( ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'ConnectionState' object has no attribute '_interaction'
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'ConnectionState' object has no attribute '_interaction'
@setup.subcommand(name="register") # @application_checks.is_owner() async def register_config( self, interaction, guild_id=str, category_id=str, staff_id=str, transcript_id=str, ): guild = self.bot.get_guild(int(guild_id)) if self.bot.get_guild(int(guild_id)): if guild.get_channel(int(transcript_id)): if nextcord.utils.get(guild.categories, id=int(category_id)): if not fetch( "storage/tickets.sqlite", "TicketConfig", f"guild_id={guild_id}", ): insert( "storage/tickets.sqlite", "TicketConfig", ("guild_id", "category_id", "staff_id", "transcript_id"), (guild_id, category_id, staff_id, transcript_id), ) else: view = ConfirmView() data = fetch("storage/tickets.sqlite", "TicketConfig") for i in range(len(data)): if data[i][0] == int(guild_id): data = data[i] break msg = await interaction.response.send_message( f"Guild already registered, overwrite?\n### CONFIGURATION FOR THIS GUILD\n- Guild ID: {interaction.guild.name} ({data[0]})\n- Category ID: <#{data[1]}> ({data[1]})\n- Staff ID: <@&{data[2]}> ({data[2]}\n- Transcript Channel: <#{data[3]}> ({data[3]})", view=view, ) await view.wait() if view is None: await msg.edit("Action cancelled.") elif view.value: msg = await msg.edit( content="Overwriting the existing record...", view=None ) drop( "storage/tickets.sqlite", "TicketConfig", f"guild_id={guild_id}", ) await msg.edit( "Dropped existing records..\nApplying new records..." ) insert( "storage/tickets.sqlite", "TicketConfig", ( "guild_id", "category_id", "staff_id", "transcript_id", ), (guild_id, category_id, staff_id, transcript_id), ) # await msg.edit( # f"Registered guild.\n{fetch('storage/tickets.sqlite', 'TicketConfig', f'WHERE guild_id={guild_id}')}" # ) else: await interaction.response.send_message( "Invalid `category_id`. Perhaps the bot doesn't have the permission to view it?" ) else: await interaction.response.send_message( "Invalid `transcript_id`. Maybe the bot doesn't have access to all the channels?" ) else: await interaction.response.send_message( "Invalid `guild_id`, maybe the bot is not in the guild?" )
Except it to actually edit it like it should?
Threw me an error idk what it means
nextcord.Intents.all()
nextcord-ext-menus 1.5.7
support thread here: https://ptb.discord.com/channels/881118111967883295/1212126972784807987
Summary
Cannot edit a message using the function .edit
Reproduction Steps
"Dropping existing records..\nApplying new records..." basically returns this: Ignoring exception in command <nextcord.application_command.SlashApplicationSubcommand object at 0x0000022FF5DE32F0>: Traceback (most recent call last): File "C:\Users\ng_jo\AppData\Local\Programs\Python\Python312\Lib\site-packages\nextcord\application_command.py", line 918, in invoke_callback_with_hooks await self(interaction, *args, **kwargs) File "C:\Users\ng_jo\OneDrive\Backup\Desktop\joshuang\coding.GITHUBCLONE\Testing-Bot\cogs\tickets__init__.py", line 319, in register_config await msg.edit( File "C:\Users\ng_jo\AppData\Local\Programs\Python\Python312\Lib\site-packages\nextcord\interactions.py", line 1180, in edit message = await self._state._interaction.edit_original_message( ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'ConnectionState' object has no attribute '_interaction'
The above exception was the direct cause of the following exception:
nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'ConnectionState' object has no attribute '_interaction'
Minimal Reproducible Code
Expected Results
Except it to actually edit it like it should?
Actual Results
Threw me an error idk what it means
Intents
nextcord.Intents.all()
System Information
nextcord-ext-menus 1.5.7
Checklist
Additional Context
support thread here: https://ptb.discord.com/channels/881118111967883295/1212126972784807987