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
|
from discord.ext import commands
import discord
import re
import upsidedown
import importlib
import utils
importlib.reload(utils)
class Flip(commands.Cog):
def __init__(self, bot):
self.bot = bot
global extension_name
extension_name = "[Flip] "
@commands.command(
aliases=[],
application_command_meta=commands.ApplicationCommandMeta(
options=[
discord.ApplicationCommandOption(
name="unflipped_thing",
description="Flip friends, family, small children, that dog next door. Everything.",
type=discord.ApplicationCommandOptionType.string,
required=True,
)
],
)
)
async def flip(self, ctx, unflipped_thing):
"""Flip friends, family, small children, that dog next door. Everything."""
# Check if flip is being used on a user
str_input_re = str(re.findall(r'@!?[0-9]{15,20}', unflipped_thing))[3:-2]
str_flip = "(╯°□°)╯︵ "
unflipped_thing = unflipped_thing.replace("ǝuoʎɹǝʌǝ@", "ǝuoʎɹǝʌǝ").replace("ǝɹǝɥ@", "ǝɹǝɥ")
if str_input_re == '':
await ctx.send(str_flip + upsidedown.transform(unflipped_thing))
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.send(str_flip + flipped_string)
else:
flipped_string = upsidedown.transform(self.bot.get_user(int(str_input_re)).name)
await ctx.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]")
|