예제 #1
0
파일: pins.py 프로젝트: Twixes/somsiad
 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)
예제 #2
0
def setup(bot: Somsiad):
    bot.add_cog(Burn(bot))
예제 #3
0
def setup(bot: Somsiad):
    if configuration.get('twitter_bearer_token') is not None:
        bot.add_cog(Twitter(bot))
예제 #4
0
파일: pins.py 프로젝트: Twixes/somsiad
def setup(bot: Somsiad):
    bot.add_cog(Pins(bot))
예제 #5
0
def setup(bot: Somsiad):
    bot.add_cog(Moderation(bot))
예제 #6
0
def setup(bot: Somsiad):
    bot.add_cog(BotOwnerTools(bot))
예제 #7
0
파일: spotify.py 프로젝트: Twixes/somsiad
def setup(bot: Somsiad):
    bot.add_cog(Spotify(bot))
예제 #8
0
        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()
예제 #9
0
def setup(bot: Somsiad):
    bot.add_cog(Paperclips(bot))