#Error in disabling button

1 messages · Page 1 of 1 (latest)

bleak jackal
#
    def __init__(self, user_p: dict, user_c: dict):
        super().__init__(label='Join the game.', style=discord.ButtonStyle.blurple)
        self.message = None
        self.user_p = user_p
        self.user_c = user_c 

    async def join(self, interaction: discord.Interaction, button: discord.ui.Button): 
      if interaction.user.id in self.user_c.keys():
          await interaction.response.send_message("You already joined the game!", ephemeral=True)
      await interaction.response.send_message(f"<@{interaction.user.id}> you have successfully joined the game!", ephemeral=True)
      self.user_p[interaction.user.id] = 0
      self.user_c[interaction.user.id] = 0

class Quit(Button):
    def __init__(self, user_p: dict, user_c: dict, host: int, game_going: dict):
        super().__init__(label="Cancel", style=discord.ButtonStyle.danger)
        self.message = None
        self.user_p = user_p
        self.user_c = user_c 
        self.host = host
        self.game_going = game_going

    async def callback(self, interaction: discord.Interaction):
        if self.host == interaction.user.id:
            can_emb = discord.Embed(title="Game cancelled!", description="The host thought to cancel the game. Successfully cancelled the game.", color=discord.Color.red())
            can_emb.timestamp = datetime.now(timezone.utc)
            await interaction.response.send_message(embed=can_emb)
            self.host = 0
            self.game_going["cancel"] = True

            for item in self.view.children:
               item.disabled = True
               await self.message.edit(view=self)
        
        ``` This gives an error:  'Quit' object has no attribute 'to_components'. Did you mean: 'from_component'? Does anyone know how to fix it
#

pycord is is 2.5 btw

vague shuttle
#

.rtfm disable all item

idle scrollBOT
bleak jackal
vague shuttle
#

so just self.disabled = True should be good

bleak jackal
#

Alr

bleak jackal
vague shuttle
#

Because the issue

#

Come that ur trying to edit the view

#

By a button

bleak jackal
#

o

vague shuttle
#

View is not a button

bleak jackal
#

yes

bleak jackal
vague shuttle
bleak jackal
#

I think I tried that

#

But let's do