示例#1
0
    async def archive_command(self, ctx):
        """Archive a channel
        LIMITATIONS:
          message edited date is not preserved
          embeds not preserved
          threads not preserved
          cdns are only saved as links - if the channel is deleted, these links will stop working.
          message reactions
        """
        if not await self.bot.has_perm(ctx, owner_only=True, dm=False): return
        message = helpers.remove_invoke(ctx.message.content)
        channel = ctx.channel

        category = re.search(r"cat=(\d+)", message)
        target = re.search(r"target=(\d+)", message)
        output = re.search(r"output=(\d+)", message)

        output = await self.bot.fetch_channel(output.group(1)
                                              ) if output else channel

        if category:
            cat_channel = await self.bot.fetch_channel(category.group(1))
            for target in cat_channel.channels:
                if isinstance(target, discord.TextChannel):
                    await self.archive_channel(target, output)
        else:
            target = await self.bot.fetch_channel(target.group(1)
                                                  ) if target else channel
            await self.archive_channel(target, output)
示例#2
0
    async def make_uwu(self, ctx):
        if not await self.bot.has_perm(ctx, dm=True): return
        msg = helpers.remove_invoke(ctx.message.content).strip()
        if not msg:
            await ctx.send(
                "Youwu have to add a message in owdew to UwU-ify it >.<")
            return

        pos = 0
        while pos < len(msg):
            letter = msg[pos]

            if letter in "rl":
                msg = msg[:pos] + "w" + msg[pos + 1:]
                letter = "w"
            elif letter in "RL":
                msg = msg[:pos] + "W" + msg[pos + 1:]
                letter = "W"
            elif letter == " ":
                emote_to_add = self.uwu_faces.get_value()
                msg = msg[:pos] + emote_to_add + msg[pos + 1:]
                pos += len(emote_to_add) - 1

            if msg[pos - 1] == " ":
                chance = random.random()
                if letter.isalpha() and chance > 0.93:
                    msg = msg[:pos] + f"{letter}-{letter}" + msg[pos + 1:]

            pos += 1

        await ctx.send(msg[:2000])
示例#3
0
    async def make_archivist_say(self, ctx):
        if not await self.bot.has_perm(ctx, owner_only=True, dm=False): return
        content = helpers.remove_invoke(ctx.message.content)
        re_target = re.search(r"target=(\d+)", content)
        if re_target:
            target_channel = await self.bot.fetch_channel(re_target.group(1))
            content = content.replace(re_target.group(0), "")
        else:
            target_channel = ctx.channel

        await target_channel.send(content)
示例#4
0
    async def make_fullwidth(self, ctx):
        if not await self.bot.has_perm(ctx, dm=True): return
        msg = helpers.remove_invoke(ctx.message.content).strip()
        if not msg:
            await ctx.send("Can't big nothing :(")
            return

        alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-=()? "
        alphabet_big = "№йЂ№йѓ№йЃ№йё№йЁ№йє№йЄ№йѕ№йЅ№йі№йІ№йї№йЇ№йј№йЈ№йљ№йЉ№йњ№йЊ№йћ№йЋ№йќ№йЌ№йў№йЎ№йџ№╝А№╝б№╝Б№╝ц№╝Ц№╝д№╝Д№╝е№╝Е№╝ф№╝Ф№╝г№╝Г№╝«№╝»№╝░№╝▒№╝▓№╝│№╝┤№╝х№╝Х№╝и№╝И№╝╣№╝║№╝љ№╝Љ№╝њ№╝Њ№╝ћ№╝Ћ№╝ќ№╝Ќ№╝ў№╝Ў+№╝Ї№╝Ю№╝ѕ№╝Ѕ№╝Ъсђђ"
        superscript = str.maketrans(alphabet, alphabet_big)

        await ctx.send(msg.translate(superscript))
示例#5
0
    async def make_superscript(self, ctx):
        if not await self.bot.has_perm(ctx, dm=True): return
        msg = helpers.remove_invoke(ctx.message.content).strip()
        if not msg:
            await ctx.send("Can't superscript nothing :(")
            return

        alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-=()?"
        alphabet_superscript = "рхЃрхЄрХюрхѕрхЅрХархЇ╩░РЂ▒╩▓рхЈ╦АрхљРЂ┐рхњрхќq╩│╦брхЌрхўрхЏ╩и╦Б╩ИрХ╗р┤гр┤«Cр┤░р┤▒Fр┤│р┤┤р┤хр┤Хр┤ир┤Ир┤╣р┤║р┤╝р┤ЙQр┤┐SрхђрхЂР▒йрхѓрхАрхърХ╗РЂ░┬╣┬▓┬│РЂ┤РЂхРЂХРЂиРЂИРЂ╣РЂ║РЂ╗РЂ╝РЂйРЂЙ╦ђ"
        superscript = str.maketrans(alphabet, alphabet_superscript)

        await ctx.send(msg.translate(superscript))
示例#6
0
    async def dm_user(self, ctx):
        """
        DM a user. An excess of spaces should be placed between the user's ID and the content to send to them.
        Arguments:
            user: The user to send the ID to.
            content: What to send to them.
        Example:
            c.dm user=630930243464462346      you're really cool
        """
        if not await self.bot.has_perm(ctx, owner_only=True): return
        message = helpers.remove_invoke(ctx.message.content)
        message, uid = helpers.get_command_variable(message, "id")
        target = await self.bot.fetch_user(uid)

        await target.send(message)
示例#7
0
    async def owns_game(self, ctx):
        matches = []
        content = helpers.remove_invoke(ctx.message.content)
        search_term, target = helpers.get_command_variable(content, "uid", default=self.default_acc)
        
        for game_name in self.owned_games(self.api_key, target):
            if search_term in game_name.name.lower():
                matches.append(game_name)
        if not matches:
            await ctx.send("Sad day. No finds.")
            return

        pages = self.GameListPage.create_from_SteamGame(matches, search_term, target)

        first_page = pages[0].display(pages[0])
        m = await ctx.channel.send(embed=first_page)
        await self.bot.ReactiveMessageManager.create_reactive_message(m, pages[0].display, pages, users=[ctx.author.id])