示例#1
0
    async def about(self, ctx: Context):
        embed = Embed(
            title='About BashBot',
            description=
            'BashBot is a Discord bot that allows terminal access via chat.',
            color=EMBED_COLOR)
        embed.add_field(name='Github', value=REPOSITORY_URL, inline=False)
        embed.add_field(name='Author', value=REPOSITORY_AUTHOR, inline=False)
        embed.add_field(name='Current version',
                        value=updater().get_local_commit(),
                        inline=False)
        embed.set_thumbnail(url=THUMBNAIL_URL)

        if settings().get('other.check_for_updates'):
            update_details = updater().check_for_updates()
            if update_details:
                embed.add_field(
                    name='New update available',
                    value=
                    f'"{update_details["message"]}"\n{update_details["sha"]}',
                    inline=False)
            else:
                embed.add_field(name='No updates available',
                                value='BashBot is up to date',
                                inline=False)

        await ctx.send(embed=embed)
示例#2
0
    def __check_for_updates(self):
        if settings().get('other.check_for_updates'):
            self.logger.info(f'Checking for updates...')

            update_details = updater().check_for_updates(rate_limit=False)
            if update_details:
                self.logger.info(f'New update available. Try running `git pull`. '
                                 f'Commit "{update_details["message"]}" '
                                 f'({update_details["sha"]})')
            else:
                self.logger.info(f'BashBot is up to date')