summaryrefslogtreecommitdiff
path: root/cogs/Lists.py
blob: 1aadd087a5e5243c2396537fc33094592ab844c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from discord.ext import commands
import discord
import re
import upsidedown
colours = {"default": 0,
           "teal": 0x1abc9c,
           "dark teal": 0x11806a,
           "green": 0x2ecc71,
           "dark green": 0x1f8b4c,
           "blue": 0x3498db,
           "dark blue": 0x206694,
           "purple": 0x9b59b6,
           "dark purple": 0x71368a,
           "magenta": 0xe91e63,
           "dark magenta": 0xad1457,
           "gold": 0xf1c40f,
           "dark gold": 0xc27c0e,
           "orange": 0xe67e22,
           "dark orange": 0xa84300,
           "red": 0xe74c3c,
           "dark red": 0x992d22,
           "lighter grey": 0x95a5a6,
           "dark grey": 0x607d8b,
           "light grey": 0x979c9f,
           "darker grey": 0x546e7a,
           "blurple": 0x7289da,
           "greyple": 0x99aab5}


class Flip(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        global extension_name
        extension_name = "[Flip] "

    @commands.command()
    async def flip(self, ctx, *, arg):
        """Release your anger and flip everything."""
        str_input_re = str(re.findall(r'@!?[0-9]{15,20}', arg))[3:-2]
        str_flip = "(╯°□°)╯︵ "

        arg = arg.replace("ǝuoʎɹǝʌǝ@", "ǝuoʎɹǝʌǝ").replace("ǝɹǝɥ@", "ǝɹǝɥ")

        if str_input_re == '':
            await ctx.message.channel.send(str_flip + upsidedown.transform(arg))

        elif str_input_re.startswith("!"):

            obj_member = ctx.message.guild.get_member(int(str_input_re[1:]))
            flipped_string = upsidedown.transform(str(obj_member.display_name))
            await ctx.message.channel.send(str_flip + flipped_string)

        else:
            flipped_string = upsidedown.transform(self.bot.get_user(int(str_input_re)).name)
            await ctx.message.channel.send(str_flip + flipped_string)


def setup(bot):
    print("INFO: Loading [Flip]... ", end="")
    bot.add_cog(Flip(bot))
    print("Done!")


def teardown(bot):
    print("INFO: Unloading [Flip]")