async def counter(self, button: discord.ui.Button, interaction: discord.Interaction): number = int(button.label) button.label = str(number + 1) if number + 1 >= 5: button.style = discord.ButtonStyle.green await interaction.message.edit(view=self)
async def skip_track( self, button: discord.ui.Button, interaction: discord.Interaction ): await self.voice_state.skip() button.disabled = True button.style = discord.ButtonStyle.grey button.emoji = "✅" await interaction.response.edit_message(view=self)
async def count(self, interaction: discord.Interaction, button: discord.ui.Button): number = int(button.label) if button.label else 0 if number + 1 >= 5: button.style = discord.ButtonStyle.green button.disabled = True button.label = str(number + 1) # Make sure to update the message with our updated selves await interaction.response.edit_message(view=self)
async def confirm(self, button: discord.ui.Button, interaction: discord.Interaction): await interaction.response.send_message( 'https://i.giphy.com/media/Ju7l5y9osyymQ/giphy.webp', ephemeral=True) self.em.description = "Hmm, it seems someone \nalready claimed this gift." button.style = discord.ButtonStyle.grey button.disabled = True button.label = "РађРађРађРађРађРађРађРађРађРађРађClaimedРађРађРађРађРађРађРађРађРађРађРађРађ" await interaction.message.edit(embed=self.em, view=self)
async def pause(self, button: discord.ui.Button, interaction: discord.Interaction): if button.emoji == discord.PartialEmoji(name='\U000023f8\U0000fe0f'): button.emoji = '\U000025b6\U0000fe0f' button.style = discord.ButtonStyle.green cmd = self.bot.get_command('pause') else: button.emoji = '\U000023f8\U0000fe0f' button.style = discord.ButtonStyle.grey cmd = self.bot.get_command('resume') new_ctx = await copy_context(self.ctx, author=interaction.user) await cmd(new_ctx) await interaction.response.edit_message(view=self)
async def ping_admin( self, button: discord.ui.Button, interaction: discord.Interaction ): for admin in self.users_to_ping: try: channel = await (await self.bot.fetch_user(admin)).create_dm() await channel.send( f"**{str(interaction.user)}** would like you to update the lyrics for **{self.title}**." ) except TypeError: self.bot.log.error(f"{admin} is not a valid user id.") button.label = "Lyric fix requested" button.style = discord.ButtonStyle.grey button.disabled = True await interaction.response.edit_message(view=self)
async def loop(self, button: discord.ui.Button, interaction: discord.Interaction): cmd = self.bot.get_command('loop') new_ctx = await copy_context(self.ctx, author=interaction.user) await cmd(new_ctx) button.style = discord.ButtonStyle.green if self.player.looping else discord.ButtonStyle.grey await interaction.response.edit_message(view=self)