Karma commited on
Commit
f3b60db
·
1 Parent(s): 109951f

fun.py with vast cmds

Browse files
Files changed (1) hide show
  1. Mikobot/plugins/fun.py +257 -0
Mikobot/plugins/fun.py ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # <============================================== IMPORTS =========================================================>
2
+ import random
3
+
4
+ from pyjokes import get_joke
5
+ from telegram import Update
6
+ from telegram.constants import ParseMode
7
+ from telegram.ext import ContextTypes
8
+
9
+ import Mikobot.utils.fun_strings as fun_strings
10
+ from Mikobot import function
11
+ from Mikobot.events import register
12
+ from Mikobot.plugins.disable import DisableAbleCommandHandler
13
+ from Mikobot.state import state
14
+
15
+ # <=======================================================================================================>
16
+
17
+
18
+ # <================================================ FUNCTION =======================================================>
19
+ async def make_request(url: str) -> str:
20
+ response = await state.get(url)
21
+ response.raise_for_status()
22
+ return response.json()["question"]
23
+
24
+
25
+ async def truth(update: Update, context: ContextTypes.DEFAULT_TYPE):
26
+ truth_question = await make_request("https://api.truthordarebot.xyz/v1/truth")
27
+ await update.effective_message.reply_text(truth_question)
28
+
29
+
30
+ async def dare(update: Update, context: ContextTypes.DEFAULT_TYPE):
31
+ dare_question = await make_request("https://api.truthordarebot.xyz/v1/dare")
32
+ await update.effective_message.reply_text(dare_question)
33
+
34
+
35
+ @register(pattern="^/joke ?(.*)")
36
+ async def joke(event):
37
+ await event.reply(get_joke())
38
+
39
+
40
+ async def roll(update: Update, context: ContextTypes.DEFAULT_TYPE):
41
+ await update.message.reply_text(random.choice(range(1, 7)))
42
+
43
+
44
+ async def flirt(update: Update, context: ContextTypes.DEFAULT_TYPE):
45
+ args = context.args
46
+ await update.effective_message.reply_text(random.choice(fun_strings.FLIRT))
47
+
48
+
49
+ async def toss(update: Update, context: ContextTypes.DEFAULT_TYPE):
50
+ await update.message.reply_text(random.choice(fun_strings.TOSS))
51
+
52
+
53
+ async def shrug(update: Update, context: ContextTypes.DEFAULT_TYPE):
54
+ msg = update.effective_message
55
+ reply_text = (
56
+ msg.reply_to_message.reply_text if msg.reply_to_message else msg.reply_text
57
+ )
58
+ await reply_text(r"¯\_(ツ)_/¯")
59
+
60
+
61
+ async def bluetext(update: Update, context: ContextTypes.DEFAULT_TYPE):
62
+ msg = update.effective_message
63
+ reply_text = (
64
+ msg.reply_to_message.reply_text if msg.reply_to_message else msg.reply_text
65
+ )
66
+ await reply_text(
67
+ "/BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS"
68
+ )
69
+
70
+
71
+ async def rlg(update: Update, context: ContextTypes.DEFAULT_TYPE):
72
+ eyes = random.choice(fun_strings.EYES)
73
+ mouth = random.choice(fun_strings.MOUTHS)
74
+ ears = random.choice(fun_strings.EARS)
75
+
76
+ if len(eyes) == 2:
77
+ repl = ears[0] + eyes[0] + mouth[0] + eyes[1] + ears[1]
78
+ else:
79
+ repl = ears[0] + eyes[0] + mouth[0] + eyes[0] + ears[1]
80
+ await update.message.reply_text(repl)
81
+
82
+
83
+ async def decide(update: Update, context: ContextTypes.DEFAULT_TYPE):
84
+ reply_text = (
85
+ update.effective_message.reply_to_message.reply_text
86
+ if update.effective_message.reply_to_message
87
+ else update.effective_message.reply_text
88
+ )
89
+ await reply_text(random.choice(fun_strings.DECIDE))
90
+
91
+
92
+ normiefont = [
93
+ "a",
94
+ "b",
95
+ "c",
96
+ "d",
97
+ "e",
98
+ "f",
99
+ "g",
100
+ "h",
101
+ "i",
102
+ "j",
103
+ "k",
104
+ "l",
105
+ "m",
106
+ "n",
107
+ "o",
108
+ "p",
109
+ "q",
110
+ "r",
111
+ "s",
112
+ "t",
113
+ "u",
114
+ "v",
115
+ "w",
116
+ "x",
117
+ "y",
118
+ "z",
119
+ ]
120
+
121
+ weebyfont = [
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
+ async def webify(update: Update, context: ContextTypes.DEFAULT_TYPE):
152
+ args = context.args
153
+ message = update.effective_message
154
+ string = ""
155
+
156
+ if message.reply_to_message:
157
+ string = message.reply_to_message.text.lower().replace(" ", " ")
158
+
159
+ if args:
160
+ string = " ".join(args).lower()
161
+
162
+ if not string:
163
+ await message.reply_text(
164
+ "Usage is `/weebify <text>`", parse_mode=ParseMode.MARKDOWN
165
+ )
166
+ return
167
+
168
+ for normiecharacter in string:
169
+ if normiecharacter in normiefont:
170
+ weebycharacter = weebyfont[normiefont.index(normiecharacter)]
171
+ string = string.replace(normiecharacter, weebycharacter)
172
+
173
+ if message.reply_to_message:
174
+ await message.reply_to_message.reply_text(string)
175
+ else:
176
+ await message.reply_text(string)
177
+
178
+
179
+ # <=================================================== HELP ====================================================>
180
+
181
+
182
+ __help__ = """
183
+ » /cosplay: sends cosplay images.
184
+
185
+ » /decide: randomly answers yes/no/maybe.
186
+
187
+ » /truth: sends a random truth string.
188
+
189
+ » /dare: sends a random dare string.
190
+
191
+ » /toss: tosses a coin.
192
+
193
+ » /shrug: get shrug xd.
194
+
195
+ » /bluetext: check yourself :V.
196
+
197
+ �� /roll: roll a dice.
198
+
199
+ » /rlg: join ears, nose, mouth and create an emo ;-;
200
+
201
+ » /weebify <text>: returns a weebified text.
202
+
203
+ » /flirt <text>: returns a flirt text.
204
+
205
+ » /joke <text>: tells a random joke.
206
+ """
207
+
208
+ # <================================================ HANDLER =======================================================>
209
+ ROLL_HANDLER = DisableAbleCommandHandler("roll", roll, block=False)
210
+ TOSS_HANDLER = DisableAbleCommandHandler("toss", toss, block=False)
211
+ SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug, block=False)
212
+ BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext, block=False)
213
+ RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg, block=False)
214
+ DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide, block=False)
215
+ WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", webify, block=False)
216
+ FLIRT_HANDLER = DisableAbleCommandHandler("flirt", flirt, block=False)
217
+ TRUTH_HANDLER = DisableAbleCommandHandler("truth", truth, block=False)
218
+ DARE_HANDLER = DisableAbleCommandHandler("dare", dare, block=False)
219
+
220
+ function(WEEBIFY_HANDLER)
221
+ function(ROLL_HANDLER)
222
+ function(TOSS_HANDLER)
223
+ function(SHRUG_HANDLER)
224
+ function(BLUETEXT_HANDLER)
225
+ function(RLG_HANDLER)
226
+ function(DECIDE_HANDLER)
227
+ function(FLIRT_HANDLER)
228
+ function(TRUTH_HANDLER)
229
+ function(DARE_HANDLER)
230
+
231
+ __mod_name__ = "FUN"
232
+ __command_list__ = [
233
+ "roll",
234
+ "toss",
235
+ "shrug",
236
+ "bluetext",
237
+ "rlg",
238
+ "decide",
239
+ "cosplay",
240
+ "weebify",
241
+ "flirt",
242
+ "truth",
243
+ "dare",
244
+ ]
245
+ __handlers__ = [
246
+ ROLL_HANDLER,
247
+ TOSS_HANDLER,
248
+ SHRUG_HANDLER,
249
+ BLUETEXT_HANDLER,
250
+ RLG_HANDLER,
251
+ DECIDE_HANDLER,
252
+ WEEBIFY_HANDLER,
253
+ FLIRT_HANDLER,
254
+ TRUTH_HANDLER,
255
+ DARE_HANDLER,
256
+ ]
257
+ # <================================================ END =======================================================>