#App cmds resync

1 messages · Page 1 of 1 (latest)

wintry patio
#

I'm not entirely sure if this is a bug or if i did something wrong, but when I reload my commands using the reload command, the context and integration types would get ignored. (github version)

#
self.bot.reload_extension(cog)
await self.bot.sync_all_application_commands()```
#

im guessing await self.bot.sync_all_application_commands() could be the cause?

hasty garnet
#

maybe you have to await self.bot.reload_extension(cog) ??

#

idk surely because i've only used that one time

#

but maybe you could try it

late heron
#

reload is not async

hasty garnet
#

oh alr

hasty garnet
#

it works for me

hasty garnet
#

????

wintry patio
#

Wait

#

Wrong one

#

Okay I can't get the line url but it's in there

#

The guild IDs are automatic

wintry patio
#

guild_id exist but that's for syncing specific guilds

hasty garnet
#

Bruh what?

#

Stack overflow and my own bot working...

wintry patio
hasty garnet
#

Yes they do

wintry patio
#

Show me

hasty garnet
#

But it's not for an error

#

Wait give me a sec

wintry patio
#

I didn't encounter any errors

#

It syncs fine

#

But integration types and contexts are ignored

hasty garnet
#

First answer

wintry patio
#

Their situation is different

hasty garnet
#

Well yeah

wintry patio
#

Their issue does not have anything to do with mine

hasty garnet
#

Well the problem is the guild_ids or the actual thing?

wintry patio
#

Like I said, it syncs fine

#

No

wintry patio
#

Just the integration types and contexts

hasty garnet
#

Well maybe there's something in the integrations? Not sure what they are due to language barrier

wintry patio
#

For example, you can hide them from DMs

#

These commands aren't supposed to show in dms (which is what I mean by integration types and contexts)

hasty garnet
#

Ye they dont

wintry patio
#

Not loading

#

Obviously when I load them for the first time, the integration types and contexts are there

hasty garnet
#

Oh bruh so when you reload, dm commands are set to true?

wintry patio
#

Dms was an example

#

Not all of the commands should show up for user app cmds

hasty garnet
#

Weird

topaz dirge
#

is this what you talking about?

wintry patio
#

Idk why it's showing a black screen

topaz dirge
#

wait 1 min

wintry patio
#

Unless the missing permissions mean that the slash cmd isn't meant to be listed due to cache

topaz dirge
#

exactly

#

dm_permission is basically "is it viewable and usable in dms"

#

and when i reload discord, after changing it to false, command disappears

wintry patio
#

The thing is, I didn't change the slash cmds at all when I relaoded

topaz dirge
#

i dont quite understand what you trynna do

wintry patio
#

When I startup the bot, the commands syncs fine but reloading it ignores the contexts and integration types of each command which results in showing every command

#

I'm using the GitHub version

#

And slash cmds have the contexts and integration_types parameter

wintry patio
#

Yea give me a sec

topaz dirge
topaz dirge
#

=docs integration_types

rough fableBOT
#

Could not find anything. Sorry.

wintry patio
#

It's not on stable

#

You need to switch to latest

topaz dirge
topaz dirge
wintry patio
#

Alr

#
@slash_command(name="hello", integration_types=[nextcord.IntegrationType.guild_install], contexts=[nextcord.InteractionContextType.guild]) # This should show in guilds only and not in dms or guilds that the bot isn't in
async def hello(self, interaction):
    pass```
topaz dirge
wintry patio
#

Integration_types and contexts

topaz dirge
#

ai lemme try that

topaz dirge
wintry patio
#

Not sure honestly but

#

I believe it has to do with the sync_application_commands

topaz dirge
wintry patio
#

Cause in v3, u still can't sync app cmds with the reload extension function, so you'd have to do the syncing urself

topaz dirge
wintry patio
#

Both

topaz dirge
#

because if i reload cog, integration_types and context is not ignored, and everything works fine

#

and command is not showing up in dms

wintry patio
#

Huh

#

Wait are you using the sync_app_cmds function

topaz dirge
wintry patio
#

Since when does reload extension syncs the cmds now

topaz dirge
#

if i make any change to command and reload the cog, it will sync

#

i can demo my screen if you want

wintry patio
#

Alento told me that reload_extension in the GitHub version doesn't sync the commands

wintry patio
#

I'll check it out once I'm on pc

topaz dirge
wintry patio
#

I did not expect reload_extension to actually reload app cmds

wintry patio
topaz dirge
wintry patio
#

I'm on mobile but sure

topaz dirge
#

can you see the vscode?

wintry patio
#

Yep

#

Wait

#

I only see ur discord rn

#

Now I see it

#

Wait what happens if u put the sync_app_cmds below ur reload extension function

#

Ik it's not needed

#

But

#

I wanna see what happens from ur side

topaz dirge
#

sync_all_application_commands

#

?

wintry patio
#

Yea

topaz dirge
#

you have to use both

#

wait lemme find it

topaz dirge
wintry patio
#

Usually I do reload_extension instead of unloading and then loading

topaz dirge
#

yeah the .reload_extension doesnt work

topaz dirge
wintry patio
#

That's weird

#

Might be a bug then

topaz dirge
#

unloading and then loading syncs command

#

but not .reload

#

wth

wintry patio
#

Yea I'm confused why it doesn't do that

topaz dirge
#

but it should work tho

#

prolly a bug

wintry patio
#

Funny thing is, v2 has the same issue too

topaz dirge
#

.reload works in v2

#

.unload_extension

self._remove_module_references(lib.__name__)
self._call_module_finalizers(lib, name)

.load_extension

self._load_from_module_spec(spec, name, extras=extras)

.reload_extension

self._remove_module_references(lib.__name__)
self._call_module_finalizers(lib, name)
self.load_extension(name, extras=extras)
topaz dirge
#

i think they forgot to change something from v2

#

self.load_extension(name, extras=extras)

#

oh

#

no

#

im wrong, everything is good in the code

wintry patio
#

Hm

topaz dirge
#

it just fixed itself

#

what the fuck

wintry patio
#

Lmao wtf

#

I think sync_app_cmds was changed

#

In v3

topaz dirge
#

yeah it works now

#

idk why

#

and syncs

wintry patio
#

I see

#

Alr ty

topaz dirge
#

i guess it will work if you are lucky enough

wintry patio
#

Lmao

topaz dirge