55# PLease read the GNU Affero General Public License in
66# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
77
8- from random import randrange
8+ import base64
9+ from random import choice
910from re import compile as re_compile
1011from re import findall
1112from urllib .request import urlopen
2930
3031ofox_api = OrangeFoxAPI ()
3132
33+ api1 = base64 .b64decode ("QUl6YVN5QXlEQnNZM1dSdEI1WVBDNmFCX3c4SkF5NlpkWE5jNkZV" ).decode (
34+ "ascii"
35+ )
36+ api2 = base64 .b64decode ("QUl6YVN5QkYwenhMbFlsUE1wOXh3TVFxVktDUVJxOERnZHJMWHNn" ).decode (
37+ "ascii"
38+ )
39+ api3 = base64 .b64decode ("QUl6YVN5RGRPS253blB3VklRX2xiSDVzWUU0Rm9YakFLSVFWMERR" ).decode (
40+ "ascii"
41+ )
42+
3243
3344@in_pattern ("ofox" )
3445@in_owner
@@ -75,15 +86,13 @@ async def _(e):
7586 ],
7687 )
7788 )
78- await e .answer (fox )
89+ await e .answer (
90+ fox , switch_pm = "OrangeFox Recovery Search." , switch_pm_param = "start"
91+ )
7992 else :
80- sed = e .builder .article (
81- title = "Not Found" ,
82- description = "Wrong Codename" ,
83- text = "OʀᴀɴɢFᴏx Rᴇᴄᴏᴠᴇʀʏ Fᴏʀ Yᴏᴜʀ Pʜᴏɴᴇ Is Eɪᴛʜᴇʀ Nᴏᴛ Oғғɪᴄɪᴀʟʟʏ Bᴜɪʟᴛ Oʀ Yᴏᴜ Hᴀᴠᴇ Eɴᴛᴇʀᴇᴅ Wʀᴏɴɢ Cᴏᴅᴇɴᴀᴍᴇ" ,
84- buttons = Button .switch_inline ("Sᴇᴀʀᴄʜ Aɢᴀɪɴ" , query = "ofox " , same_peer = True ),
93+ await e .answer (
94+ [], switch_pm = "OrangeFox Recovery Search." , switch_pm_param = "start"
8595 )
86- await e .answer ([sed ])
8796
8897
8998@in_pattern ("fl2lnk ?(.*)" )
@@ -116,7 +125,7 @@ async def _(e):
116125 title = "fl2lnk" ,
117126 text = "File not found" ,
118127 )
119- await e .answer ([lnk ])
128+ await e .answer ([lnk ], switch_pm = "File to Link." , switch_pm_param = "start" )
120129
121130
122131@callback (
@@ -145,17 +154,17 @@ async def repo(e):
145154 thumb = wb (ultpic , 0 , "image/jpeg" , []),
146155 text = "• **ULTROID USERBOT** •" ,
147156 buttons = [
148- [Button .url ("Repo" , url = "https://github.com/TeamUltroid/Ultroid" )],
149157 [
158+ Button .url ("Repo" , url = "https://github.com/TeamUltroid/Ultroid" ),
150159 Button .url (
151160 "Addons" , url = "https://github.com/TeamUltroid/UltroidAddons"
152- )
161+ ),
153162 ],
154163 [Button .url ("Support" , url = "t.me/UltroidSupport" )],
155164 ],
156165 ),
157166 ]
158- await e .answer (res )
167+ await e .answer (res , switch_pm = "Ultroid Repo." , switch_pm_param = "start" )
159168
160169
161170@in_pattern ("go" )
@@ -164,13 +173,9 @@ async def gsearch(q_event):
164173 try :
165174 match = q_event .text .split (" " , maxsplit = 1 )[1 ]
166175 except IndexError :
167- kkkk = q_event .builder .article (
168- title = "Search Something" ,
169- thumb = wb (gugirl , 0 , "image/jpeg" , []),
170- text = "**Gᴏᴏɢʟᴇ Sᴇᴀʀᴄʜ**\n \n You didn't search anything" ,
171- buttons = Button .switch_inline ("Sᴇᴀʀᴄʜ Aɢᴀɪɴ" , query = "go " , same_peer = True ),
176+ await q_event .answer (
177+ [], switch_pm = "Google Search. Enter a query!" , switch_pm_param = "start"
172178 )
173- await q_event .answer ([kkkk ])
174179 searcher = []
175180 page = findall (r"page=\d+" , match )
176181 cache = False
@@ -216,7 +221,7 @@ async def gsearch(q_event):
216221 )
217222 except IndexError :
218223 break
219- await q_event .answer (searcher )
224+ await q_event .answer (searcher , switch_pm = "Google Search." , switch_pm_param = "start" )
220225
221226
222227@in_pattern ("rex" )
@@ -251,33 +256,29 @@ async def rextester(event):
251256 description = f"Language-`{ lang } ` & Code-`{ code } `" ,
252257 text = f"Language:\n `{ lang } `\n \n Code:\n `{ code } `\n \n Result:\n `{ outputt } `\n \n Stats:\n `{ stats } `" ,
253258 )
254- await event .answer ([resultm ])
259+ await event .answer (
260+ [resultm ], switch_pm = "RexTester." , switch_pm_param = "start"
261+ )
255262 except UnknownLanguage :
256263 resultm = builder .article (
257264 title = "Error" , # By @ProgrammingError
258265 description = "Invalid language choosen" ,
259266 text = f"The list of valid languages are\n \n { rex_langs } \n \n \n Format to use Rextester is `@Yourassistantusername rex langcode|code`" ,
260267 )
261- await event .answer ([resultm ])
268+ await event .answer (
269+ [resultm ], switch_pm = "RexTester. Invalid Language!" , switch_pm_param = "start"
270+ )
262271
263272
264273@in_pattern ("yahoo" )
265274@in_owner
266- async def gsearch (q_event ):
275+ async def yahoosearch (q_event ):
267276 try :
268277 match = q_event .text .split (" " , maxsplit = 1 )[1 ]
269278 except IndexError :
270- kkkk = q_event .builder .article (
271- title = "Search Something" ,
272- thumb = wb (yeah , 0 , "image/jpeg" , []),
273- text = "**Yᴀʜᴏᴏ Sᴇᴀʀᴄʜ**\n \n You didn't search anything" ,
274- buttons = Button .switch_inline (
275- "Sᴇᴀʀᴄʜ Aɢᴀɪɴ" ,
276- query = "yahoo " ,
277- same_peer = True ,
278- ),
279+ await q_event .answer (
280+ [], switch_pm = "Yahoo Search. Enter a query!" , switch_pm_param = "start"
279281 )
280- await q_event .answer ([kkkk ])
281282 searcher = []
282283 page = findall (r"page=\d+" , match )
283284 cache = False
@@ -323,7 +324,7 @@ async def gsearch(q_event):
323324 )
324325 except IndexError :
325326 break
326- await q_event .answer (searcher )
327+ await q_event .answer (searcher , switch_pm = "Yahoo Search." , switch_pm_param = "start" )
327328
328329
329330@in_pattern ("app" )
@@ -332,13 +333,9 @@ async def _(e):
332333 try :
333334 f = e .text .split (" " , maxsplit = 1 )[1 ]
334335 except IndexError :
335- kkkk = e .builder .article (
336- title = "Search Something" ,
337- thumb = wb (ps , 0 , "image/jpeg" , []),
338- text = "**Pʟᴀʏ Sᴛᴏʀᴇ**\n \n You didn't search anything" ,
339- buttons = Button .switch_inline ("Sᴇᴀʀᴄʜ Aɢᴀɪɴ" , query = "app " , same_peer = True ),
336+ await e .answer (
337+ [], switch_pm = "App search. Enter app name!" , switch_pm_param = "start"
340338 )
341- await e .answer ([kkkk ])
342339 foles = []
343340 aap = search (f )
344341 for z in aap :
@@ -377,7 +374,7 @@ async def _(e):
377374 ],
378375 ),
379376 )
380- await e .answer (foles )
377+ await e .answer (foles , switch_pm = "Application Searcher." , switch_pm_param = "start" )
381378
382379
383380@in_pattern ("mods" )
@@ -386,21 +383,12 @@ async def _(e):
386383 try :
387384 quer = e .text .split (" " , maxsplit = 1 )[1 ]
388385 except IndexError :
389- kkkk = e .builder .article (
390- title = "Search Something" ,
391- text = "**Mᴏᴅᴅᴇᴅ Aᴘᴘs**\n \n You didn't search anything" ,
392- buttons = Button .switch_inline ("Sᴇᴀʀᴄʜ Aɢᴀɪɴ" , query = "mods " , same_peer = True ),
386+ await e .answer (
387+ [], switch_pm = "Mod Apps Search. Enter app name!" , switch_pm_param = "start"
393388 )
394- await e .answer ([kkkk ])
395389 page = 1
396390 start = (page - 1 ) * 3 + 1
397- urd = randrange (1 , 3 )
398- if urd == 1 :
399- da = "AIzaSyAyDBsY3WRtB5YPC6aB_w8JAy6ZdXNc6FU"
400- if urd == 2 :
401- da = "AIzaSyBF0zxLlYlPMp9xwMQqVKCQRq8DgdrLXsg"
402- if urd == 3 :
403- da = "AIzaSyDdOKnwnPwVIQ_lbH5sYE4FoXjAKIQV0DQ"
391+ da = choice ([api1 , api2 , api3 ])
404392 url = f"https://www.googleapis.com/customsearch/v1?key={ da } &cx=25b3b50edb928435b&q={ quer } &start={ start } "
405393 data = requests .get (url ).json ()
406394 search_items = data .get ("items" )
@@ -435,7 +423,7 @@ async def _(e):
435423 ],
436424 ),
437425 )
438- await e .answer (modss )
426+ await e .answer (modss , switch_pm = "Search Mod Applications." , switch_pm_param = "start" )
439427
440428
441429@in_pattern ("clipart" )
@@ -444,16 +432,7 @@ async def clip(e):
444432 try :
445433 quer = e .text .split (" " , maxsplit = 1 )[1 ]
446434 except IndexError :
447- kkkk = e .builder .article (
448- title = "Search Something" ,
449- text = "**Cʟɪᴘᴀʀᴛ Sᴇᴀʀᴄʜ**\n \n You didn't search anything" ,
450- buttons = Button .switch_inline (
451- "Sᴇᴀʀᴄʜ Aɢᴀɪɴ" ,
452- query = "clipart " ,
453- same_peer = True ,
454- ),
455- )
456- await e .answer ([kkkk ])
435+ await e .answer ([], switch_pm = "ClipArt Search." , switch_pm_param = "start" )
457436 quer = quer .replace (" " , "+" )
458437 sear = f"https://clipartix.com/search/{ quer } "
459438 html = urlopen (sear )
@@ -463,4 +442,6 @@ async def clip(e):
463442 hm = []
464443 for res in resul :
465444 hm += [buil .photo (include_media = True , file = res ["src" ])]
466- await e .answer (hm , gallery = True )
445+ await e .answer (
446+ hm , gallery = True , switch_pm = "Clipart Searcher." , switch_pm_param = "start"
447+ )
0 commit comments