We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ThumbnailToImageOnly
The button was fixed, because there was an error in the check, as well as added timeout and disabling the button by time, so as not to burden the bot.
PS. pull requests I was too lazy to do, so I posted here.
class ThumbnailToImageOnly(discord.ui.View): def __init__(self, interaction: discord.Interaction): super().__init__(timeout=60, disable_on_timeout=True) self.interaction = interaction self.cooldown = commands.CooldownMapping.from_cooldown(2, 6, commands.BucketType.member) async def on_timeout(self) -> None: try: for item in self.children: item.disabled = True await self.interaction.edit_original_response(view=self) except discord.errors.NotFound: pass async def interaction_check(self, interaction: discord.Interaction) -> bool: bucket = self.cooldown.get_bucket(interaction.message) retry = bucket.update_rate_limit() if retry: await interaction.response.send_message( f'Slow down! Try again in {round(retry, 1)} a second.', ephemeral=True, delete_after=10) return False if interaction.message.interaction is not None: if interaction.user.id != interaction.message.interaction.user.id: await interaction.response.send_message('These buttons aren't for you!', ephemeral=True, delete_after=10) return False return True @discord.ui.button(style=discord.ButtonStyle.green, emoji=discord.PartialEmoji.from_str(emoji.expand), custom_id="expand_store") async def image(self, button: discord.ui.Button, interaction: discord.Interaction): new_embeds = [] for embed in interaction.message.embeds: if embed.image and (type(embed.image.url) == str and "nm" in embed.image.url.lower()): new_embeds.append(embed) continue if embed.thumbnail and type(embed.thumbnail.url) == str and "nm" in embed.thumbnail.url.lower(): new_embeds.append(embed) continue if 'expand' in button.emoji.name: new_emoji = discord.PartialEmoji.from_str(emoji.shrink) if embed.thumbnail: embed.set_image(url=embed.thumbnail.url) embed.remove_thumbnail() elif 'shrink' in button.emoji.name: new_emoji = discord.PartialEmoji.from_str(emoji.expand) if embed.image: embed.set_thumbnail(url=embed.image.url) embed.set_image(url=png.line) new_embeds.append(embed) button.emoji = new_emoji await interaction.response.edit_message(embeds=new_embeds, view=self) ```
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The button was fixed, because there was an error in the check, as well as added timeout and disabling the button by time, so as not to burden the bot.
PS. pull requests I was too lazy to do, so I posted here.
The text was updated successfully, but these errors were encountered: