示例#1
0
    async def send_group_help(self, group: CustomCommand):
        embed = StyledEmbed(title='`' + group.qualified_name + '`')
        desc = ""
        if group.help:
            desc += group.help

        if group.usage:
            embed.add_field(name="**Usage**", value=f"`{prefix + group.usage}`", inline=False)

        if group.aliases and len(group.aliases) > 0:
            embed.add_field(name="**Aliases**", value=' '.join([f"`{prefix + alias}`" for alias in group.aliases]), inline=False)


        if hasattr(group, "available_args") and group.available_args:
            arg_builder = ""
            for typ in group.available_args:
                arg_builder += f"\n**{typ['type']}**"
                for arg in typ['args']:
                    arg_builder += f"\n`{arg['name']}`\n***{arg['desc']}***"
            embed.add_field(name="**Arguments**", value=arg_builder)

        if hasattr(group, "examples") and group.examples:
            example_builder = ""
            for ex in group.examples:
                example_builder += f"\n`{ex['ex']}`\n{ex['desc']}"
            embed.add_field(name="**Examples**", value=example_builder)

        embed.description = desc

        await self.get_destination().send(embed=embed)
示例#2
0
文件: util.py 项目: realmayus/chime
def get_currently_playing_embed(current_track: Track, current_time=None):
    currently_playing_embed = StyledEmbed(
        title="<:music_note:718120922367787099>  " + current_track.title)
    currently_playing_embed.set_author(name="Now playing",
                                       url=current_track.uri)

    if current_time:
        currently_playing_embed.description = get_song_progress_bar(
            current_time, current_track.duration)

    currently_playing_embed.add_field(name="Duration",
                                      value=get_friendly_time_delta(
                                          current_track.duration))
    currently_playing_embed.add_field(name="Artist",
                                      value=current_track.author)
    if current_track.thumb is not None:
        currently_playing_embed.set_thumbnail(url=current_track.thumb)
    return currently_playing_embed
示例#3
0
    async def send_bot_help(self, mapping):
        embed = StyledEmbed(title='chime help')
        embed.set_thumbnail(url="https://raw.githubusercontent.com/realmayus/chime/master/assets/chime_banner.png?token=AJC6B5VTHEZ5UHNY7QNDCU263LCCK")
        embed.description = "chime is a versatile, yet intuitive music bot for discord. It aims to be as user-friendly as possible while still boasting many features. \n\n" \
                            "**More info and invite link [here](https://chime.realmayus.xyz)** \n\n" \
                            "Chime has a **web app** where you can manage and set up personal playlists and manage settings of your servers! https://chime.realmayus.xyz \n\n" \
                            "**Use** `" + self.clean_prefix + "help [command]` **for more info on a command.**"
        for cog, commands in mapping.items():
            if cog is not None:  # We don't want commands without categories! >:c
                name = cog.qualified_name
                filtered = await self.filter_commands(commands, sort=True)
                if filtered:
                    builder = []
                    for command in commands:  # filtering out hidden commands
                        command: Command
                        builder.append(f"`{prefix + command.name}`" if not command.hidden else "")
                    value = '  '.join(builder)
                    if cog and cog.description:
                        value = '{0}\n{1}'.format(cog.description, value)

                    embed.add_field(name=name, value=value)

        await self.get_destination().send(embed=embed)
示例#4
0
    async def stats(self, ctx):
        """Shows useful information about the current node your chime player is connected to. Useful for troubleshooting."""
        player = self.bot.wavelink.get_player(ctx.guild.id)
        node = player.node

        embed = StyledEmbed(title="chime stats")
        embed.description = f'Connected to {len(self.bot.wavelink.nodes)} node(s).\n' \
                            f'Best available node: **{self.bot.wavelink.get_best_node().__repr__()}**\n'
        embed.add_field(name="Stream count",
                        value=f"{str(node.stats.playing_players)}")
        embed.add_field(name="Server Count", value=f"{len(self.bot.guilds)}")
        embed.add_field(
            name="Lavalink uptime",
            value=
            f"{str(datetime.timedelta(seconds=round(node.stats.uptime / 1000)))}"
        )

        current_time = time.time()
        difference = int(round(current_time - self.bot.start_time))
        timestamp = str(datetime.timedelta(seconds=difference))
        embed.add_field(name="Bot uptime", value=f"{timestamp}")
        await ctx.send(embed=embed)