async def info(self, ctx, backup_id): """ Get information about a backup backup_id:: The id of the backup or the guild id to for latest automated backup """ backup_id = str( ctx.guild.id) if backup_id.lower() == "interval" else backup_id backup = await self._get_backup(backup_id) if backup is None or backup.get("creator") != ctx.author.id: raise cmd.CommandError( f"You have **no backup** with the id `{backup_id}`.") handler = BackupInfo(self.bot, backup["backup"]) embed = ctx.em("")["embed"] embed.title = handler.name embed.set_thumbnail(url=handler.icon_url) embed.add_field(name="Creator", value=f"<@{backup['creator']}>") embed.add_field(name="Members", value=handler.member_count, inline=True) embed.add_field(name="Created At", value=helpers.datetime_to_string(backup["timestamp"]), inline=False) embed.add_field(name="Channels", value=handler.channels(), inline=True) embed.add_field(name="Roles", value=handler.roles(), inline=True) await ctx.send(embed=embed)
def _template_info(self, template): handler = BackupInfo(self.bot, template["template"]) embed = Embed(color=0x36393e) embed.title = template["_id"] embed.description = template["description"] embed.add_field(name="Creator", value=f"<@{template['creator']}>") embed.add_field(name="Channels", value=handler.channels(), inline=True) embed.add_field(name="Roles", value=handler.roles(), inline=True) return embed