Ejemplo n.º 1
0
    async def _list(self, ctx):
        """Allows to show the balance of all the registered users."""
        server = ctx.message.server
        if server.id not in self.db:
            self.db[server.id] = {}
            self.save_db()
            await self.bot.say("List is empty, please add members first using [p]points add <Discord name or nickname>")
            return
        else:
            db = self.db[server.id]
        try:
            columns = [sorted([y for y in self.db[server.id][x].keys()], reverse=True)
                       for x in db if x != "bookkeeper"][0]
            i, j = columns.index(columns[1]), columns.index(columns[2])
            columns[i], columns[j] = columns[j], columns[i]
            rows = sorted([[db[x]["Name"], db[x]["Lifetime Gain"], db[x]["Lifetime Loss"], db[x]["Balance"]]
                           for x in db if x != "bookkeeper"], key=itemgetter(3, 0), reverse=True)
        except IndexError:
            await self.bot.say("No one has been added to the list, please use points member add"
                               " <Discord name or nickname> to do so first.")
            return
        if len(rows) > 15:
            n = 14
            l = 15
            m = 0

            for x in range(n, len(rows)+15, l):
                if x == n:
                    await self.bot.say(box(tabulate(rows[:x], headers=columns), lang="prolog"))
                else:
                    await self.bot.say(box(tabulate(rows[m:x], headers=columns), lang="prolog"))
                m = x
        else:
            await self.bot.say(box(tabulate(rows, headers=columns), lang="prolog"))
Ejemplo n.º 2
0
 async def _ascii(self, *, text):
     msg = str(figlet_format(text, font='cybermedium'))
     if msg[0] == " ":
         msg = "." + msg[1:]
     error = figlet_format('LOL, that\'s a bit too long.',
                           font='cybermedium')
     if len(msg) > 2000:
         await self.bot.say(box(error))
     else:
         await self.bot.say(box(msg))
Ejemplo n.º 3
0
    async def _quotes(self, ctx, *, author: str):
        """Retrieves a specified number of quotes from a specified author. Max number of quotes at a time is 5.
        Examples:
        [p]quotes Morgan Freeman; 5
        [p]quotes Margaret Thatcher; 2"""
        regex = "title=\"view quote\">([^`]*?)<\/a>"
        url = 'http://www.brainyquote.com/quotes/authors/'
        try:
            author = author.split('; ')
            title = author[0]
            number = int(author[1])
            if number > 5:
                number = 5
                await self.bot.reply("Heck naw brah. 5 is max. Any more and you get killed.")
            url = url + title.lower()[0] + "/" + title.lower().replace(" ", "_") + ".html"
            async with aiohttp.request("GET", url) as resp:
                test = str(await resp.text())
                quote_find = list(set(re.findall(regex, test)))
            for i in range(number):
                random_quote = choice(quote_find)
                quote_find.remove(random_quote)
                while random_quote == title:
                    random_quote = choice(quote_find)
                random_quote = random_quote.replace("&#39;", "'") if "&#39;" in random_quote else random_quote
                await self.bot.say(box(random_quote))
                await asyncio.sleep(1)

        except IndexError:
            await self.bot.say("Your search is not valid, please follow the examples."
                               "Make sure the names are correctly written\n"
                               "[p]quotes Margaret Thatcher; 5\n[p]quotes Morgan Freeman; 5")
Ejemplo n.º 4
0
    async def galset(self, ctx):
        """
        Gallery module settings
        """
        if ctx.invoked_subcommand is None:
            await self.bot.send_cmd_help(ctx)
            if ctx.message.channel.id not in self.settings:
                await self.bot.say("Settings for %s: not configured." %
                                   ctx.message.channel.mention)
                return

            settings = self.settings_for(ctx.message.channel)
            await self.bot.say(
                ("Settings for %s:\n" % ctx.message.channel.mention) +
                box("\n".join((
                    "Enabled          : " +
                    ("yes" if settings["ENABLED"] else "no"),
                    "Artist role name : " +
                    (settings["ARTIST_ROLE"] or "(not set)"),
                    "Max message age  : " +
                    _generate_timespec(settings["EXPIRATION"]),
                    "Pin emojis       : " +
                    ", ".join(settings.get("PIN_EMOTES", [])),
                    "Pins only        : " +
                    ("yes" if settings.get("PINS_ONLY") else "no"),
                    "Privileged only  : " +
                    ("yes" if settings.get("PRIV_ONLY") else "no"),
                ))))
Ejemplo n.º 5
0
    async def karmaboard(self, top: int = 10):
        """Prints out the karma leaderboard

        Defaults to top 10. Use negative numbers to reverse the leaderboard."""
        reverse = True
        if top == 0:
            top = 10
        elif top < 0:
            reverse = False
            top = -top
        self.karma = dataIO.load_json(KARMA_PATH)
        members_sorted = sorted(self._get_all_members(),
                                key=lambda x: x.karma,
                                reverse=reverse)
        if len(members_sorted) < top:
            top = len(members_sorted)
        topten = members_sorted[:top]
        highscore = ""
        place = 1
        for member in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += ("{} | ".format(
                member.name)).ljust(18 - len(str(member.karma)))
            highscore += str(member.karma) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                await self.bot.say(box(page, lang="py"))
        else:
            await self.bot.say("No one has any karma �")
Ejemplo n.º 6
0
    async def _global_leaderboard(self, top: int=10):
        """Prints out the global leaderboard

        Defaults to top 10"""
        if top < 1:
            top = 10
        bank_sorted = sorted(self.bank.get_all_accounts(),
                             key=lambda x: x.balance, reverse=True)
        unique_accounts = []
        for acc in bank_sorted:
            if not self.already_in_list(unique_accounts, acc):
                unique_accounts.append(acc)
        if len(unique_accounts) < top:
            top = len(unique_accounts)
        topten = unique_accounts[:top]
        highscore = ""
        place = 1
        for acc in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += ("{} |{}| ".format(acc.name, acc.server.name)
                          ).ljust(23 - len(str(acc.balance)))
            highscore += str(acc.balance) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                await self.bot.say(box(page, lang="py"))
        else:
            await self.bot.say("There are no accounts in the bank.")
Ejemplo n.º 7
0
 async def leaderboard(self, ctx, top=10):
     """Displays the win/loss leaderboard"""
     server = ctx.message.server
     if top < 1:
         top = 10
     entries_sorted = sorted(self.arena.get_entries(server),
                             key=lambda x: x.wins,
                             reverse=True)
     entries_sorted = [a for a in entries_sorted if a.member]
     if len(entries_sorted) < top:
         top = len(entries_sorted)
     topentries = entries_sorted[:top]
     highscore = "Wins Losses\n".rjust(23)
     place = 1
     for acc in topentries:
         highscore += str(place).ljust(len(str(top)) + 1)
         highscore += (
             str(acc.member.display_name) +
             " ").ljust(23 - len(str(acc.wins) + " " + str(acc.losses)))
         highscore += str(acc.wins) + " " + str(acc.losses) + "\n"
         place += 1
     if highscore != "":
         for page in pagify(highscore, shorten_by=12):
             await self.bot.say(box(page, lang="py"))
     else:
         await self.bot.say("There are no accounts in the leaderboard")
Ejemplo n.º 8
0
    async def list(self, ctx, user: discord.Member=None):
        """
        Print out a user's game list (sends as a DM)

        user: (Optional) If given, list a user's game library, otherwise list the message user's library
        """

        author = ctx.message.author

        if not user:
            user = author

        game_list = get_library()

        if check_key(user.id) and game_list.get(user.id).get("games", False):
            user_game_list = get_library(user.id)

            message = pagify(", ".join(sorted(user_game_list)), [', '])

            await self.bot.say("Please check your DM for the full list of games, {}.".format(author.mention))
            await self.bot.send_message(author, "{}'s games:".format(user.mention))

            for page in message:
                await self.bot.send_message(author, (box(page)))
        else:
            await self.bot.say("{}, you do not have any games. Add one using `{p}game add <game_name>` and/or link your Steam profile with `{p}game steamlink <steam_id>`.".format(user.mention, p=ctx.prefix))
Ejemplo n.º 9
0
    async def _global_leaderboard(self, top: int=10):
        """Prints out the global leaderboard

        Defaults to top 10"""
        if top < 1:
            top = 10
        bank_sorted = sorted(self.bank.get_all_accounts(),
                             key=lambda x: x.balance, reverse=True)
        bank_sorted = [a for a in bank_sorted if a.member] #  exclude users who left
        unique_accounts = []
        for acc in bank_sorted:
            if not self.already_in_list(unique_accounts, acc):
                unique_accounts.append(acc)
        if len(unique_accounts) < top:
            top = len(unique_accounts)
        topten = unique_accounts[:top]
        highscore = ""
        place = 1
        for acc in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += ("{} |{}| ".format(acc.member, acc.server)
                          ).ljust(23 - len(str(acc.balance)))
            highscore += str(acc.balance) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                await self.bot.say(box(page, lang="py"))
        else:
            await self.bot.say("There are no accounts in the bank.")
Ejemplo n.º 10
0
    async def _server_leaderboard(self, ctx, top: int = 10):
        """Prints out the server's leaderboard

        Defaults to top 10"""
        # Originally coded by Airenkun - edited by irdumb
        server = ctx.message.server
        if top < 1:
            top = 10
        bank_sorted = sorted(self.bank.get_server_accounts(server),
                             key=lambda x: x.balance,
                             reverse=True)
        bank_sorted = [a for a in bank_sorted
                       if a.member]  #  exclude users who left
        if len(bank_sorted) < top:
            top = len(bank_sorted)
        topten = bank_sorted[:top]
        highscore = ""
        place = 1
        for acc in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += (str(acc.member.display_name) +
                          " ").ljust(23 - len(str(acc.balance)))
            highscore += str(acc.balance) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                #Adding info site.
                siteInfo = "\nFull rankings at https://ren.injabie3.moe/economy"
                sleepTime = 60
                msgId = await self.bot.say(box(page, lang="py") + siteInfo)
                await asyncio.sleep(sleepTime)
                await self.bot.delete_message(msgId)
        else:
            await self.bot.say("There are no accounts in the bank.")
Ejemplo n.º 11
0
    async def _send_list(self, repo_name=None):
        """Lists installable cogs"""
        retlist = []
        if repo_name and repo_name in self.repos:
            msg = "Available cogs:\n"
            for cog in sorted(self.repos[repo_name].keys()):
                if 'url' == cog:
                    continue
                data = self.get_info_data(repo_name, cog)
                if data:
                    retlist.append([cog, data.get("SHORT", "")])
                else:
                    retlist.append([cog, ''])
        else:
            msg = "Available repos:\n"
            for repo_name in sorted(self.repos.keys()):
                data = self.get_info_data(repo_name)
                if data:
                    retlist.append([repo_name, data.get("SHORT", "")])
                else:
                    retlist.append([repo_name, ""])

        col_width = max(len(row[0]) for row in retlist) + 2
        for row in retlist:
            msg += "\t" + "".join(word.ljust(col_width) for word in row) + "\n"
        for page in pagify(msg, delims=['\n'], shorten_by=8):
            await self.bot.say(box(page))
Ejemplo n.º 12
0
    async def info(self, ctx, command):
        """Gives current info about permissions on your server"""
        server = ctx.message.server
        channel = ctx.message.channel
        if command not in self.perms_we_want:
            await self.bot.say("No permissions have been set up for that"
                               " command")
            return
        elif server.id not in self.perms_we_want[command]:
            await self.bot.say("No permissions have been set up for this"
                               " server.")
            return
        cmd_obj = self._get_command(command)
        perm_info = await self._get_info(server, cmd_obj)
        headers = ["Channel", "Status", "Role", "Status", "Locked Here"]

        partial = itertools.zip_longest(perm_info["CHANNELS"],
                                        perm_info["ROLES"], fillvalue=("", ""))
        partial = list(partial)

        if len(partial) == 0:
            partial = ((("", ""), ("", "")), )  # For compat below
        data = []
        for i, row in enumerate(partial):
            if i == 0:
                locked = (str(self._is_locked(command, server, channel)), )
            else:
                locked = tuple()
            data.append(row[0] + row[1] + locked)

        msg = tabulate(data, headers=headers, tablefmt='psql')
        await self.bot.say(box(msg))
Ejemplo n.º 13
0
    async def listclones(self, ctx):
        """Lists the current autorooms"""
        server = ctx.message.server
        if server.id not in self.settings:
            self.initial_config(server.id)

        channels = self.settings[server.id]['channels']
        if len(channels) == 0:
            return await self.bot.say("No autorooms set for this server")

        fix_list = []
        output = "Current Auto rooms\nChannel ID: Channel Name"
        for c in channels:
            channel = discord.utils.find(
                lambda m: m.id == c, server.channels
            )
            if channel is None:
                fix_list.append(c)
            else:
                output += "\n{}: {}".format(c, channel.name)
        for page in pagify(output, delims=["\n", ","]):
            await self.bot.send_message(ctx.message.author, box(page))
        for c in fix_list:
            channels.remove(c)
            self.save_json
Ejemplo n.º 14
0
    async def _server_leaderboard(self, ctx, top: int=10):
        """Prints out the server's leaderboard

        Defaults to top 10"""
        # Originally coded by Airenkun - edited by irdumb
        server = ctx.message.server
        if top < 1:
            top = 10
        bank_sorted = sorted(self.bank.get_server_accounts(server),
                             key=lambda x: x.balance, reverse=True)
        if len(bank_sorted) < top:
            top = len(bank_sorted)
        topten = bank_sorted[:top]
        highscore = ""
        place = 1
        for acc in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += (acc.name + " ").ljust(23 - len(str(acc.balance)))
            highscore += str(acc.balance) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                await self.bot.say(box(page, lang="py"))
        else:
            await self.bot.say("There are no accounts in the bank.")
Ejemplo n.º 15
0
 async def partycrash(self, ctx, idnum=None):
     """Lists servers and generates invites for them"""
     owner = ctx.message.author
     if idnum:
         server = discord.utils.get(self.bot.servers, id=idnum)
         if server:
             await self._confirm_invite(server, owner, ctx)
         else:
             await self.bot.say("I'm not in that server")
     else:
         msg = ""
         servers = sorted(self.bot.servers, key=lambda s: s.name)
         for i, server in enumerate(servers, 1):
             msg += "{}: {}\n".format(i, server.name)
         msg += "\nTo post an invite for a server just type its number."
         for page in pagify(msg, delims=["\n"]):
             await self.bot.say(box(page))
             await asyncio.sleep(1.5)  # Just in case for rate limits
         msg = await self.bot.wait_for_message(author=owner, timeout=15)
         if msg is not None:
             try:
                 msg = int(msg.content.strip())
                 server = servers[msg - 1]
             except ValueError:
                 await self.bot.say("You must enter a number.")
             except IndexError:
                 await self.bot.say("Index out of range.")
             else:
                 try:
                     await self._confirm_invite(server, owner, ctx)
                 except discord.Forbidden:
                     await self.bot.say("I'm not allowed to make an invite"
                                        " for {}".format(server.name))
         else:
             await self.bot.say("Response timed out.")
Ejemplo n.º 16
0
    async def _server_leaderboard(self, ctx, top: int=10):
        """Prints out the server's leaderboard

        Defaults to top 10"""
        # Originally coded by Airenkun - edited by irdumb
        server = ctx.message.server
        if top < 1:
            top = 10
        bank_sorted = sorted(self.bank.get_server_accounts(server),
                             key=lambda x: x.balance, reverse=True)
        bank_sorted = [a for a in bank_sorted if a.member] #  exclude users who left
        if len(bank_sorted) < top:
            top = len(bank_sorted)
        topten = bank_sorted[:top]
        highscore = ""
        place = 1
        for acc in topten:
            highscore += str(place).ljust(len(str(top)) + 1)
            highscore += (str(acc.member.display_name) + " ").ljust(23 - len(str(acc.balance)))
            highscore += str(acc.balance) + "\n"
            place += 1
        if highscore != "":
            for page in pagify(highscore, shorten_by=12):
                await self.bot.say(box(page, lang="py"))
        else:
            await self.bot.say("There are no accounts in the bank.")
Ejemplo n.º 17
0
    async def _send_list(self, repo_name=None):
        """Lists installable cogs"""
        retlist = []
        if repo_name and repo_name in self.repos:
            msg = "Available cogs:\n"
            for cog in sorted(self.repos[repo_name].keys()):
                if 'url' == cog:
                    continue
                data = self.get_info_data(repo_name, cog)
                if data:
                    retlist.append([cog, data.get("SHORT", "")])
                else:
                    retlist.append([cog, ''])
        else:
            msg = "Available repos:\n"
            for repo_name in sorted(self.repos.keys()):
                data = self.get_info_data(repo_name)
                if data:
                    retlist.append([repo_name, data.get("SHORT", "")])
                else:
                    retlist.append([repo_name, ""])

        col_width = max(len(row[0]) for row in retlist) + 2
        for row in retlist:
            msg += "\t" + "".join(word.ljust(col_width) for word in row) + "\n"
        await self.bot.say(box(msg))  # Need to deal with over 2000 characters
Ejemplo n.º 18
0
    def key_display_str(self, key, member, show_token=False):
        """Return formatted output of a key."""
        default = '-'

        out = []

        out.append("{member} ({id})".format(member=bold(member),
                                            id=key.get('id', default)))

        registered = key.get('registered', default)
        if isinstance(registered, int):
            registered_iso = dt.datetime.utcfromtimestamp(registered /
                                                          1000).isoformat()
            registered_str = "{} / {}".format(registered, registered_iso)
        else:
            registered_str = '-'
        out.append("Registered: {}".format(registered_str))

        out.append("Last Request: {}".format(key.get('lastRequest', default)))
        out.append("Blacklisted: {}".format(key.get('blacklisted', default)))

        if show_token:
            out.append("Token: {}".format(key.get('token', default)))

        request_count = key.get('requestCount', default)
        request_count_str = ''
        if isinstance(request_count, dict):
            request_count_str = box('\n'.join([
                "{} : {:>10,}".format(k, v) for k, v in request_count.items()
            ]),
                                    lang='python')

        out.append('Request Count: {}'.format(request_count_str))

        return '\n'.join(out)
Ejemplo n.º 19
0
    async def whisper(self, ctx, user: discord.User, text):
        """Whisper to someone using the bot
        Same as dming But you use the bot !"""

        author = ctx.message.author
        channel = ctx.message.channel

        try:
            await self.bot.delete_message(ctx.message)
        except:
            raise Exception(
                "Bruh i don't have delete messages perms delete your messaqe")

        prefix = "Ayoo Matey you Getting a Message from {} ({})".format(
            author.name, author.id)
        payload = "{}\n\n``` ***```{}```***".format(prefix, text)

        try:
            for page in pagify(payload, delims=[" ", "\n"], shorten_by=10):
                await self.bot.send_message(user, box(page))
        except discord.errors.Forbidden:
            log.debug(
                "I CAN'T F*****G SEND MSGS TO {} FFS DID HE BLOCK Me ! Or maybe he just has that teng where randoms can't msg :thinking: o well ¯\_(ツ)_/¯"
                .format(user))
        except (discord.errors.NotFound, discord.errors.InvalidArgument):
            log.debug("{} *404* Dis bitch not found~".format(user))
        else:
            reply = await self.bot.say(
                "Whisper Mcfucking *** Delivered***  https://goo.gl/3qCxR4 ")
            await asyncio.sleep(5)
            await self.bot.delete_message(reply)
Ejemplo n.º 20
0
    async def ownereslog_users(self, ctx, *args):
        """Show debug"""
        parser = ESLogger.parser()
        try:
            p_args = parser.parse_args(args)
        except SystemExit:
            await send_cmd_help(ctx)
            return

        await self.bot.type()
        server = ctx.message.server
        s = self.message_search.server_messages(server, p_args)

        results = [{
            "author_id": doc.author.id,
            "channel_id": doc.channel.id,
            "timestamp": doc.timestamp,
            "rng_index": None,
            "rng_timestamp": None,
            "doc": doc
        } for doc in s.scan()]

        p = pprint.PrettyPrinter(indent="4")
        out = p.pformat(results)

        for page in pagify(out, shorten_by=80):
            await self.bot.say(box(page, lang='py'))
Ejemplo n.º 21
0
    async def info(self, ctx, command):
        """Gives current info about permissions on your server"""
        server = ctx.message.server
        channel = ctx.message.channel
        if command not in self.perms_we_want:
            await self.bot.say("No permissions have been set up for that"
                               " command")
            return
        elif server.id not in self.perms_we_want[command]:
            await self.bot.say("No permissions have been set up for this"
                               " server.")
            return
        cmd_obj = self._get_command(command)
        perm_info = await self._get_info(server, cmd_obj)
        headers = ["Channel", "Status", "Role", "Status", "Locked Here"]

        partial = itertools.zip_longest(perm_info["CHANNELS"],
                                        perm_info["ROLES"],
                                        fillvalue=("", ""))
        partial = list(partial)

        if len(partial) == 0:
            partial = ((("", ""), ("", "")), )  # For compat below
        data = []
        for i, row in enumerate(partial):
            if i == 0:
                locked = (str(self._is_locked(command, server, channel)), )
            else:
                locked = tuple()
            data.append(row[0] + row[1] + locked)

        msg = tabulate(data, headers=headers, tablefmt='psql')
        await self.bot.say(box(msg))
Ejemplo n.º 22
0
    async def _user(self, ctx, user: discord.Member=None):
        """Set the users that can trigger the message"""

        if user is None:
            await send_cmd_help(ctx)
            name = []
            for x in self.users:
                if x in [u.id for u in self.bot.get_all_members()]:
                    name.append('{0.name}#{0.discriminator} ({0.id})'.format(
                        [u for u in self.bot.get_all_members() if u.id == x][0]))
                else:
                    name.append('{0.name}#{0.discriminator} ({0.id})'.format(await self.bot.get_user_info(x)))
            if name:
                userlist = ', '.join(name)
            else:
                userlist = "No one"
            await self.bot.say(box(userlist))
            return

        if user.bot and self.bot.user.bot:
            await self.bot.say('`Cannot add Bots`')
            return
        elif user.id in self.users:
            self.users.remove(user.id)
            await self.bot.say('`removed \'{}\'`'.format(user))
        else:
            self.users.append(user.id)
            await self.bot.say('`added \'{}\'`'.format(user))

        self.settings['user'] = self.users
        dataIO.save_json('data/responder/settings.json', self.settings)
Ejemplo n.º 23
0
    async def discover_server(self, author: discord.User):
        output = ""
        servers = sorted(self.bot.servers, key=lambda s: s.name)
        for i, server in enumerate(servers, 1):
            output += "{}: {}\n".format(i, server.name)
        output += "Select a server to add to the sync list by number, "\
            "or enter \"-1\" to stop adding servers"
        for page in pagify(output, delims=["\n"]):
            dm = await self.bot.send_message(author, box(page))

        message = await self.bot.wait_for_message(channel=dm.channel,
                                                  author=author, timeout=15)
        if message is not None:
            try:
                message = int(message.content.strip())
                if message == -1:
                    return -1
                else:
                    server = servers[message - 1]
            except (ValueError, IndexError):
                await self.bot.send_message(author,
                                            "That wasn't a valid choice")
                return None
            else:
                return server
        else:
            await self.bot.say("You took too long, try again later")
            return None
Ejemplo n.º 24
0
 async def info(self, ctx, trigger_name: str):
     """Shows a trigger's info"""
     trigger = self.get_trigger_by_name(trigger_name)
     if trigger:
         msg = "Name: {}\n".format(trigger.name)
         owner_name = discord.utils.get(self.bot.get_all_members(),
                                        id=trigger.owner)
         owner_name = owner_name if owner_name is not None else "not found"
         msg += "Owner: {} ({})\n".format(owner_name, trigger.owner)
         trigger_type = "all responses" if trigger.type == "all" else "random response"
         msg += "Type: {}\n".format(trigger_type)
         influence = "server" if trigger.server is not None else "global"
         msg += "Influence: {}\n".format(influence)
         cs = "yes" if trigger.case_sensitive else "no"
         msg += "Case Sensitive: {}\n".format(cs)
         regex = "yes" if trigger.regex else "no"
         msg += "Regex: {}\n".format(regex)
         msg += "Cooldown: {} seconds\n".format(trigger.cooldown)
         msg += "Triggered By: \"{}\"\n".format(
             trigger.triggered_by.replace("`", "\\`"))
         msg += "Payload: {} responses\n".format(len(trigger.responses))
         msg += "Triggered: {} times\n".format(trigger.triggered)
         await self.bot.say(box(msg, lang="xl"))
     else:
         await self.bot.say("There is no trigger with that name.")
 async def info(self, repo_name: str, cog: str=None):
     """Shows info about the specified cog"""
     if cog is not None:
         cogs = self.list_cogs(repo_name)
         if cog in cogs:
             data = self.get_info_data(repo_name, cog)
             if data:
                 msg = "{} by {}\n\n".format(cog, data["AUTHOR"])
                 msg += data["NAME"] + "\n\n" + data["DESCRIPTION"]
                 await self.bot.say(box(msg))
             else:
                 await self.bot.say("The specified cog has no info file.")
         else:
             await self.bot.say("That cog doesn't exist."
                                " Use cog list to see the full list.")
     else:
         data = self.get_info_data(repo_name)
         if data is None:
             await self.bot.say("That repo does not exist or the"
                                " information file is missing for that repo"
                                ".")
             return
         name = data.get("NAME", None)
         name = repo_name if name is None else name
         author = data.get("AUTHOR", "Unknown")
         desc = data.get("DESCRIPTION", "")
         msg = ("```{} by {}```\n\n{}".format(name, author, desc))
         await self.bot.say(msg)
Ejemplo n.º 26
0
    async def discover_server(self, author: discord.User):

        shared_servers = []
        for server in self.bot.servers:
            x = server.get_member(author.id)
            if x is not None:
                shared_servers.append(server)
        if len(shared_servers) == 1:
            return shared_servers[0]
        output = ""
        servers = sorted(shared_servers, key=lambda s: s.name)
        for i, server in enumerate(servers, 1):
            output += "{}: {}\n".format(i, server.name)
        output += "\npick the server to make a report in by its number."

        for page in pagify(output, delims=["\n"]):
            dm = await self.bot.send_message(author, box(page))

        message = await self.bot.wait_for_message(channel=dm.channel,
                                                  author=author,
                                                  timeout=45)
        if message is not None:
            try:
                message = int(message.content.strip())
                server = servers[message - 1]
            except (ValueError, IndexError):
                await self.bot.send_message(author,
                                            "That wasn't a valid choice")
                return None
            else:
                return server
        else:
            await self.bot.say("You took too long, try again later")
            return None
Ejemplo n.º 27
0
 async def info(self, repo_name: str, cog: str = None):
     """Shows info about the specified cog"""
     if cog is not None:
         cogs = self.list_cogs(repo_name)
         if cog in cogs:
             data = self.get_info_data(repo_name, cog)
             if data:
                 msg = "{} by {}\n\n".format(cog, data["AUTHOR"])
                 msg += data["NAME"] + "\n\n" + data["DESCRIPTION"]
                 await self.bot.say(box(msg))
             else:
                 await self.bot.say("The specified cog has no info file.")
         else:
             await self.bot.say("That cog doesn't exist."
                                " Use cog list to see the full list.")
     else:
         data = self.get_info_data(repo_name)
         if data is None:
             await self.bot.say("That repo does not exist or the"
                                " information file is missing for that repo"
                                ".")
             return
         name = data.get("NAME", None)
         name = repo_name if name is None else name
         author = data.get("AUTHOR", "Unknown")
         desc = data.get("DESCRIPTION", "")
         msg = ("```{} by {}```\n\n{}".format(name, author, desc))
         await self.bot.say(msg)
Ejemplo n.º 28
0
 async def _search(self, ctx, wiki, *, search_term):
     """Searches for a page"""
     channel = ctx.message.channel
     results = await self.search(wiki, search_term)
     msg = "Possiblities:\n"
     for result in sorted(results):
         msg += " - {}\n".format(result)
     await self.bot.send_message(channel, box(msg))
Ejemplo n.º 29
0
 async def img2txt(self, ctx: Context, url: str = None, columns=30):
     """Convert image as URL to ascii."""
     if url is None:
         await send_cmd_help(ctx)
         return
     output = ascii.loadFromUrl(url, columns=columns, color=False)
     for page in pagify(output, shorten_by=24):
         await self.bot.say(box(page))
Ejemplo n.º 30
0
 async def logger_list(self, ctx):
     """Lists logs and their levels."""
     loggers = self._get_red_loggers()
     levels = self._get_levels(loggers)
     ret = zip(loggers, levels)
     headers = ["Logger", "Level"]
     msg = tabulate.tabulate(ret, headers, tablefmt="psql")
     await self.bot.say(box(msg))
Ejemplo n.º 31
0
 async def logger_list(self, ctx):
     """Lists logs and their levels."""
     loggers = self._get_red_loggers()
     levels = self._get_levels(loggers)
     ret = zip(loggers, levels)
     headers = ["Logger", "Level"]
     msg = tabulate.tabulate(ret, headers, tablefmt="psql")
     await self.bot.say(box(msg))
Ejemplo n.º 32
0
 async def _search(self, ctx, wiki, *, search_term):
     """Searches for a page"""
     channel = ctx.message.channel
     results = await self.search(wiki, search_term)
     msg = "Possiblities:\n"
     for result in sorted(results):
         msg += " - {}\n".format(result)
     await self.bot.send_message(channel, box(msg))
Ejemplo n.º 33
0
 async def figletrandom(self, ctx: Context, text: str):
     """Convert text to ascii art using random font."""
     font = random.choice(FigletFont.getFonts())
     f = Figlet(font=font)
     out = f.renderText(text)
     for page in pagify(out, shorten_by=24):
         await self.bot.say(box(page))
     await self.bot.say("Font: {}".format(font))
Ejemplo n.º 34
0
    async def calc(self, ctx, *, input):
        """Calculator.

        Expression | Example    | Output
        ---------- | -------    | ------
        +          | 2 + 2      | 4.0
        -          | 3 - 1      | 2.0
        *.         | 2 * 3      | 6.0
        /          | 5 / 2      | 2.5
        %          | 5 % 2      | 1.0
        ^          | 5 ^ 2      | 25.0
        PI         | PI         | 3.14159265
        E          | E          | 2.71828182
        sin(x)     | sin(0)     | 0.0
        cos(x)     | cos(PI)    | - 1.0
        tan(x)     | tan(0)     | 0.0
        asin(x)    | asin(0)    | 0.0
        acos(x)    | acos(-1)   | 3.14159265
        atan(x)    | atan(PI)   | 1.26262725
        log(x)     | log(1)     | 0.0
        abs(x)     | abs(-1)    | 1.0
        ceil(x)    | ceil(2.7)  | 3.0
        floor(x)   | floor(2.7) | 2.0
        round(x)   | round(2.7) | 3.0
        exp(x)     | exp(2)     | 7.38905609
        """
        if not input:
            await send_cmd_help(ctx)
            return

        await self.bot.say(box(input))

        parser = Parser()
        try:
            out = parser.parse(input).evaluate({})
        except ZeroDivisionError:
            await self.bot.say(":warning: Zero division error")
            return
        except OverflowError:
            await self.bot.say(":warning: Overflow error")
            return
        except FloatingPointError:
            await self.bot.say(":warning: floating point error.")
            return

        await self.bot.say(box(out))
    async def register(self, ctx: commands.Context, *, role_name: str = ''):
        """Gives the user a role

        Valid roles can be added using !regedit
        Example usage: !register PC"""
        server = ctx.message.server
        user = ctx.message.author
        task = None  # Whether we are removing or adding a role, or doing nothing
        delete_after = None  # is set if the 'quiet' option is on
        msg = ''
        if server.id not in self.settings:
            return
        if role_name:
            role = next((r for r in server.roles if r.name == role_name
                         and r.id in self.settings[server.id]["roles"]), None)
            if role is None:
                msg = "You can't register for that role.".format(role_name)
            else:
                try:
                    if role not in user.roles:
                        task = ADD
                        await self.bot.add_roles(user, role)
                    else:
                        task = REMOVE
                        await self.bot.remove_roles(user, role)
                    msg = "The {} role has been {} {}.".format(
                        role_name, task, user.display_name)
                except discord.errors.Forbidden:
                    if not server.me.server_permissions.manage_roles:
                        msg = "I don't have the `Manage Roles` permission."
                    elif role > server.me.top_role:
                        msg = "I cannot manage roles higher than my top role's position."
                    else:
                        msg = "I don't have permission to do that."
        else:
            # --- SEND VALID ROLES ---
            if server.id in self.settings and self.settings[
                    server.id]["roles"]:
                valid_roles = [
                    r.name for r in server.roles
                    if r.id in self.settings[server.id]["roles"]
                ]
                msg = box("Valid register roles in {}:\n"
                          "{}"
                          "".format(server.name,
                                    ", ".join(sorted(valid_roles))))
            else:
                msg = "Register isn't enabled in this server."
        delete_after = self.settings[server.id]["delete_after"]
        await self.bot.say(msg, delete_after=delete_after)
        if delete_after is not None:
            await asyncio.sleep(delete_after)
            try:
                await self.bot.delete_message(ctx.message)
            except discord.errors.NotFound:  # Just in case some fool deletes their message before the bot does
                pass
            except discord.errors.Forbidden:  # Bot doesn't have permission to delete messages
                pass  # We don't want to make even more of a mess
Ejemplo n.º 36
0
 async def balance_all(self, ctx):
     """Allows to show the balance of all the registered users."""
     server = ctx.message.server
     if server.id not in self.db:
         self.db[server.id] = {}
         self.save_db()
     else:
         db = self.db[server.id]
     try:
         columns = [
             sorted([y for y in self.db[server.id][x].keys()], reverse=True)
             for x in self.db[server.id]
         ][0]
         i, j = columns.index(columns[1]), columns.index(columns[2])
         columns[i], columns[j] = columns[j], columns[i]
         rows = sorted([[
             db[x]["Name"], db[x]["Lifetime Gain"], db[x]["Lifetime Loss"],
             db[x]["Balance"]
         ] for x in db],
                       key=itemgetter(3, 0),
                       reverse=True)
     except IndexError:
         await self.bot.say(
             "No one has been added to the list, please use add_member to do so first."
         )
         return
     if len(rows) > 15:
         n = 14
         l = 15
         m = 0
         for x in range(n, n * 3, l):
             if x == n:
                 await self.bot.say(
                     box(tabulate(rows[:x], headers=columns),
                         lang="prolog"))
             elif x != n:
                 await self.bot.say(
                     box(tabulate(rows[m:x], headers=columns),
                         lang="prolog"))
             elif x > len(rows):
                 return
             m = x
     else:
         await self.bot.say(
             box(tabulate(rows, headers=columns), lang="prolog"))
Ejemplo n.º 37
0
    async def _whitelist_list(self):
        """Lists users on the whitelist"""
        whitelist = self._populate_list(self.global_ignores["whitelist"])

        if whitelist:
            for page in whitelist:
                await self.bot.say(box(page))
        else:
            await self.bot.say("The whitelist is empty.")
Ejemplo n.º 38
0
 async def _results(self, ctx, pollid):
     """Results of a strawpoll are returned"""
     async with aiohttp.request('GET', 'http://strawpoll.me/api/v2/polls/{}'.format(pollid),
                                    headers={'content-type': 'application/json'}) as resp:
             data = await resp.json()
             s = "{}\n\n".format(html.unescape(data["title"]))
             for o in range(len(data["options"])):
                 s += "{}: {}\n".format(html.unescape(data["options"][o]), data["votes"][o])
             await self.bot.say(box(s))
Ejemplo n.º 39
0
    async def _blacklist_list(self):
        """Lists users on the blacklist"""
        blacklist = self._populate_list(self.global_ignores["blacklist"])

        if blacklist:
            for page in blacklist:
                await self.bot.say(box(page))
        else:
            await self.bot.say("The blacklist is empty.")
Ejemplo n.º 40
0
    async def roles(self, ctx):
        """States roles from highest to lowest"""

        list = "\n".join([
            x.name for x in ctx.message.server.role_hierarchy
            if x.name != "@everyone"
        ])
        for page in pagify(list, ["\n"], shorten_by=7, page_length=2000):
            await self.bot.say(box(page))
Ejemplo n.º 41
0
    async def _scheduler_list(self, ctx):
        """Lists all repeated commands
        """
        server = ctx.message.server

        if not self.events.get(server.id):
            await self.bot.say('No events scheduled for this server.')
            return

        mess = "Names:\n\t"
        mess += "\n\t".join(sorted(self.events[server.id].keys()))
        await self.bot.say(box(mess))
Ejemplo n.º 42
0
 async def _bash(self, ctx, num: int=1):
     """Retrieves a quote from bash.org. num can be specified for number of quotes. Max is 5."""
     regex = ["<p class=\"qt\">([^`]*?)<\/p>", "<br \/>"]
     if num > 5:
         num = 5
         await self.bot.reply("Heck naw brah. 5 is max. Any more and you get killed.")
     for i in range(num):
         async with aiohttp.request("GET", 'http://bash.org/?random') as resp:
             test = str(await resp.text())
             subs = re.findall(regex[0], test)
             brsub = re.sub(regex[1], "", subs[0])
             subs2 = html.unescape(brsub)
             await self.bot.say(box(subs2))
             await asyncio.sleep(1)
Ejemplo n.º 43
0
 def get_n_trigger_responses(self, trigger, *, truncate=2000):
     msg = ""
     responses = trigger.responses
     i = 0
     for r in responses:
         if len(r) > truncate:
             r = r[:truncate] + "..."
         r = r.replace("`", "\\`").replace("*", "\\*").replace("_", "\\_")
         msg += "{}. {}\n".format(i, r)
         i += 1
     if msg != "":
         return box(msg, lang="py")
     else:
         return None
Ejemplo n.º 44
0
 async def info(self, repo_name: str, cog: str):
     """Shows info about the specified cog"""
     cogs = self.list_cogs(repo_name)
     if cog in cogs:
         data = self.get_info_data(repo_name, cog)
         if data:
             msg = "{} by {}\n\n".format(cog, data["AUTHOR"])
             msg += data["NAME"] + "\n\n" + data["DESCRIPTION"]
             await self.bot.say(box(msg))
         else:
             await self.bot.say("The specified cog has no info file.")
     else:
         await self.bot.say("That cog doesn't exist."
                            " Use cog list to see the full list.")
Ejemplo n.º 45
0
 async def karmaboard(self, ctx):
     """Karma leaderboard"""
     server = ctx.message.server
     member_ids = [m.id for m in server.members]
     karma_server_members = [key for key in self.scores.keys()
                             if key in member_ids]
     log.debug("Karma server members:\n\t{}".format(
         karma_server_members))
     names = list(map(lambda mid: discord.utils.get(server.members, id=mid),
                      karma_server_members))
     log.debug("Names:\n\t{}".format(names))
     scores = list(map(lambda mid: self.scores[mid]["score"],
                       karma_server_members))
     log.debug("Scores:\n\t{}".format(scores))
     headers = ["User", "Karma"]
     body = sorted(zip(names, scores), key=lambda tup: tup[1],
                   reverse=True)[:25]
     table = tabulate.tabulate(body, headers, tablefmt="psql")
     await self.bot.say(box(table))
Ejemplo n.º 46
0
    async def games(self, ctx, name: str):
        """Shows game sessions for a group based on ID.
           How-to ID:
           https://www.the100.io/groups/4311
           https://www.the100.io/groups/X
           Where X is the Group ID"""
        server = ctx.message.server
        url = "https://www.the100.io/api/v1/groups/{}/gaming_sessions".format(name)
        if not self.permcheck(ctx):
            return
        if self.db[server.id]["token"]:
            self.headers["Authorization"] = self.headers["Authorization"].format(self.db[server.id]["token"])
            headers = self.headers
        else:
            await self.bot.say("Token has not been set, please set it using this command in a PM, [p]the100 set token")
            return
        async with self.session.get(url, headers=headers) as resp:
            response = await resp.json()
        msg = ""
        for s, x in enumerate(response, start=1):
            for y in ["category", "team_size", "time_zone",
                      "group_only", "party_size", "light_level", "platform_formatted",
                      "start_time", "has_spots_open", "confirmed_sessions"]:
                if y == "confirmed_sessions":
                    users = []
                    for z in x[y]:
                        users.append(z["user"]["gamertag"])
                    msg += "Users: " + ", ".join(users[:-2] + [" and ".join(users[-2:])]) + "\n"
                elif y == "start_time":
                    time = "".join(str(x[y]).rsplit(":", 1))
                    msg += "Start time: " + " ".join((time[:-9] + " " + time[-5:]).split("T")) + "\n"
                elif y == "platform_formatted":
                    msg += "Platform: " + x[y] + "\n"

                else:
                    if "_" in y:
                        m = [a[0].upper()+a[1:] for a in y.split("_")]
                        msg += " ".join(m) + ": " + str(x[y]) + "\n"
                    else:
                        msg += y[0].upper() + y[1:] + ": " + str(x[y]) + "\n"
            await self.bot.say("Event Info #{}:\n{}".format(s, box(msg)))
            await asyncio.sleep(2)
    async def _send_list(self, repo_name=None):
        """Lists installable cogs

        Repositories list:
        https://twentysix26.github.io/Red-Docs/red_cog_approved_repos/"""
        retlist = []
        if repo_name and repo_name in self.repos:
            msg = "Available cogs:\n"
            for cog in sorted(self.repos[repo_name].keys()):
                if 'url' == cog:
                    continue
                data = self.get_info_data(repo_name, cog)
                if data and data.get("HIDDEN") is True:
                    continue
                if data:
                    retlist.append([cog, data.get("SHORT", "")])
                else:
                    retlist.append([cog, ''])
        else:
            if self.repos:
                msg = "Available repos:\n"
                for repo_name in sorted(self.repos.keys()):
                    data = self.get_info_data(repo_name)
                    if data:
                        retlist.append([repo_name, data.get("SHORT", "")])
                    else:
                        retlist.append([repo_name, ""])
            else:
                await self.bot.say("You haven't added a repository yet.\n"
                                   "Start now! {}".format(REPOS_LIST))
                return

        col_width = max(len(row[0]) for row in retlist) + 2
        for row in retlist:
            msg += "\t" + "".join(word.ljust(col_width) for word in row) + "\n"
        msg += "\nRepositories list: {}".format(REPOS_LIST)
        for page in pagify(msg, delims=['\n'], shorten_by=8):
            await self.bot.say(box(page))
Ejemplo n.º 48
0
 async def info(self, ctx, trigger_name : str):
     """Shows a trigger's info"""
     trigger = self.get_trigger_by_name(trigger_name)
     if trigger:
         msg = "Name: {}\n".format(trigger.name)
         owner_name = discord.utils.get(self.bot.get_all_members(), id=trigger.owner)
         owner_name = owner_name if owner_name is not None else "not found"
         msg += "Owner: {} ({})\n".format(owner_name, trigger.owner)
         trigger_type = "all responses" if trigger.type == "all" else "random response"
         msg += "Type: {}\n".format(trigger_type)
         influence = "server" if trigger.server is not None else "global"
         msg += "Influence: {}\n".format(influence)
         cs = "yes" if trigger.case_sensitive else "no"
         msg += "Case Sensitive: {}\n".format(cs)
         regex = "yes" if trigger.regex else "no"
         msg += "Regex: {}\n".format(regex)
         msg += "Cooldown: {} seconds\n".format(trigger.cooldown)
         msg += "Triggered By: \"{}\"\n".format(trigger.triggered_by.replace("`", "\\`"))
         msg += "Payload: {} responses\n".format(len(trigger.responses))
         msg += "Triggered: {} times\n".format(trigger.triggered)
         await self.bot.say(box(msg, lang="xl"))
     else:
         await self.bot.say("There is no trigger with that name.")
Ejemplo n.º 49
0
 async def _summary(self, ctx, wiki, *, search_term):
     """Gets a summary from a wikia page"""
     channel = ctx.message.channel
     result = await self.summary(wiki, search_term)
     msg = "Summary from {}:\n{}".format(wiki, result)
     await self.bot.send_message(channel, box(msg))
    async def update(self, ctx):
        """Updates cogs"""

        tasknum = 0
        num_repos = len(self.repos)

        min_dt = 0.5
        burst_inc = 0.1/(NUM_THREADS)
        touch_n = tasknum
        touch_t = time()

        def regulate(touch_t, touch_n):
            dt = time() - touch_t
            if dt + burst_inc*(touch_n) > min_dt:
                touch_n = 0
                touch_t = time()
                return True, touch_t, touch_n
            return False, touch_t, touch_n + 1

        tasks = []
        for r in self.repos:
            task = partial(self.update_repo, r)
            task = self.bot.loop.run_in_executor(self.executor, task)
            tasks.append(task)

        base_msg = "Downloading updated cogs, please wait... "
        status = ' %d/%d repos updated' % (tasknum, num_repos)
        msg = await self.bot.say(base_msg + status)

        updated_cogs = []
        new_cogs = []
        deleted_cogs = []
        failed_cogs = []
        error_repos = {}
        installed_updated_cogs = []

        for f in as_completed(tasks):
            tasknum += 1
            try:
                name, updates, oldhash = await f
                if updates:
                    if type(updates) is dict:
                        for k, l in updates.items():
                            tl = [(name, c, oldhash) for c in l]
                            if k == 'A':
                                new_cogs.extend(tl)
                            elif k == 'D':
                                deleted_cogs.extend(tl)
                            elif k == 'M':
                                updated_cogs.extend(tl)
            except UpdateError as e:
                name, what = e.args
                error_repos[name] = what
            edit, touch_t, touch_n = regulate(touch_t, touch_n)
            if edit:
                status = ' %d/%d repos updated' % (tasknum, num_repos)
                msg = await self._robust_edit(msg, base_msg + status)
        status = 'done. '

        for t in updated_cogs:
            repo, cog, _ = t
            if self.repos[repo][cog]['INSTALLED']:
                try:
                    await self.install(repo, cog,
                                       no_install_on_reqs_fail=False)
                except RequirementFail:
                    failed_cogs.append(t)
                else:
                    installed_updated_cogs.append(t)

        for t in updated_cogs.copy():
            if t in failed_cogs:
                updated_cogs.remove(t)

        if not any(self.repos[repo][cog]['INSTALLED'] for
                   repo, cog, _ in updated_cogs):
            status += ' No updates to apply. '

        if new_cogs:
            status += '\nNew cogs: ' \
                   + ', '.join('%s/%s' % c[:2] for c in new_cogs) + '.'
        if deleted_cogs:
            status += '\nDeleted cogs: ' \
                   + ', '.join('%s/%s' % c[:2] for c in deleted_cogs) + '.'
        if updated_cogs:
            status += '\nUpdated cogs: ' \
                   + ', '.join('%s/%s' % c[:2] for c in updated_cogs) + '.'
        if failed_cogs:
            status += '\nCogs that got new requirements which have ' + \
                   'failed to install: ' + \
                   ', '.join('%s/%s' % c[:2] for c in failed_cogs) + '.'
        if error_repos:
            status += '\nThe following repos failed to update: '
            for n, what in error_repos.items():
                status += '\n%s: %s' % (n, what)

        msg = await self._robust_edit(msg, base_msg + status)

        if not installed_updated_cogs:
            return

        patchnote_lang = 'Prolog'
        shorten_by = 8 + len(patchnote_lang)
        for note in self.patch_notes_handler(installed_updated_cogs):
            if note is None:
                continue
            for page in pagify(note, delims=['\n'], shorten_by=shorten_by):
                await self.bot.say(box(page, patchnote_lang))

        await self.bot.say("Cogs updated. Reload updated cogs? (yes/no)")
        answer = await self.bot.wait_for_message(timeout=15,
                                                 author=ctx.message.author)
        if answer is None:
            await self.bot.say("Ok then, you can reload cogs with"
                               " `{}reload <cog_name>`".format(ctx.prefix))
        elif answer.content.lower().strip() == "yes":
            registry = dataIO.load_json(os.path.join("data", "red", "cogs.json"))
            update_list = []
            fail_list = []
            for repo, cog, _ in installed_updated_cogs:
                if not registry.get('cogs.' + cog, False):
                    continue
                try:
                    self.bot.unload_extension("cogs." + cog)
                    self.bot.load_extension("cogs." + cog)
                    update_list.append(cog)
                except:
                    fail_list.append(cog)
            msg = 'Done.'
            if update_list:
                msg += " The following cogs were reloaded: "\
                    + ', '.join(update_list) + "\n"
            if fail_list:
                msg += " The following cogs failed to reload: "\
                    + ', '.join(fail_list)
            await self.bot.say(msg)

        else:
            await self.bot.say("Ok then, you can reload cogs with"
                               " `{}reload <cog_name>`".format(ctx.prefix))