コード例 #1
0
ファイル: commands.py プロジェクト: projectopengroup/Pogbot
    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)
コード例 #2
0
ファイル: ephemeral.py プロジェクト: z03h/discord.py
    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)
コード例 #3
0
    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)
コード例 #4
0
ファイル: music.py プロジェクト: potatoeggy/napbot
 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)