async def _archive_message(self, bot: Somsiad, archive_channel: discord.TextChannel, message: discord.Message): pin_embed = bot.generate_embed(description=message.content, timestamp=message.created_at) pin_embed.set_author(name=message.author.display_name, url=message.jump_url, icon_url=message.author.avatar_url) pin_embed.set_footer(text=f'#{message.channel}') files: List[discord.File] = [] for attachment in message.attachments: filename = attachment.filename fp = io.BytesIO() await attachment.save(fp) file = discord.File(fp, filename) files.append(file) if len(files) == 1: if message.attachments[0].height is not None: pin_embed.set_image( url=f'attachment://{message.attachments[0].filename}') await archive_channel.send(embed=pin_embed, file=files[0]) elif len(files) > 1: await archive_channel.send(embed=pin_embed, files=files) else: url_from_content = cast(str, first_url(message.content)) if url_from_content is not None: pin_embed.set_image(url=url_from_content) await archive_channel.send(embed=pin_embed)
def setup(bot: Somsiad): bot.add_cog(Burn(bot))
def setup(bot: Somsiad): if configuration.get('twitter_bearer_token') is not None: bot.add_cog(Twitter(bot))
def setup(bot: Somsiad): bot.add_cog(Pins(bot))
def setup(bot: Somsiad): bot.add_cog(Moderation(bot))
def setup(bot: Somsiad): bot.add_cog(BotOwnerTools(bot))
def setup(bot: Somsiad): bot.add_cog(Spotify(bot))
if not previous_prefixes: embed = self.bot.generate_embed( 'ℹ️', 'Już ustawiony jest prefiks domyślny') embed.add_field( name='Wartość', value=f'domyślna `{configuration["command_prefix"]}`') else: embed = self.bot.generate_embed('✅', 'Przywrócono domyślny prefiks') embed.add_field( name='Nowa wartość', value=f'domyślna `{configuration["command_prefix"]}`') embed.add_field( name='Poprzednia wartość' if len(previous_prefixes) == 1 else 'Poprzednie wartości', value=' lub '.join( (f'`{prefix}`' for prefix in reversed(previous_prefixes))), inline=False, ) embed.add_field( name='Przykłady wywołań', value= f'`{configuration["command_prefix"]}wersja` lub `{configuration["command_prefix"]} oof` ' f'lub `{ctx.me} urodziny`', inline=False, ) await self.bot.send(ctx, embed=embed) somsiad = Somsiad()
def setup(bot: Somsiad): bot.add_cog(Paperclips(bot))