File size: 7,336 Bytes
7956eb0
2fc8036
75c7fc1
eef97a7
 
ab8dff0
7956eb0
eef97a7
7956eb0
 
b002286
7956eb0
 
 
 
 
 
89c3556
7956eb0
 
 
 
 
 
 
 
 
 
 
 
0206afd
7956eb0
 
 
 
 
 
 
 
 
768892d
7956eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768892d
7956eb0
768892d
7956eb0
 
 
 
 
 
 
 
 
768892d
 
 
7956eb0
24a49ae
7956eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768892d
7956eb0
 
 
b002286
7956eb0
b002286
7956eb0
 
b002286
7956eb0
 
 
b002286
 
 
 
768892d
b002286
 
 
d8cd548
24a49ae
b002286
 
d20d100
b002286
d20d100
0a25134
79472bd
d20d100
 
b002286
 
d20d100
b002286
d20d100
0a25134
79472bd
d20d100
 
7956eb0
b002286
7956eb0
 
 
 
 
 
 
 
 
 
 
 
f8af1ca
7956eb0
 
 
 
 
 
 
 
768892d
7956eb0
 
 
 
 
 
 
768892d
7956eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89c3556
7956eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
b002286
89c3556
7956eb0
 
 
 
 
 
 
 
 
 
 
 
 
0872f6b
 
7956eb0
 
 
 
 
 
 
818d601
d76971a
809532c
d76971a
2707517
 
 
 
 
 
 
 
 
 
 
 
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
from html import escape
from random import choice
from pyrogram import enums
from Powers.utils import extras
from Powers.bot_class import Gojo
from pyrogram.types import Message
from Powers import LOGGER, DEV_USERS
from pyrogram.errors import MessageTooLong
from Powers.utils.custom_filters import command
from Powers.utils.extract_user import extract_user
from Powers.utils.extras import NOWYES as NO, YESWNO as YES


@Gojo.on_message(command("shout"))
async def fun_shout(_, m: Message):
    if len(m.text.split()) == 1:
        await m.reply_text(
            text="Please check help on how to use this this command.",
            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=enums.ParseMode.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(extras.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(extras.SLAP_GOJO_TEMPLATES)
    else:
        temp = choice(extras.SLAP_TEMPLATES)

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

    else:
        user1 = me.first_name
        user2 = curr_user

    item = choice(extras.ITEMS)
    hit = choice(extras.HIT)
    throw = choice(extras.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(extras.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 BaseException:
        return
    if user_id in DEV_USERS:
        await m.reply_text("Sorry! I can't insult my devs....")
        return LOGGER.info(
            f"{m.from_user.id} tried to insult {user_first_name} in {m.chat.id}"
        )
    else:
        Insult_omp = choice(extras.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("yes"))
async def yesw(c: Gojo, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    rtext = YES[0]
    await reply_text(rtext)
    LOGGER.info(f"{m.from_user.id} said YES or may be NO in {m.chat.id}")
    return


@Gojo.on_message(command("no"))
async def now(c: Gojo, m: Message):
    reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
    rtext = NO[0]
    await reply_text(rtext)
    LOGGER.info(f"{m.from_user.id} said NO or may be YES in {m.chat.id}")
    return


@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(extras.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(extras.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(text="What am I supposed to Weebify?")
        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(
        text=f"""<b>Weebified String:</b>
        <code>{string}</code>"""
    )
    LOGGER.info(f"{m.from_user.id} weebified '{args}' in {m.chat.id}")
    return


__PLUGIN__ = "fun"

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

__HELP__ = """
**Fun**

• /runs: reply a random string from an array of replies.
• /slap: slap a user, or get slapped if not a reply.
• /insult: to insult a user, or get insulted if not a reply
• /shrug : get shrug XD.
• /decide : Randomly answers yes/no/maybe
• /toss : Tosses A coin
• /yes : check urself :V
• /no : check urself :V
• /bluetext : check urself :V
• /roll : Roll a dice.
• /react : Random Reaction
• /shout `<keyword>`: write anything you want to give loud shout."""