#component_callback("verify_select") is not responding

1 messages · Page 1 of 1 (latest)

fathom meadow
#
import interactions

from interactions import  listen, Extension, events, Guild, Embed, Button, ButtonStyle, StringSelectMenu, component_callback, ComponentContext
from interactions import StringSelectOption
from interactions.api.events import Component


from resources.firebase import firebaseLib
from resources.verify_methods.rover import RoVer
from resources.verify_methods.bloxlink import Bloxlink
from resources.role import PermissionCog


class VerifyButton(Extension):
    def __init__(self, client: interactions.Client):
        self.client = client

        self.selection = StringSelectMenu(
            StringSelectOption(
             label="Roblox OAuth",
             value= "Roblox OAuth", 
             description="Verify your Roblox Account with Roblox OAuth", 
            #  emoji=self.client.get_custom_emoji(1137546094486765598)
            ), 

            StringSelectOption(
             label="Bloxlink",
             value= "Bloxlink", 
             description="Verify your Roblox Account with Bloxlink", 
            #  emoji=self.client.get_custom_emoji(1137545583331115090)
            ),   
  
            custom_id="verify_select",
            placeholder="Choose Verification Method",
            min_values=1,
            max_values=1,
        )

    @listen()
    async def on_ready(self):
      # code was too long
        await channel.send(embeds=embed, components=self.selection)

    @component_callback("verify_select")
    async def my_callback(self, ctx: ComponentContext):
        await ctx.defer(ephemeral=True)
        
            

def setup(client):
    VerifyButton(client)
grim spindleBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

fathom meadow
#

latest version

#

latest version broke my code, worked on other versions

wooden bolt
#

i'll look at it

#

component callback could have broke

#

yep, definitely a bug

#

man this whole thing is messed up

fathom meadow
#

oh lovely

pastel shore
#

oh dear

wooden bolt
#

@regal briar the nightmare isnt over yet

#

i can only solve this fully by using nonlocal but i know you all would scream at me

#

there is a partial solution i could do without using it

#

and it would solve it for most cases

#

but component_callback has been broken for a while, it seems

fathom meadow
#

it broke this update

wooden bolt
#

nah, its been broken, just not in a way most people saw

fathom meadow
#

its been working for me

wooden bolt
#

the _unpack_helper stuff? doesnt actually do its job outside of the validator

#

the inner wrapper function never receives the list it makes

#

it receives the raw tuple instead

pastel shore
#

I see

wooden bolt
#

yeah im so sorry but im going to pr a patch that uses nonlocal

pastel shore
#

Yeah, go for it. Just leave a comment saying it's tech debt

#

We can fix it the right way later

wooden bolt
#

wait i may be able to hack this together

#

i'll experiment a little

#

omg the solution was really this simple

#

pring

pastel shore
#

❤️

wooden bolt
#

i hate how simple #1523 is and you will too

grim spindleBOT
# wooden bolt i hate how simple #1523 is and you will too

• Pull Request Type: Bugfix
• Created: <t:1691518322:R>

Description

component_callback and modal_callback was always using the function name after the last patch due to some weirdness. This PR fixes that by simplifying the patch and... fixing parts of the patch itself, funny enough.

Frankly, I'm disappointed in myself how easy this fix was 😅.

Changes
  • Pass in custom_id to the unpack helper/validator, not the empty resolved_custom_id.
  • Removed the unused (other than for the mistake above) resolved_custom_id initial declaration - I think we all forgot that resolved_custom_id does not get passed into there without a nonlocal. No idea how custom_id does in this specific case, but it does.
    • Yes, this patch makes the code very similar to the code before the first patch. However, since the variable name inside the wrapper function is different from just custom_id, everything works now (for some reason).
Related Issues

N/A

Test Scenarios

[CODEBLOCK]

Python Compatibility
  • ❌ I've ensured my code works on Python 3.10.x
  • ✅ I've ensured my code works on Python 3.11.x
Checklist
  • ✅ I've run the pre-commit code linter over all edited files
  • ✅ I've tested my changes on supported Python versions
  • ❌ I've added tests for my code, if applicable
  • ❌ I've updated / added documentation, where applicable
wooden bolt
#

the only thing we did wrong initially was the name lmao

#

are you telling me python actually cares about redefinitions but not usages for scopes

#

...fuck it, python moment

chrome prism
#

damn im pretty sure i caused this because of my feature request lmao

#

well good its fixed now

pastel shore
#

It's pretty common.

var = 1
var2 = 2
def scope():
  print(var) # undefined
  print(var2) # 2
  var = "this name is now a function local"
wooden bolt
#

its common and it makes sense now

#

i just hate having to discover it

pastel shore
#

yup

wooden bolt
chrome prism
pastel shore
#

So, am I merging and dropping 5.9.2?

wooden bolt
#

i would do it

pastel shore
#

@stoic rivet is gonna reinstall discord again 😛

fathom meadow
#

merge when

#

i would do it but no perms

wooden bolt
#

one more review is needed

fathom meadow
#

im a reviewer now!!

regal briar
#

mans gonna reinstall the moment he sees a new 5.9.1 release anyhow

#

either semver angarery or release angery

pastel shore
#

Nah, he was expecting 5.9.1

fathom meadow
#

pls

fathom meadow
#

it wont let me update

#

it says 5.9.1 is the latest

wooden bolt
#

discord-py-interactions is showing correct stuff

fathom meadow
#

fixed

fathom meadow
regal briar
#

spin a new post for that