Example #1
0
 async def ongoing(self, context):
     """Zeigt alle laufenden Termine an"""
     output = ''
     if not self.reminders:
         await context.channel.send('Es gibt momentan keine laufenden Termine!')
     else:
         for reminder in self.reminders:
             if reminder.is_running:
                 output += f'{reminder.calendar_name}: {reminder.summary}\n'
         await context.channel.send(codeblock(output))
Example #2
0
    async def calcstats(self, context):
        async with context.channel.typing():
            await context.channel.send(codeblock('fetching messages...'))

            messages = await fetch_messages(context.guild)

            await context.channel.send(codeblock(f'retrieved {len(messages)} messages.'))
            await context.channel.send(codeblock('evaluating...'))

            result = analize(messages)

            for dict in result:
                try:
                    name_dict = {}
                    for key, val in dict.items():
                        name_dict[key.name] = val
                except AttributeError:
                    name_dict = dict

                sorted_result = [(w, name_dict[w]) for w in sorted(name_dict, key=name_dict.get, reverse=True)]
                await context.channel.send(str(sorted_result))

            return
Example #3
0
    def add_indented_commands(self, commands, *, heading):
        """Indents a list of commands after the specified heading."""

        if not commands:
            return

        entry = ''

        for command in commands:
            if command.short_doc != '':
                name = command.name
                entry += self.clean_prefix + name + codeblock(
                    command.short_doc)

        if entry != '':
            self.embed.add_field(name=heading, value=entry, inline=False)
Example #4
0
 async def config(self, context):
     """Zeigt die EIT-Config"""
     await context.channel.send(codeblock(self.print_config()))
Example #5
0
 async def send_command_help(self, command):
     self.embed.add_field(name=f"{self.clean_prefix}{command.name}",
                          value=codeblock(command.short_doc),
                          inline=False)
     await self.send_embed()