File size: 6,036 Bytes
ca4eb6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
from html import escape
from secrets import choice
import random

from pyrogram.errors import MessageTooLong
from pyrogram.types import Message

from Powers import LOGGER, DEV_USERS
from Powers.bot_class import Gojo
from Powers.tr_engine import tlang
from Powers.utils import fun_strings
from Powers.utils.custom_filters import command
from Powers.utils.extract_user import extract_user



@Gojo.on_message(command("shout"))
async def fun_shout(_, m: Message):
    if len(m.text.split()) == 1:
        await m.reply_text(
            (tlang(m, "general.check_help")),
            quote=True,
        )
        return
    try:
        text = " ".join(m.text.split(None, 1)[1])
        result = [" ".join(list(text))]
        for pos, symbol in enumerate(text[1:]):
            result.append(symbol + " " + "  " * pos + symbol)
        result = list("\n".join(result))
        result[0] = text[0]
        result = "".join(result)
        msg = "```\n" + result + "```"
        await m.reply_text(msg, parse_mode="markdown")
        LOGGER.info(f"{m.from_user.id} shouted in {m.chat.id}")
        return
    except MessageTooLong as e:
        await m.reply_text(f"Error: {e}")
        return


@Gojo.on_message(command("runs"))
async def fun_run(_, m: Message):
    await m.reply_text(choice(fun_strings.RUN_STRINGS))
    LOGGER.info(f"{m.from_user.id} runed in {m.chat.id}")
    return


@Gojo.on_message(command("slap"))
async def fun_slap(c: Gojo, m: Message):
    me = await c.get_me()

    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text

    curr_user = escape(m.from_user.first_name)
    try:
        user_id, user_first_name, _ = await extract_user(c, m)
    except Exception:
        return

    if user_id == me.id:
        temp = choice(fun_strings.SLAP_GOJO_TEMPLATES)
    else:
        temp = choice(fun_strings.SLAP_TEMPLATES)

    if user_id:
        user1 = curr_user
        user2 = escape(user_first_name)

    else:
        user1 = me.first_name
        user2 = curr_user

    item = choice(fun_strings.ITEMS)
    hit = choice(fun_strings.HIT)
    throw = choice(fun_strings.THROW)

    reply = temp.format(user1=user1, user2=user2, item=item, hits=hit, throws=throw)
    await reply_text(reply)
    LOGGER.info(f"{m.from_user.id} slaped in {m.chat.id}")
    return


@Gojo.on_message(command("roll"))
async def fun_roll(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(choice(range(1, 7)))
    LOGGER.info(f"{m.from_user.id} roll in {m.chat.id}")
    return


@Gojo.on_message(command("toss"))
async def fun_toss(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(choice(fun_strings.TOSS))
    LOGGER.info(f"{m.from_user.id} tossed in {m.chat.id}")
    return

@Gojo.on_message(command("insult"))
async def insult(c : Gojo , m: Message):
    try:
        user_id, user_first_name, _ = await extract_user(c, m)
    except:
        return
    if user_id in DEV_USERS:
        await m.reply_text("Sorry! I can't insult my devs....")
    Insult_omp = random.choice(fun_strings.INSULT_STRINGS)
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(Insult_omp)
    LOGGER.info(f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")
    


@Gojo.on_message(command("shrug"))
async def fun_shrug(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(r"¯\_(ツ)_/¯")
    LOGGER.info(f"{m.from_user.id} shruged in {m.chat.id}")
    return


@Gojo.on_message(command("bluetext"))
async def fun_bluetext(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(
        "/BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS",
    )
    LOGGER.info(f"{m.from_user.id} bluetexted in {m.chat.id}")
    return


@Gojo.on_message(command("decide"))
async def fun_decide(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(choice(fun_strings.DECIDE))
    LOGGER.info(f"{m.from_user.id} decided in {m.chat.id}")
    return


@Gojo.on_message(command("react"))
async def fun_table(_, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    await reply_text(choice(fun_strings.REACTIONS))
    LOGGER.info(f"{m.from_user.id} reacted in {m.chat.id}")
    return


@Gojo.on_message(command("weebify"))
async def weebify(_, m: Message):
    if len(m.text.split()) >= 2:
        args = m.text.split(None, 1)[1]
    elif m.reply_to_message and len(m.text.split()) == 1:
        args = m.reply_to_message.text
    else:
        await m.reply_text(
            "Please reply to a message or enter text after command to weebify it.",
        )
        return
    if not args:
        await m.reply_text(tlang(m, "utils.weebify.weebify_what"))
        return

    # Use split to convert to list
    # Not using list itself becuase black changes it to long format...
    normiefont = "a b c d e f g h i j k l m n o p q r s t u v w x y z".split()
    weebyfont = "卂 乃 匚 刀 乇 下 厶 卄 工 丁 长 乚 从 𠘨 口 尸 㔿 尺 丂 丅 凵 リ 山 乂 丫 乙".split()

    string = "  ".join(args).lower()
    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
            string = string.replace(normiecharacter, weebycharacter)

    await m.reply_text(
        (tlang(m, "utils.weebify.weebified_string").format(string=string)),
    )
    LOGGER.info(f"{m.from_user.id} weebified '{args}' in {m.chat.id}")
    return


__PLUGIN__ = "fun"

_DISABLE_CMDS_ = [
    "weebify",
    "decide",
    "react",
    "bluetext",
    "toss",
    "roll",
    "slap",
    "runs",
    "shout",
    "insult",
    "shrug",
]