xditya Amit Sharma Danish xditya buddhhu New-dev0 1Danish-00 Sρι∂у sppidy Arnab Paryali Programming Error ArnabXD xditya ProgrammingError commited on
Commit
9d23611
·
1 Parent(s): 00d4510

Ultroid - v0.0.3

Browse files

* Ultroid - v0.0.3

Full Changelog - https://t.me/TheUltroid/21


Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Danish <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: buddhhu <[email protected]>
Co-authored-by: New-dev0 <[email protected]>
Co-authored-by: 1Danish-00 <[email protected]>
Co-authored-by: Sρι∂у <[email protected]>
Co-authored-by: sppidy <[email protected]>
Co-authored-by: Arnab Paryali <[email protected]>
Co-authored-by: Programming Error <[email protected]>
Co-authored-by: ArnabXD <[email protected]>
Co-authored-by: xditya <[email protected]>
Co-authored-by: ProgrammingError <[email protected]>

.gitignore CHANGED
@@ -10,4 +10,7 @@ BOT_TOKEN.session
10
  *.tgs
11
  logs-ultroid.txt
12
  .vscode/*
13
- ultroid-log.txt
 
 
 
 
10
  *.tgs
11
  logs-ultroid.txt
12
  .vscode/*
13
+ ultroid-log.txt
14
+ /*.jpg
15
+ /*.png
16
+ /*.mp4
README.md CHANGED
@@ -15,7 +15,7 @@ A stable pluggable Telegram userbot, based on Telethon.
15
  <details>
16
  <summary>More Info</summary>
17
  <br>
18
- <b>Documentation</b> - <a href="https://ultroid.netlify.app">ultroid.netlify.app</a> <br />
19
  </details>
20
 
21
  # Deploy
 
15
  <details>
16
  <summary>More Info</summary>
17
  <br>
18
+ <b>Documentation</b> - <a href="https://ultroid.tech">ultroid.tech</a> <br />
19
  </details>
20
 
21
  # Deploy
assistant/api_setter.py CHANGED
@@ -17,8 +17,9 @@ async def apiset(event):
17
  "Choose which API you want to set.",
18
  buttons=[
19
  [Button.inline("Remove.bg", data="rmbg")],
20
- [custom.Button.inline("« Back", data="setter")]
21
- ])
 
22
 
23
 
24
  # remove.bg api
 
17
  "Choose which API you want to set.",
18
  buttons=[
19
  [Button.inline("Remove.bg", data="rmbg")],
20
+ [custom.Button.inline("« Back", data="setter")],
21
+ ],
22
+ )
23
 
24
 
25
  # remove.bg api
assistant/customvars.py CHANGED
@@ -22,12 +22,12 @@ auth_url = r["auth_url"]
22
  @owner
23
  async def alvcs(event):
24
  await event.edit(
25
- "Customise your {}alive. Choose from the below options -".format(Var.HNDLR),
26
  buttons=[
27
- [Button.inline("Alive Text", data="alvtx")],
28
- [Button.inline("Alive Media", data="alvmed")],
29
- [Button.inline("Delete Alive Media", data="delmed")],
30
- [Button.inline("« Back", data="allcstms")]
31
  ],
32
  )
33
 
@@ -50,7 +50,11 @@ async def name(event):
50
  return await conv.send_message("Cancelled!!")
51
  else:
52
  await setit(event, var, themssg)
53
- await conv.send_message("{} changed to {}\n\nDo {}restart".format(name, themssg, Var.HNDLR))
 
 
 
 
54
 
55
 
56
  @callback("alvmed")
@@ -101,10 +105,11 @@ async def alvcs(event):
101
  await event.edit(
102
  "Customise your PMPERMIT Settings -",
103
  buttons=[
104
- [Button.inline("PM Text", data="pmtxt")],
105
- [Button.inline("Pm Media", data="pmmed")],
106
- [Button.inline("Delete PM Media", data="delpmmed")],
107
- [Button.inline("« Back", data="allcstms")]
 
108
  ],
109
  )
110
 
@@ -118,7 +123,7 @@ async def name(event):
118
  name = "PM Text"
119
  async with event.client.conversation(pru) as conv:
120
  await conv.send_message(
121
- "**PM Text**\nEnter the new Pmpermit text.\n\nUse /cancel to terminate the operation."
122
  )
123
  response = conv.wait_event(events.NewMessage(chats=pru))
124
  response = await response
@@ -127,7 +132,11 @@ async def name(event):
127
  return await conv.send_message("Cancelled!!")
128
  else:
129
  await setit(event, var, themssg)
130
- await conv.send_message("{} changed to {}\n\nDo {}restart".format(name, themssg, Var.HNDLR))
 
 
 
 
131
 
132
 
133
  @callback("pmmed")
@@ -139,7 +148,7 @@ async def media(event):
139
  name = "PM Media"
140
  async with event.client.conversation(pru) as conv:
141
  await conv.send_message(
142
- "**PM Media**\nSend me a pic/gif/bot api id of sticker to set as Pmpermit media.\n\nUse /cancel to terminate the operation."
143
  )
144
  response = await conv.get_response()
145
  try:
@@ -170,3 +179,64 @@ async def dell(event):
170
  return await event.edit("Done!")
171
  except BaseException:
172
  return await event.edit("Something went wrong...")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  @owner
23
  async def alvcs(event):
24
  await event.edit(
25
+ "Customise your {}alive. Choose from the below options -".format(HNDLR),
26
  buttons=[
27
+ [Button.inline("Aʟɪᴠᴇ Tᴇxᴛ", data="alvtx")],
28
+ [Button.inline("Aʟɪᴠᴇ ᴍᴇᴅɪᴀ", data="alvmed")],
29
+ [Button.inline("Dᴇʟᴇᴛᴇ Aʟɪᴠᴇ Mᴇᴅɪᴀ", data="delmed")],
30
+ [Button.inline("« Bᴀᴄᴋ", data="setter")],
31
  ],
32
  )
33
 
 
50
  return await conv.send_message("Cancelled!!")
51
  else:
52
  await setit(event, var, themssg)
53
+ await conv.send_message(
54
+ "{} changed to {}\n\nAfter Setting All Things Do restart".format(
55
+ name, themssg
56
+ )
57
+ )
58
 
59
 
60
  @callback("alvmed")
 
105
  await event.edit(
106
  "Customise your PMPERMIT Settings -",
107
  buttons=[
108
+ [Button.inline("Pᴍ Tᴇxᴛ", data="pmtxt")],
109
+ [Button.inline("Pᴍ Mᴇᴅɪᴀ", data="pmmed")],
110
+ [Button.inline("PMLOGGER", data="pml")],
111
+ [Button.inline("Dᴇʟᴇᴛᴇ Pᴍ Mᴇᴅɪᴀ", data="delpmmed")],
112
+ [Button.inline("« Bᴀᴄᴋ", data="pmset")],
113
  ],
114
  )
115
 
 
123
  name = "PM Text"
124
  async with event.client.conversation(pru) as conv:
125
  await conv.send_message(
126
+ "**PM Text**\nEnter the new Pmpermit text.\n\nu can use `{name}` `{fullname}` `{count}` `{mention}` `{username}` Too\n\nUse /cancel to terminate the operation."
127
  )
128
  response = conv.wait_event(events.NewMessage(chats=pru))
129
  response = await response
 
132
  return await conv.send_message("Cancelled!!")
133
  else:
134
  await setit(event, var, themssg)
135
+ await conv.send_message(
136
+ "{} changed to {}\n\nAfter Setting All Things Do restart".format(
137
+ name, themssg
138
+ )
139
+ )
140
 
141
 
142
  @callback("pmmed")
 
148
  name = "PM Media"
149
  async with event.client.conversation(pru) as conv:
150
  await conv.send_message(
151
+ "**PM Media**\nSend me a pic/gif/bot api id of sticker to set as pmpermit media.\n\nUse /cancel to terminate the operation."
152
  )
153
  response = await conv.get_response()
154
  try:
 
179
  return await event.edit("Done!")
180
  except BaseException:
181
  return await event.edit("Something went wrong...")
182
+
183
+
184
+ @callback("pml")
185
+ @owner
186
+ async def alvcs(event):
187
+ await event.edit(
188
+ "PMLOGGER This Will Forward Ur Pm to Ur Private Group -",
189
+ buttons=[
190
+ [Button.inline("PMLOGGER ON", data="pmlog")],
191
+ [Button.inline("PMLOGGER OFF", data="pmlogof")],
192
+ [Button.inline("« Bᴀᴄᴋ", data="pmcstm")],
193
+ ],
194
+ )
195
+
196
+
197
+ @callback("pmlog")
198
+ @owner
199
+ async def pmlog(event):
200
+ var = "PMLOG"
201
+ await setit(event, var, "True")
202
+ await event.edit(f"Done!! PMLOGGER Started!!")
203
+
204
+
205
+ @callback("pmlogof")
206
+ @owner
207
+ async def pmlogof(event):
208
+ try:
209
+ udB.delete("PMLOG")
210
+ return await event.edit("Done! PMLOGGER Stopped!!")
211
+ except BaseException:
212
+ return await event.edit("Something went wrong...")
213
+
214
+
215
+ @callback("pmset")
216
+ @owner
217
+ async def pmset(event):
218
+ await event.edit(
219
+ "PMPermit Settings:",
220
+ buttons=[
221
+ [Button.inline("Tᴜʀɴ PMPᴇʀᴍɪᴛ Oɴ", data="pmon")],
222
+ [Button.inline("Tᴜʀɴ PMPᴇʀᴍɪᴛ Oғғ", data="pmoff")],
223
+ [Button.inline("Cᴜsᴛᴏᴍɪᴢᴇ PMPᴇʀᴍɪᴛ", data="pmcstm")],
224
+ [Button.inline("« Bᴀᴄᴋ", data="setter")],
225
+ ],
226
+ )
227
+
228
+
229
+ @callback("pmon")
230
+ @owner
231
+ async def pmonn(event):
232
+ var = "PMSETTING"
233
+ await setit(event, var, "True")
234
+ await event.edit(f"Done! PMPermit has been turned on!!")
235
+
236
+
237
+ @callback("pmoff")
238
+ @owner
239
+ async def pmofff(event):
240
+ var = "PMSETTING"
241
+ await setit(event, var, "False")
242
+ await event.edit(f"Done! PMPermit has been turned off!!")
assistant/inlinestuff.py CHANGED
@@ -16,6 +16,8 @@ from search_engine_parser import GoogleSearch, YahooSearch
16
  from telethon import Button
17
  from telethon.tl.types import InputWebDocument as wb
18
 
 
 
19
  gugirl = "https://telegra.ph/file/0df54ae4541abca96aa11.jpg"
20
  yeah = "https://telegra.ph/file/e3c67885e16a194937516.jpg"
21
  ps = "https://telegra.ph/file/de0b8d9c858c62fae3b6e.jpg"
 
16
  from telethon import Button
17
  from telethon.tl.types import InputWebDocument as wb
18
 
19
+ from . import *
20
+
21
  gugirl = "https://telegra.ph/file/0df54ae4541abca96aa11.jpg"
22
  yeah = "https://telegra.ph/file/e3c67885e16a194937516.jpg"
23
  ps = "https://telegra.ph/file/de0b8d9c858c62fae3b6e.jpg"
assistant/othervars.py CHANGED
@@ -16,11 +16,65 @@ async def otvaar(event):
16
  await event.edit(
17
  "Other Variables to set for @TheUltroid:",
18
  buttons=[
19
- [Button.inline("Tag Logger", data="taglog")],
20
- [Button.inline("PM Permit", data="pmset")],
21
- [Button.inline("SuperFban", data="sfban")],
22
- [Button.inline("« Back", data="setter")]
23
- ])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
 
26
  @callback("taglog")
@@ -44,33 +98,70 @@ async def tagloggerr(event):
44
  await conv.send_message("{} changed to {}".format(name, themssg))
45
 
46
 
47
- @callback("pmset")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  @owner
49
  async def pmset(event):
50
  await event.edit(
51
- "PMPermit Settings:",
52
  buttons=[
53
- [Button.inline("Turn PMPermit On", data="pmon")],
54
- [Button.inline("Turn PMPermit Off", data="pmoff")],
55
- [Button.inline("« Back", data="otvars")]
56
  ],
57
  )
58
 
59
 
60
- @callback("pmon")
61
  @owner
62
- async def pmonn(event):
63
- var = "PMSETTING"
64
  await setit(event, var, "True")
65
- await event.edit(f"Done! PMPermit has been turned on!! Please `{hndlr}restart`")
 
 
66
 
67
 
68
- @callback("pmoff")
69
  @owner
70
- async def pmofff(event):
71
- var = "PMSETTING"
72
  await setit(event, var, "False")
73
- await event.edit(f"Done! PMPermit has been turned off!! Please `{hndlr}restart`")
 
 
74
 
75
 
76
  @callback("sfban")
@@ -79,9 +170,9 @@ async def sfban(event):
79
  await event.edit(
80
  "SuperFban Settings:",
81
  buttons=[
82
- [Button.inline("FBan Group", data="sfgrp")],
83
- [Button.inline("Exclude Feds", data="sfexf")],
84
- [Button.inline("« Back", data="otvars")]
85
  ],
86
  )
87
 
 
16
  await event.edit(
17
  "Other Variables to set for @TheUltroid:",
18
  buttons=[
19
+ [Button.inline("Tᴀɢ Lᴏɢɢᴇʀ", data="taglog")],
20
+ [Button.inline("SᴜᴘᴇʀFʙᴀɴ", data="sfban")],
21
+ [
22
+ Button.inline("Sᴜᴅᴏ Mᴏᴅᴇ", data="sudo"),
23
+ Button.inline("Hᴀɴᴅʟᴇʀ", data="hhndlr"),
24
+ ],
25
+ [
26
+ Button.inline("Exᴛʀᴀ Pʟᴜɢɪɴs", data="plg"),
27
+ Button.inline("Aᴅᴅᴏɴs", data="eaddon"),
28
+ ],
29
+ [Button.inline("« Bᴀᴄᴋ", data="setter")],
30
+ ],
31
+ )
32
+
33
+
34
+ @callback("plg")
35
+ @owner
36
+ async def pluginch(event):
37
+ await event.delete()
38
+ pru = event.sender_id
39
+ var = "PLUGIN_CHANNEL"
40
+ name = "Plugin Channel"
41
+ async with event.client.conversation(pru) as conv:
42
+ await conv.send_message(
43
+ "Send id or username of a channel from where u want to install all plugins\n\nOur Channel~ @ultroidplugins\n\nUse /cancel to cancel."
44
+ )
45
+ response = conv.wait_event(events.NewMessage(chats=pru))
46
+ response = await response
47
+ themssg = response.message.message
48
+ if themssg == "/cancel":
49
+ return await conv.send_message("Cancelled!!")
50
+ else:
51
+ await setit(event, var, themssg)
52
+ await conv.send_message(
53
+ "{} changed to {}\n After Setting All Things Do Restart".format(
54
+ name, themssg
55
+ )
56
+ )
57
+
58
+
59
+ @callback("hhndlr")
60
+ @owner
61
+ async def hndlrr(event):
62
+ await event.delete()
63
+ pru = event.sender_id
64
+ var = "HNDLR"
65
+ name = "Handler/ Trigger"
66
+ async with event.client.conversation(pru) as conv:
67
+ await conv.send_message(
68
+ f"Send The Symbol Which u want as Handler/Trigger to use bot\nUr Current Handler is [ `{HNDLR}` ]\n\n use /cancel to cancel."
69
+ )
70
+ response = conv.wait_event(events.NewMessage(chats=pru))
71
+ response = await response
72
+ themssg = response.message.message
73
+ if themssg == "/cancel":
74
+ return await conv.send_message("Cancelled!!")
75
+ else:
76
+ await setit(event, var, themssg)
77
+ await conv.send_message("{} changed to {}".format(name, themssg))
78
 
79
 
80
  @callback("taglog")
 
98
  await conv.send_message("{} changed to {}".format(name, themssg))
99
 
100
 
101
+ @callback("eaddon")
102
+ @owner
103
+ async def pmset(event):
104
+ await event.edit(
105
+ "ADDONS~ Extra Plugins:",
106
+ buttons=[
107
+ [Button.inline("Aᴅᴅᴏɴs Oɴ", data="edon")],
108
+ [Button.inline("Aᴅᴅᴏɴs Oғғ", data="edof")],
109
+ [Button.inline("« Bᴀᴄᴋ", data="otvars")],
110
+ ],
111
+ )
112
+
113
+
114
+ @callback("edon")
115
+ @owner
116
+ async def eddon(event):
117
+ var = "ADDONS"
118
+ await setit(event, var, "True")
119
+ await event.edit(
120
+ "Done! ADDONS has been turned on!!\n\n After Setting All Things Do Restart"
121
+ )
122
+
123
+
124
+ @callback("edof")
125
+ @owner
126
+ async def eddof(event):
127
+ var = "ADDONS"
128
+ await setit(event, var, "False")
129
+ await event.edit(
130
+ "Done! ADDONS has been turned off!! After Setting All Things Do Restart"
131
+ )
132
+
133
+
134
+ @callback("sudo")
135
  @owner
136
  async def pmset(event):
137
  await event.edit(
138
+ f"SUDO MODE ~ Some peoples can use ur Bot which u selected. To know More use `{HNDLR}help sudo`",
139
  buttons=[
140
+ [Button.inline("Sᴜᴅᴏ Mᴏᴅᴇ Oɴ", data="onsudo")],
141
+ [Button.inline("Sᴜᴅᴏ Mᴏᴅᴇ Oғғ", data="ofsudo")],
142
+ [Button.inline("« Bᴀᴄᴋ", data="otvars")],
143
  ],
144
  )
145
 
146
 
147
+ @callback("onsudo")
148
  @owner
149
+ async def eddon(event):
150
+ var = "SUDO"
151
  await setit(event, var, "True")
152
+ await event.edit(
153
+ "Done! SUDO MODE has been turned on!!\n\n After Setting All Things Do Restart"
154
+ )
155
 
156
 
157
+ @callback("ofsudo")
158
  @owner
159
+ async def eddof(event):
160
+ var = "SUDO"
161
  await setit(event, var, "False")
162
+ await event.edit(
163
+ "Done! SUDO MODE has been turned off!! After Setting All Things Do Restart"
164
+ )
165
 
166
 
167
  @callback("sfban")
 
170
  await event.edit(
171
  "SuperFban Settings:",
172
  buttons=[
173
+ [Button.inline("FBᴀɴ Gʀᴏᴜᴘ", data="sfgrp")],
174
+ [Button.inline("Exᴄʟᴜᴅᴇ Fᴇᴅs", data="sfexf")],
175
+ [Button.inline("« Bᴀᴄᴋ", data="otvars")],
176
  ],
177
  )
178
 
assistant/start.py CHANGED
@@ -27,7 +27,7 @@ async def assistant(event):
27
  f"Bot started by [{event.sender_id}](tg://user?id={event.sender_id})",
28
  )
29
  ok = ""
30
- if Var.MSG_FRWD is True:
31
  ok = "You can contact me using this bot!!"
32
  if event.is_private and event.sender_id in sed:
33
  return
@@ -46,12 +46,13 @@ async def ultroid(event):
46
  event.chat_id,
47
  f"Hi {OWNER_NAME}. Please browse through the options",
48
  buttons=[
49
- [Button.inline("Settings ⚙️", data="setter")],
50
- [Button.inline("Stats", data="stat")],
51
- [Button.inline("Broadcast", data="bcast")],
52
  ],
53
  )
54
 
 
55
  # aah, repeat the codes..
56
  @callback("mainmenu")
57
  @owner
@@ -61,12 +62,13 @@ async def ultroid(event):
61
  await event.edit(
62
  f"Hi {OWNER_NAME}. Please browse through the options",
63
  buttons=[
64
- [Button.inline("Settings ⚙️", data="setter")],
65
- [Button.inline("Stats", data="stat")],
66
- [Button.inline("Broadcast", data="bcast")],
67
  ],
68
  )
69
 
 
70
  @callback("stat")
71
  @owner
72
  async def botstat(event):
@@ -120,20 +122,12 @@ async def setting(event):
120
  await event.edit(
121
  "Choose from the below options -",
122
  buttons=[
123
- [Button.inline("Customisations", data="allcstms")],
124
- [Button.inline("API Keys", data="apiset")],
125
- [Button.inline("Other Vars.", data="otvars")],
126
- [Button.inline("« Back", data="mainmenu")]
 
 
 
127
  ],
128
  )
129
-
130
- @callback("allcstms")
131
- @owner
132
- async def all(event):
133
- await event.edit(
134
- "All Customisable Stuff.",
135
- buttons=[
136
- [Button.inline("Alive", data="alvcstm")],
137
- [Button.inline("PM Permit", data="pmcstm")],
138
- [Button.inline("« Back", data="setter")]
139
- ])
 
27
  f"Bot started by [{event.sender_id}](tg://user?id={event.sender_id})",
28
  )
29
  ok = ""
30
+ if udB.get("MSG_FRWD") == True:
31
  ok = "You can contact me using this bot!!"
32
  if event.is_private and event.sender_id in sed:
33
  return
 
46
  event.chat_id,
47
  f"Hi {OWNER_NAME}. Please browse through the options",
48
  buttons=[
49
+ [Button.inline("Sᴇᴛᴛɪɴɢs ⚙️", data="setter")],
50
+ [Button.inline("Sᴛᴀᴛs", data="stat")],
51
+ [Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ", data="bcast")],
52
  ],
53
  )
54
 
55
+
56
  # aah, repeat the codes..
57
  @callback("mainmenu")
58
  @owner
 
62
  await event.edit(
63
  f"Hi {OWNER_NAME}. Please browse through the options",
64
  buttons=[
65
+ [Button.inline("Sᴇᴛᴛɪɴɢs ⚙️", data="setter")],
66
+ [Button.inline("Sᴛᴀᴛs", data="stat")],
67
+ [Button.inline("Bʀᴏᴀᴅᴄᴀsᴛ", data="bcast")],
68
  ],
69
  )
70
 
71
+
72
  @callback("stat")
73
  @owner
74
  async def botstat(event):
 
122
  await event.edit(
123
  "Choose from the below options -",
124
  buttons=[
125
+ [Button.inline("API Kᴇʏs", data="apiset")],
126
+ [
127
+ Button.inline("Aʟɪᴠᴇ", data="alvcstm"),
128
+ Button.inline("PᴍPᴇʀᴍɪᴛ", data="pmset"),
129
+ ],
130
+ [Button.inline("Fᴇᴀᴛᴜʀᴇs", data="otvars")],
131
+ [Button.inline("« Bᴀᴄᴋ", data="mainmenu")],
132
  ],
133
  )
 
 
 
 
 
 
 
 
 
 
 
plugins/__init__.py CHANGED
@@ -8,52 +8,20 @@
8
  import time
9
 
10
  from pyUltroid import *
 
11
  from pyUltroid.dB.core import *
12
  from pyUltroid.functions import *
13
  from pyUltroid.functions.all import *
 
 
14
  from pyUltroid.functions.google_image import googleimagesdownload
15
  from pyUltroid.functions.sudos import *
16
  from pyUltroid.utils import *
17
 
18
  start_time = time.time()
19
- ultroid_version = "v0.0.1"
20
  OWNER_NAME = ultroid_bot.me.first_name
21
  OWNER_ID = ultroid_bot.me.id
22
- DEVLIST = [
23
- "1259468938",
24
- "1452145387",
25
- "719195224",
26
- "1318486004",
27
- "1289422521",
28
- "1322549723",
29
- "611816596",
30
- "1003250439",
31
- "1152902819",
32
- "716243352",
33
- "1444249738",
34
- "559661211",
35
- "881536550",
36
- "630654925",
37
- ]
38
-
39
- # sudo
40
- ok = udB.get("SUDOS")
41
- if ok:
42
- SUDO_USERS = set(int(x) for x in ok.split())
43
- else:
44
- SUDO_USERS = ""
45
-
46
- if SUDO_USERS:
47
- sudos = list(SUDO_USERS)
48
- else:
49
- sudos = ""
50
-
51
- on = Var.SUDO
52
-
53
- if Var.SUDO:
54
- sed = [ultroid_bot.uid, *sudos]
55
- else:
56
- sed = [ultroid_bot.uid]
57
 
58
 
59
  def grt(seconds: int) -> str:
 
8
  import time
9
 
10
  from pyUltroid import *
11
+ from pyUltroid.dB import *
12
  from pyUltroid.dB.core import *
13
  from pyUltroid.functions import *
14
  from pyUltroid.functions.all import *
15
+ from pyUltroid.functions.broadcast_db import *
16
+ from pyUltroid.functions.gban_mute_db import *
17
  from pyUltroid.functions.google_image import googleimagesdownload
18
  from pyUltroid.functions.sudos import *
19
  from pyUltroid.utils import *
20
 
21
  start_time = time.time()
22
+ ultroid_version = "v0.0.3"
23
  OWNER_NAME = ultroid_bot.me.first_name
24
  OWNER_ID = ultroid_bot.me.id
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
 
27
  def grt(seconds: int) -> str:
plugins/_help.py CHANGED
@@ -36,7 +36,7 @@ async def ult(ult):
36
  try:
37
  x = f"Plugin Name-{plug}\n\n✘ Commands Available-\n\n"
38
  for d in LIST[plug]:
39
- x += Var.HNDLR + d
40
  x += "\n"
41
  await eor(ult, x)
42
  except BaseException:
@@ -50,7 +50,7 @@ async def ult(ult):
50
  return await eor(
51
  ult,
52
  "`The bot did not respond to the inline query.\nConsider using {}restart`".format(
53
- Var.HNDLR
54
  ),
55
  )
56
  except dis:
 
36
  try:
37
  x = f"Plugin Name-{plug}\n\n✘ Commands Available-\n\n"
38
  for d in LIST[plug]:
39
+ x += HNDLR + d
40
  x += "\n"
41
  await eor(ult, x)
42
  except BaseException:
 
50
  return await eor(
51
  ult,
52
  "`The bot did not respond to the inline query.\nConsider using {}restart`".format(
53
+ HNDLR
54
  ),
55
  )
56
  except dis:
plugins/_inline.py CHANGED
@@ -31,8 +31,8 @@ helps = """
31
  Pʟᴜɢɪɴs ~ {}**
32
  """
33
 
34
-
35
- if Var.ADDONS:
36
  zhelps = """
37
  [Uʟᴛʀᴏɪᴅ Sᴜᴘᴘᴏʀᴛ](t.me/ultroidsupport)
38
 
@@ -48,7 +48,7 @@ else:
48
 
49
  Aᴅᴅᴏɴs ~ {}
50
 
51
- Gᴏ Aɴᴅ Aᴅᴅ ADDON Vᴀʀ Wɪᴛʜ Vᴀʟᴜᴇ Tʀᴜᴇ**
52
  """
53
  # ============================================#
54
 
@@ -60,7 +60,7 @@ async def e(o):
60
  b = o.builder
61
  uptime = grt((time.time() - start_time))
62
  ALIVEMSG = """
63
- **The Ultroid Userbot...**\n\n
64
  ✵ **Owner** - `{}`
65
  ✵ **Ultroid** - `{}`
66
  ✵ **UpTime** - `{}`
@@ -82,6 +82,14 @@ async def e(o):
82
  description="Userbot | Telethon ",
83
  text=ALIVEMSG,
84
  thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
 
 
 
 
 
 
 
 
85
  )
86
  ]
87
  await o.answer(res, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
@@ -96,19 +104,37 @@ if Var.BOT_USERNAME is not None and asst is not None:
96
  result = None
97
  query = event.text
98
  if event.query.user_id in sed and query.startswith("ultd"):
 
 
 
 
 
 
 
 
 
 
99
  result = builder.article(
100
  title="Help Menu",
101
  description="Help Menu - UserBot | Telethon ",
102
  url="https://t.me/TheUltroid",
103
  thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
104
- text=f"** Bᴏᴛ Oғ {OWNER_NAME}\n\nMᴀɪɴ Mᴇɴᴜ\n\nPʟᴜɢɪɴs ~ {len(PLUGINS) - 4}\nAᴅᴅᴏɴs ~ {len(ADDONS)}**",
105
  buttons=[
106
  [
107
  Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
108
  Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
109
  ],
110
- [Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr")],
111
- [Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone")],
 
 
 
 
 
 
 
 
112
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
113
  ],
114
  )
@@ -166,7 +192,7 @@ if Var.BOT_USERNAME is not None and asst is not None:
166
  [
167
  Button.switch_inline(
168
  "Sᴇɴᴅ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs",
169
- query="send all",
170
  same_peer=True,
171
  )
172
  ],
@@ -201,7 +227,7 @@ if Var.BOT_USERNAME is not None and asst is not None:
201
  [
202
  Button.switch_inline(
203
  "YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ",
204
- query="yt How to Deploy Ultroid Userbot",
205
  same_peer=True,
206
  )
207
  ],
@@ -310,17 +336,34 @@ if Var.BOT_USERNAME is not None and asst is not None:
310
  @callback("open")
311
  @owner
312
  async def opner(event):
 
 
 
 
 
313
  buttons = [
314
  [
315
  Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
316
  Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
317
  ],
318
- [Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr")],
319
- [Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone")],
 
 
 
 
 
 
 
320
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
321
  ]
 
 
 
 
 
322
  await event.edit(
323
- f"** Bᴏᴛ Oғ {OWNER_NAME}\n\nMᴀɪɴ Mᴇɴᴜ\n\nOꜰꜰɪᴄɪᴀʟ Pʟᴜɢɪɴs ~ {len(PLUGINS) - 4}\nUɴᴏꜰꜰɪᴄɪᴀʟ Pʟᴜɢɪɴs ~ {len(ADDONS)}**",
324
  buttons=buttons,
325
  link_preview=False,
326
  )
@@ -394,7 +437,7 @@ if Var.BOT_USERNAME is not None and asst is not None:
394
  f"Plugin Name-{plugin_name}\n\n✘ Commands Available-\n\n"
395
  )
396
  for d in LIST[plugin_name]:
397
- help_string += Var.HNDLR + d
398
  help_string += "\n"
399
  except BaseException:
400
  pass
@@ -423,8 +466,11 @@ if Var.BOT_USERNAME is not None and asst is not None:
423
  def paginate_help(page_number, loaded_plugins, prefix):
424
  number_of_rows = 5
425
  number_of_cols = 2
426
- multi = os.environ.get("EMOJI_TO_DESPLAY_IN_HELP", "✘")
427
- mult2i = os.environ.get("EMOJI2_TO_DESPLAY_IN_HELP", "✘")
 
 
 
428
  helpable_plugins = []
429
  global upage
430
  upage = page_number
@@ -470,8 +516,11 @@ def paginate_help(page_number, loaded_plugins, prefix):
470
  def paginate_addon(page_number, loaded_plugins, prefix):
471
  number_of_rows = 5
472
  number_of_cols = 2
473
- multi = os.environ.get("EMOJI_TO_DESPLAY_IN_HELP", "✘")
474
- mult2i = os.environ.get("EMOJI2_TO_DESPLAY_IN_HELP", "✘")
 
 
 
475
  helpable_plugins = []
476
  global addpage
477
  addpage = page_number
 
31
  Pʟᴜɢɪɴs ~ {}**
32
  """
33
 
34
+ add_ons = udB.get("ADDONS")
35
+ if add_ons:
36
  zhelps = """
37
  [Uʟᴛʀᴏɪᴅ Sᴜᴘᴘᴏʀᴛ](t.me/ultroidsupport)
38
 
 
48
 
49
  Aᴅᴅᴏɴs ~ {}
50
 
51
+ Gᴏ Aɴᴅ Aᴅᴅ ADDONS Vᴀʀ Wɪᴛʜ Vᴀʟᴜᴇ Tʀᴜᴇ**
52
  """
53
  # ============================================#
54
 
 
60
  b = o.builder
61
  uptime = grt((time.time() - start_time))
62
  ALIVEMSG = """
63
+ **The Ultroid Userbot...**\n
64
  ✵ **Owner** - `{}`
65
  ✵ **Ultroid** - `{}`
66
  ✵ **UpTime** - `{}`
 
82
  description="Userbot | Telethon ",
83
  text=ALIVEMSG,
84
  thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
85
+ buttons=[
86
+ [Button.url(text="Support Group", url="t.me/UltroidSupport")],
87
+ [
88
+ Button.url(
89
+ text="Repo", url="https://github.com/Teamultroid/Ultroid"
90
+ )
91
+ ],
92
+ ],
93
  )
94
  ]
95
  await o.answer(res, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
 
104
  result = None
105
  query = event.text
106
  if event.query.user_id in sed and query.startswith("ultd"):
107
+ z = []
108
+ for x in LIST.values():
109
+ for y in x:
110
+ z.append(y)
111
+ cmd = len(z) + 10
112
+ bn = Var.BOT_USERNAME
113
+ if bn.startswith("@"):
114
+ bnn = bn.replace("@", "")
115
+ else:
116
+ bnn = bn
117
  result = builder.article(
118
  title="Help Menu",
119
  description="Help Menu - UserBot | Telethon ",
120
  url="https://t.me/TheUltroid",
121
  thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
122
+ text=f"** Bᴏᴛ Oғ {OWNER_NAME}\n\nMᴀɪɴ Mᴇɴᴜ\n\nPʟᴜɢɪɴs ~ {len(PLUGINS) - 4}\nAᴅᴅᴏɴs ~ {len(ADDONS)}\nTᴏᴛᴀʟ Cᴏᴍᴍᴀɴᴅs ~ {cmd}**",
123
  buttons=[
124
  [
125
  Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
126
  Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
127
  ],
128
+ [
129
+ Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
130
+ Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
131
+ ],
132
+ [
133
+ Button.url(
134
+ "⚙️Sᴇᴛᴛɪɴɢs⚙️",
135
+ url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}",
136
+ )
137
+ ],
138
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
139
  ],
140
  )
 
192
  [
193
  Button.switch_inline(
194
  "Sᴇɴᴅ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs",
195
+ query="send",
196
  same_peer=True,
197
  )
198
  ],
 
227
  [
228
  Button.switch_inline(
229
  "YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ",
230
+ query="Ed Sheeran Perfect",
231
  same_peer=True,
232
  )
233
  ],
 
336
  @callback("open")
337
  @owner
338
  async def opner(event):
339
+ bn = Var.BOT_USERNAME
340
+ if bn.startswith("@"):
341
+ bnn = bn.replace("@", "")
342
+ else:
343
+ bnn = bn
344
  buttons = [
345
  [
346
  Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
347
  Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
348
  ],
349
+ [
350
+ Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr"),
351
+ Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
352
+ ],
353
+ [
354
+ Button.url(
355
+ "⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}"
356
+ )
357
+ ],
358
  [Button.inline("••Cʟᴏꜱᴇ••", data="close")],
359
  ]
360
+ z = []
361
+ for x in LIST.values():
362
+ for y in x:
363
+ z.append(y)
364
+ cmd = len(z) + 10
365
  await event.edit(
366
+ f"** Bᴏᴛ Oғ {OWNER_NAME}\n\nMᴀɪɴ Mᴇɴᴜ\n\nPʟᴜɢɪɴs ~ {len(PLUGINS) - 4}\nAᴅᴅᴏɴs ~ {len(ADDONS)}\nTᴏᴛᴀʟ Cᴏᴍᴍᴀɴᴅs ~ {cmd}**",
367
  buttons=buttons,
368
  link_preview=False,
369
  )
 
437
  f"Plugin Name-{plugin_name}\n\n✘ Commands Available-\n\n"
438
  )
439
  for d in LIST[plugin_name]:
440
+ help_string += HNDLR + d
441
  help_string += "\n"
442
  except BaseException:
443
  pass
 
466
  def paginate_help(page_number, loaded_plugins, prefix):
467
  number_of_rows = 5
468
  number_of_cols = 2
469
+ emoji = Redis("EMOJI_IN_HELP")
470
+ if emoji:
471
+ multi, mult2i = emoji, emoji
472
+ else:
473
+ multi, mult2i = "✘", "✘"
474
  helpable_plugins = []
475
  global upage
476
  upage = page_number
 
516
  def paginate_addon(page_number, loaded_plugins, prefix):
517
  number_of_rows = 5
518
  number_of_cols = 2
519
+ emoji = Redis("EMOJI_IN_HELP")
520
+ if emoji:
521
+ multi, mult2i = emoji, emoji
522
+ else:
523
+ multi, mult2i = "✘", "✘"
524
  helpable_plugins = []
525
  global addpage
526
  addpage = page_number
plugins/_wspr.py CHANGED
@@ -45,7 +45,7 @@ async def _(e):
45
  return await eor(
46
  e,
47
  "`The bot did not respond to the inline query.\nConsider using {}restart`".format(
48
- Var.HNDLR
49
  ),
50
  )
51
  except dis:
 
45
  return await eor(
46
  e,
47
  "`The bot did not respond to the inline query.\nConsider using {}restart`".format(
48
+ HNDLR
49
  ),
50
  )
51
  except dis:
plugins/admintools.py CHANGED
@@ -154,6 +154,8 @@ async def bban(ult):
154
  user, reason = await get_user_info(ult)
155
  if not user:
156
  return await xx.edit("`Reply to a user or give username to ban him!`")
 
 
157
  await xx.edit("`Getting user info...`")
158
  try:
159
  await ultroid_bot(
@@ -233,6 +235,13 @@ async def uunban(ult):
233
  groups_only=True,
234
  )
235
  async def kck(ult):
 
 
 
 
 
 
 
236
  xx = await eor(ult, "`Processing...`")
237
  chat = await ult.get_chat()
238
  isAdmin = chat.admin_rights
@@ -242,6 +251,8 @@ async def kck(ult):
242
  user, reason = await get_user_info(ult)
243
  if not user:
244
  return await xx.edit("`Kick? Whom? I couldn't get his info...`")
 
 
245
  await xx.edit("`Kicking...`")
246
  try:
247
  await ultroid_bot.kick_participant(ult.chat_id, user.id)
@@ -274,7 +285,7 @@ async def pin(msg):
274
  tt = msg.text
275
  try:
276
  kk = tt[4]
277
- if kk == "g":
278
  return
279
  except BaseException:
280
  pass
@@ -451,4 +462,4 @@ async def editer(edit):
451
  i = i + 1
452
 
453
 
454
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
154
  user, reason = await get_user_info(ult)
155
  if not user:
156
  return await xx.edit("`Reply to a user or give username to ban him!`")
157
+ if str(user.id) in DEVLIST:
158
+ return await xx.edit(" `LoL, I can't Ban my Developer 😂`")
159
  await xx.edit("`Getting user info...`")
160
  try:
161
  await ultroid_bot(
 
235
  groups_only=True,
236
  )
237
  async def kck(ult):
238
+ tt = ult.text
239
+ try:
240
+ tx = tt[5]
241
+ if tx:
242
+ return
243
+ except BaseException:
244
+ pass
245
  xx = await eor(ult, "`Processing...`")
246
  chat = await ult.get_chat()
247
  isAdmin = chat.admin_rights
 
251
  user, reason = await get_user_info(ult)
252
  if not user:
253
  return await xx.edit("`Kick? Whom? I couldn't get his info...`")
254
+ if str(user.id) in DEVLIST:
255
+ return await xx.edit(" `Lol, I can't Kick my Developer`😂")
256
  await xx.edit("`Kicking...`")
257
  try:
258
  await ultroid_bot.kick_participant(ult.chat_id, user.id)
 
285
  tt = msg.text
286
  try:
287
  kk = tt[4]
288
+ if kk:
289
  return
290
  except BaseException:
291
  pass
 
462
  i = i + 1
463
 
464
 
465
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/afk.py CHANGED
@@ -249,4 +249,4 @@ async def _(event):
249
  logger.warn(str(e))
250
 
251
 
252
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
249
  logger.warn(str(e))
250
 
251
 
252
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/autopic.py CHANGED
@@ -8,18 +8,14 @@
8
  """
9
  ✘ Commands Available -
10
 
11
- • `{i}autopic <topic>`
12
  Will change your profile pic at defined intervals with pics related to the given topic.
13
 
14
  """
15
  import asyncio
16
  import os
17
  import random
18
- import re
19
- import urllib
20
 
21
- from bs4 import BeautifulSoup as bs
22
- from requests import get
23
  from telethon import functions
24
 
25
  from . import *
@@ -33,7 +29,10 @@ async def autopic(e):
33
  clls = returnpage(search)
34
  if len(clls) == 0:
35
  return await eor(e, f"No Results found for `{search}`")
36
- num = random.randrange(0, len(clls) - 1)
 
 
 
37
  page = clls[num]
38
  title = page["title"]
39
  a = await eor(
@@ -47,4 +46,4 @@ async def autopic(e):
47
  await asyncio.sleep(1100)
48
 
49
 
50
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
8
  """
9
  ✘ Commands Available -
10
 
11
+ • `{i}autopic <search query>`
12
  Will change your profile pic at defined intervals with pics related to the given topic.
13
 
14
  """
15
  import asyncio
16
  import os
17
  import random
 
 
18
 
 
 
19
  from telethon import functions
20
 
21
  from . import *
 
29
  clls = returnpage(search)
30
  if len(clls) == 0:
31
  return await eor(e, f"No Results found for `{search}`")
32
+ if not len(clls) == 1:
33
+ num = random.randrange(0, len(clls) - 1)
34
+ else:
35
+ num = 0
36
  page = clls[num]
37
  title = page["title"]
38
  a = await eor(
 
46
  await asyncio.sleep(1100)
47
 
48
 
49
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/bot.py CHANGED
@@ -73,14 +73,14 @@ async def lol(ult):
73
 
74
  **{}**
75
 
76
- ┏━━━━━━━━━━━━━━━━━━━━━━
77
  ┣ **Owner** - `{}`
78
  ┣ **Version** - `{}`
79
  ┣ **UpTime** - `{}`
80
  ┣ **Python** - `{}`
81
  ┣ **Telethon** - `{}`
82
  ┣ **Branch** - `{}`
83
- ┗━━━━━━━━━━━━━━━━━━━━━━
84
  """.format(
85
  header,
86
  OWNER_NAME,
@@ -231,4 +231,4 @@ async def shht(event):
231
  await ultroid_bot.disconnect()
232
 
233
 
234
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
73
 
74
  **{}**
75
 
76
+ ┏━━━━━━━━━━━━━━━━━━━━━
77
  ┣ **Owner** - `{}`
78
  ┣ **Version** - `{}`
79
  ┣ **UpTime** - `{}`
80
  ┣ **Python** - `{}`
81
  ┣ **Telethon** - `{}`
82
  ┣ **Branch** - `{}`
83
+ ┗━━━━━━━━━━━━━━━━━━━━━
84
  """.format(
85
  header,
86
  OWNER_NAME,
 
231
  await ultroid_bot.disconnect()
232
 
233
 
234
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/broadcast.py ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ """
9
+ ✘ Commands Available
10
+
11
+ • `{i}add <id/reply to list/none>`
12
+ Add chat to database. Adds current chat if no id specified.
13
+
14
+ • `{i}rem <all/id/none>`
15
+ Removes the specified chat (current chat if none specified), or all chats.
16
+
17
+ • `{i}broadcast <reply to msg>`
18
+ Send the replied message to all chats in database.
19
+
20
+ • `{i}forward <reply to msg>`
21
+ Forward the message to all chats in database.
22
+
23
+ • `{i}listchannels`
24
+ To get list of all added chats.
25
+ """
26
+ import asyncio
27
+ import io
28
+
29
+ from . import *
30
+
31
+
32
+ @ultroid_cmd(pattern="add ?(.*)")
33
+ async def broadcast_adder(event):
34
+ if "addsudo" in event.text: # weird fix
35
+ return
36
+ msgg = event.pattern_match.group(1)
37
+ x = await eor(event, "`Adding to db...`")
38
+ aldone = new = crsh = 0
39
+ if msgg == "all":
40
+ await x.edit("`Trying to add all admin channels to db...`")
41
+ chats = [
42
+ e.entity
43
+ for e in await ultroid.get_dialogs()
44
+ if (e.is_group or e.is_channel)
45
+ ]
46
+ for i in chats:
47
+ try:
48
+ if i.broadcast:
49
+ if i.creator or i.admin_rights:
50
+ if is_channel_added(i.id):
51
+ aldone += 1
52
+ else:
53
+ cid = f"-100{i.id}"
54
+ add_channel(int(cid))
55
+ new += 1
56
+ except BaseException:
57
+ pass
58
+ await x.edit(
59
+ f"**Done.**\nChats already in Database: {get_no_channels()}\nNewly Added: {new}"
60
+ )
61
+ return
62
+ if event.reply_to_msg_id:
63
+ previous_message = await event.get_reply_message()
64
+ raw_text = previous_message.text
65
+ lines = raw_text.split("\n")
66
+ length = len(lines)
67
+ for line_number in range(1, length - 2):
68
+ channel_id = lines[line_number][4:-1]
69
+ if not is_channel_added(channel_id):
70
+ add_channel(channel_id)
71
+ await x.edit("Channels added!")
72
+ await asyncio.sleep(3)
73
+ await event.delete()
74
+ return
75
+ chat_id = event.chat_id
76
+ try:
77
+ if int(chat_id) == Var.LOG_CHANNEL:
78
+ return
79
+ except BaseException:
80
+ pass
81
+ if not is_channel_added(chat_id):
82
+ x = add_channel(chat_id)
83
+ if x:
84
+ await x.edit("`Added to database!`")
85
+ else:
86
+ await x.edit("Error")
87
+ await asyncio.sleep(3)
88
+ await event.delete()
89
+ elif is_channel_added(chat_id):
90
+ await x.edit("`Channel is already is database!`")
91
+ await asyncio.sleep(3)
92
+ await event.delete()
93
+
94
+
95
+ @ultroid_cmd(pattern="rem ?(.*)")
96
+ async def broadcast_remover(event):
97
+ chat_id = event.pattern_match.group(1)
98
+ x = await eor(event, "`Processing...`")
99
+ if chat_id == "all":
100
+ await x.edit("`Removing...`")
101
+ udB.delete("BROADCAST")
102
+ await x.edit("Database cleared.")
103
+ return
104
+ if is_channel_added(chat_id):
105
+ rem_channel(chat_id)
106
+ await x.edit("Removed from database")
107
+ await asyncio.sleep(3)
108
+ await x.delete()
109
+ elif is_channel_added(event.chat_id):
110
+ rem_channel(event.chat_id)
111
+ await x.edit("Removed from database")
112
+ await asyncio.sleep(3)
113
+ await x.delete()
114
+ elif not is_channel_added(event.chat_id):
115
+ await x.edit("Channel is already removed from database. ")
116
+ await asyncio.sleep(3)
117
+ await x.delete()
118
+
119
+
120
+ @ultroid_cmd(pattern="listchannels")
121
+ async def list_all(event):
122
+ x = await eor(event, "`Calculating...`")
123
+ channels = get_channels()
124
+ num = get_no_channels()
125
+ if num == 0:
126
+ return await eod(x, "No chats were added.", time=5)
127
+ msg = "Channels in database:\n"
128
+ for channel in channels:
129
+ name = ""
130
+ try:
131
+ name = (await ultroid.get_entity(int(channel))).title
132
+ except:
133
+ name = ""
134
+ msg += f"=> **{name}** [`{channel}`]\n"
135
+ msg += f"\nTotal {get_no_channels()} channels."
136
+ if len(msg) > 4096:
137
+ with io.BytesIO(str.encode(msg)) as out_file:
138
+ out_file.name = "channels.txt"
139
+ await ultroid_bot.send_file(
140
+ event.chat_id,
141
+ out_file,
142
+ force_document=True,
143
+ allow_cache=False,
144
+ caption="Channels in database",
145
+ reply_to=event,
146
+ )
147
+ await x.delete()
148
+ else:
149
+ await x.edit(msg)
150
+
151
+
152
+ @ultroid_cmd(pattern="forward ?(.*)")
153
+ async def forw(event):
154
+ if event.fwd_from:
155
+ return
156
+ if not event.is_reply:
157
+ await eor(event, "Reply to a message to broadcast.")
158
+ return
159
+ channels = get_channels()
160
+ x = await eor(event, "Sending...")
161
+ if get_no_channels() == 0:
162
+ return await x.edit(f"Please add channels by using `{hndlr}add` in them.")
163
+ error_count = 0
164
+ sent_count = 0
165
+ if event.reply_to_msg_id:
166
+ previous_message = await event.get_reply_message()
167
+ previous_message.message
168
+ previous_message.raw_text
169
+ error_count = 0
170
+ for channel in channels:
171
+ try:
172
+ await ultroid_bot.forward_messages(int(channel), previous_message)
173
+ sent_count += 1
174
+ await x.edit(
175
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
176
+ )
177
+ except Exception as error:
178
+ try:
179
+ await ultroid_bot.send_message(
180
+ Var.LOG_CHANNEL, f"Error in sending at {channel}."
181
+ )
182
+ await ultroid_bot.send_message(Var.LOG_CHANNEL, "Error! " + str(error))
183
+ if error == "The message cannot be empty unless a file is provided":
184
+ return await x.edit(
185
+ "For sending files, upload in Saved Messages and reply .forward to it."
186
+ )
187
+ except BaseException:
188
+ pass
189
+ error_count += 1
190
+ await x.edit(
191
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
192
+ )
193
+ await x.edit(f"{sent_count} messages sent with {error_count} errors.")
194
+ if error_count > 0:
195
+ try:
196
+ await ultroid_bot.send_message(Var.LOG_CHANNEL, f"{error_count} Errors")
197
+ except BaseException:
198
+ await x.edit("Set up log channel for checking errors.")
199
+
200
+
201
+ @ultroid_cmd(pattern="broadcast ?(.*)")
202
+ async def sending(event):
203
+ x = await eor(event, "`Processing...`")
204
+ if not event.is_reply:
205
+ return await x.edit("Reply to a message to broadcast.")
206
+ channels = get_channels()
207
+ error_count = 0
208
+ sent_count = 0
209
+ if len(channels) == 0:
210
+ return await x.edit(
211
+ f"You haven't added any channels. Use `{hndlr}add` in them fist!"
212
+ )
213
+ await x.edit("Sending....")
214
+ if event.reply_to_msg_id:
215
+ previous_message = await event.get_reply_message()
216
+ if previous_message.sticker or previous_message.poll:
217
+ await x.edit(f"Reply `{hndlr}forward` for stickers and polls.")
218
+ return
219
+ if (
220
+ previous_message.gif
221
+ or previous_message.audio
222
+ or previous_message.voice
223
+ or previous_message.video
224
+ or previous_message.video_note
225
+ or previous_message.contact
226
+ or previous_message.game
227
+ or previous_message.geo
228
+ or previous_message.invoice
229
+ ):
230
+ await x.edit(f"Not supported. Try `{hndlr}forward`")
231
+ return
232
+ if not previous_message.web_preview and previous_message.photo:
233
+ file = await ultroid_bot.download_file(previous_message.media)
234
+ uploaded_doc = await ultroid_bot.upload_file(file, file_name="img.png")
235
+ raw_text = previous_message.text
236
+ for channel in channels:
237
+ try:
238
+ if previous_message.photo:
239
+ await ultroid_bot.send_file(
240
+ int(channel),
241
+ InputMediaUploadedPhoto(file=uploaded_doc),
242
+ force_document=False,
243
+ caption=raw_text,
244
+ link_preview=False,
245
+ )
246
+
247
+ sent_count += 1
248
+ await x.edit(
249
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
250
+ )
251
+ except Exception as error:
252
+ try:
253
+ await ultroid_bot.send_message(
254
+ Var.LOG_CHANNEL, f"Error in sending at {channel}."
255
+ )
256
+ await ultroid_bot.send_message(
257
+ Var.LOG_CHANNEL, "Error! " + str(error)
258
+ )
259
+ if (
260
+ error
261
+ == "The message cannot be empty unless a file is provided"
262
+ ):
263
+ return await x.edit(
264
+ f"For sending files, upload in Saved Messages and reply {hndlr}forward to in."
265
+ )
266
+ except BaseException:
267
+ pass
268
+ error_count += 1
269
+ await x.edit(
270
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
271
+ )
272
+ await x.edit(f"{sent_count} messages sent with {error_count} errors.")
273
+ if error_count > 0:
274
+ try:
275
+ await ultroid_bot.send_message(
276
+ Var.LOG_CHANNEL, f"{error_count} Errors"
277
+ )
278
+ except BaseException:
279
+ pass
280
+ else:
281
+ raw_text = previous_message.text
282
+ for channel in channels:
283
+ try:
284
+ await ultroid_bot.send_message(
285
+ int(channel), raw_text, link_preview=False
286
+ )
287
+ sent_count += 1
288
+ await x.edit(
289
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
290
+ )
291
+ except Exception as error:
292
+ try:
293
+ await ultroid_bot.send_message(
294
+ Var.LOG_CHANNEL, f"Error in sending at {channel}."
295
+ )
296
+ await ultroid_bot.send_message(
297
+ Var.LOG_CHANNEL, "Error! " + str(error)
298
+ )
299
+ if (
300
+ error
301
+ == "The message cannot be empty unless a file is provided"
302
+ ):
303
+ return await x.edit(
304
+ f"For sending files, upload in Saved Messages and reply {hndlr}forward to in."
305
+ )
306
+ except BaseException:
307
+ pass
308
+ error_count += 1
309
+ await x.edit(
310
+ f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
311
+ )
312
+ await x.edit(f"{sent_count} messages sent with {error_count} errors.")
313
+ if error_count > 0:
314
+ try:
315
+ await ultroid_bot.send_message(
316
+ Var.LOG_CHANNEL, f"{error_count} Errors"
317
+ )
318
+ except BaseException:
319
+ await x.edit("Set up log channel for checking errors.")
plugins/carbon.py CHANGED
@@ -232,4 +232,4 @@ async def crbn(event):
232
  os.remove(xx)
233
 
234
 
235
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
232
  os.remove(xx)
233
 
234
 
235
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/chats.py CHANGED
@@ -114,4 +114,4 @@ async def _(e):
114
  await xx.edit(str(ex))
115
 
116
 
117
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
114
  await xx.edit(str(ex))
115
 
116
 
117
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/converter.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ """
9
+ ✘ Commands Available -
10
+
11
+ • `{i}rename <file name with extension>`
12
+ rename the file
13
+
14
+ • `{i}mtoi <reply to media>`
15
+ media to image conversion
16
+
17
+ • `{i}mtos <reply to media>`
18
+ convert media to sticker.
19
+ """
20
+
21
+ import os
22
+
23
+ import cv2
24
+ from PIL import Image
25
+
26
+ from . import *
27
+
28
+
29
+ @ultroid_cmd(pattern="rename ?(.*)")
30
+ async def imak(event):
31
+ reply = await event.get_reply_message()
32
+ if not reply:
33
+ await eor(event, "Reply to any media/Document.")
34
+ return
35
+ inp = event.pattern_match.group(1)
36
+ if not inp:
37
+ await eor(event, "Give The name nd extension of file")
38
+ return
39
+ xx = await eor(event, "`Processing...`")
40
+ image = await ultroid_bot.download_media(reply)
41
+ os.rename(image, inp)
42
+ await ultroid_bot.send_file(event.chat_id, inp, reply_to=reply)
43
+ os.remove(inp)
44
+ await xx.delete()
45
+
46
+
47
+ @ultroid_cmd(pattern="mtoi$")
48
+ async def imak(event):
49
+ reply = await event.get_reply_message()
50
+ if not (reply and (reply.media)):
51
+ await eor(event, "Reply to any media.")
52
+ return
53
+ xx = await eor(event, "`Processing...`")
54
+ image = await ultroid_bot.download_media(reply)
55
+ file = "ult.png"
56
+ if image.endswith((".webp", ".png")):
57
+ c = Image.open(image)
58
+ c.save(file)
59
+ else:
60
+ img = cv2.VideoCapture(image)
61
+ ult, roid = img.read()
62
+ cv2.imwrite(file, roid)
63
+ await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
64
+ await xx.delete()
65
+ os.remove(file)
66
+ os.remove(image)
67
+
68
+
69
+ @ultroid_cmd(pattern="mtos$")
70
+ async def smak(event):
71
+ reply = await event.get_reply_message()
72
+ if not (reply and (reply.media)):
73
+ await eor(event, "Reply to any media.")
74
+ return
75
+ xx = await eor(event, "`Processing...`")
76
+ image = await ultroid_bot.download_media(reply)
77
+ file = "ult.webp"
78
+ if image.endswith((".webp", ".png", ".jpg")):
79
+ c = Image.open(image)
80
+ c.save(file)
81
+ else:
82
+ img = cv2.VideoCapture(image)
83
+ ult, roid = img.read()
84
+ cv2.imwrite(file, roid)
85
+ await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
86
+ await xx.delete()
87
+ os.remove(file)
88
+ os.remove(image)
89
+
90
+
91
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/core.py CHANGED
@@ -119,8 +119,8 @@ async def unload(event):
119
  try:
120
  un_plug(shortname)
121
  await eod(event, f"**Uɴʟᴏᴀᴅᴇᴅ** `{shortname}` **Sᴜᴄᴄᴇssғᴜʟʟʏ.**", time=3)
122
- except BaseException:
123
- pass
124
  elif zym in lst:
125
  return await eod(event, "**Yᴏᴜ Cᴀɴ'ᴛ Uɴʟᴏᴀᴅ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs**", time=3)
126
  else:
@@ -143,8 +143,8 @@ async def uninstall(event):
143
  un_plug(shortname)
144
  await eod(event, f"**Uɴɪɴsᴛᴀʟʟᴇᴅ** `{shortname}` **Sᴜᴄᴄᴇssғᴜʟʟʏ.**", time=3)
145
  os.remove(f"addons/{shortname}.py")
146
- except BaseException:
147
- pass
148
  elif zym in lst:
149
  return await eod(event, "**Yᴏᴜ Cᴀɴ'ᴛ Uɴɪɴsᴛᴀʟʟ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs**", time=3)
150
  else:
@@ -174,4 +174,4 @@ async def load(event):
174
  )
175
 
176
 
177
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
119
  try:
120
  un_plug(shortname)
121
  await eod(event, f"**Uɴʟᴏᴀᴅᴇᴅ** `{shortname}` **Sᴜᴄᴄᴇssғᴜʟʟʏ.**", time=3)
122
+ except Exception as ex:
123
+ return await eor(event, str(ex))
124
  elif zym in lst:
125
  return await eod(event, "**Yᴏᴜ Cᴀɴ'ᴛ Uɴʟᴏᴀᴅ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs**", time=3)
126
  else:
 
143
  un_plug(shortname)
144
  await eod(event, f"**Uɴɪɴsᴛᴀʟʟᴇᴅ** `{shortname}` **Sᴜᴄᴄᴇssғᴜʟʟʏ.**", time=3)
145
  os.remove(f"addons/{shortname}.py")
146
+ except Exception as ex:
147
+ return await eor(event, str(ex))
148
  elif zym in lst:
149
  return await eod(event, "**Yᴏᴜ Cᴀɴ'ᴛ Uɴɪɴsᴛᴀʟʟ Oғғɪᴄɪᴀʟ Pʟᴜɢɪɴs**", time=3)
150
  else:
 
174
  )
175
 
176
 
177
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/fedutils.py CHANGED
@@ -25,7 +25,9 @@ Specify FBan Group and Feds to exclude in the assistant.
25
 
26
  import asyncio
27
  import os
 
28
  from telethon.errors.rpcerrorlist import YouBlockedUserError
 
29
  from . import *
30
 
31
  bot = "@MissRose_bot"
@@ -391,4 +393,4 @@ async def _(event):
391
  await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
392
 
393
 
394
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
25
 
26
  import asyncio
27
  import os
28
+
29
  from telethon.errors.rpcerrorlist import YouBlockedUserError
30
+
31
  from . import *
32
 
33
  bot = "@MissRose_bot"
 
393
  await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
394
 
395
 
396
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/gdrive.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+
9
+ """
10
+ ✘ Commands Available
11
+
12
+ • `{i}ulgdrive <reply/file name>`
13
+ Reply to file to upload on Google Drive.
14
+ Add file name to upload on Google Drive.
15
+
16
+ • `{i}drivesearch <file name>`
17
+ Search file name on Google Drive and get link.
18
+
19
+ • `{i}uldir <directory name>`
20
+ Upload a directory on Google Drive.
21
+
22
+ • `{i}gfolder`
23
+ Link to your Google Drive Folder.
24
+ If added then all uploaded files will be placed here.
25
+ """
26
+
27
+
28
+ import asyncio
29
+ import os
30
+ import time
31
+ from datetime import datetime
32
+
33
+ from telethon import events
34
+
35
+ from . import *
36
+
37
+ TOKEN_FILE = "resources/downloads/auth_token.txt"
38
+ TEMP_DOWNLOAD_DIRECTORY = "resources/downloads/"
39
+
40
+
41
+ @asst_cmd("auth")
42
+ async def aut(event):
43
+ if event.is_group:
44
+ return
45
+ if os.path.exists(TOKEN_FILE):
46
+ return await event.reply("`You have already authorised with Google Drive`")
47
+ if Redis("GDRIVE_CLIENT_ID") == None or Redis("GDRIVE_CLIENT_SECRET") == None:
48
+ await event.reply(
49
+ "Go [here](https://console.developers.google.com/flows/enableapi?apiid=drive) and get your GDRIVE_CLIENT_ID and GDRIVE_CLIENT_SECRET\n\n"
50
+ + "Send your GDRIVE_CLIENT_ID and GDRIVE_CLIENT_SECRET as this.\n`GDRIVE_CLIENT_ID GDRIVE_CLIENT_SECRET` separated by space.",
51
+ )
52
+ async with asst.conversation(ultroid_bot.uid) as conv:
53
+ reply = conv.wait_event(events.NewMessage(from_users=ultroid_bot.uid))
54
+ repl = await reply
55
+ try:
56
+ creds = repl.text.split(" ")
57
+ id = creds[0]
58
+ if not id.endswith("com"):
59
+ return await event.reply("`Wrong Client Id`")
60
+ try:
61
+ secret = creds[1]
62
+ except IndexError:
63
+ return await event.reply("`No Client Secret Found`")
64
+ udB.set("GDRIVE_CLIENT_ID", id)
65
+ udB.set("GDRIVE_CLIENT_SECRET", secret)
66
+ return await repl.reply("`Success!` Now send /auth again")
67
+ except Exception as exx:
68
+ return await repl.reply(
69
+ "`Something went wrong! Send `/auth` again.\nIf same happens contact `@TheUltroid"
70
+ )
71
+ else:
72
+ storage = await create_token_file(TOKEN_FILE, event)
73
+ http = authorize(TOKEN_FILE, storage)
74
+ f = open(TOKEN_FILE, "r")
75
+ token_file_data = f.read()
76
+ udB.set("GDRIVE_TOKEN", token_file_data)
77
+ await event.reply(
78
+ "`Success!\nYou are all set to use Google Drive with Ultroid Userbot.`"
79
+ )
80
+
81
+
82
+ @ultroid_cmd(
83
+ pattern="ulgdrive ?(.*)",
84
+ )
85
+ async def _(event):
86
+ mone = await eor(event, "Processing ...")
87
+ if not os.path.exists(TOKEN_FILE):
88
+ return await eod(mone, f"`Go to `{Var.BOT_USERNAME}` and send ``/auth.`")
89
+ input_str = event.pattern_match.group(1)
90
+ required_file_name = None
91
+ start = datetime.now()
92
+ dddd = time.time()
93
+ if event.reply_to_msg_id and not input_str:
94
+ reply_message = await event.get_reply_message()
95
+ try:
96
+ downloaded_file_name = await event.client.download_media(
97
+ reply_message,
98
+ TEMP_DOWNLOAD_DIRECTORY,
99
+ progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
100
+ progress(
101
+ d,
102
+ t,
103
+ mone,
104
+ dddd,
105
+ "Downloading...",
106
+ ),
107
+ ),
108
+ )
109
+ except Exception as e:
110
+ return await eod(mone, str(e), time=10)
111
+ end = datetime.now()
112
+ ms = (end - start).seconds
113
+ required_file_name = downloaded_file_name
114
+ await mone.edit(
115
+ "Downloaded to `{}` in {} seconds.".format(downloaded_file_name, ms)
116
+ )
117
+ elif input_str:
118
+ input_str = input_str.strip()
119
+ if os.path.exists(input_str):
120
+ end = datetime.now()
121
+ ms = (end - start).seconds
122
+ required_file_name = input_str
123
+ await mone.edit("Found `{}` in {} seconds.".format(input_str, ms))
124
+ else:
125
+ return await eod(
126
+ mone, "File Not found in local server. Give me a file path :((", time=5
127
+ )
128
+ if required_file_name:
129
+ http = authorize(TOKEN_FILE, None)
130
+ file_name, mime_type = file_ops(required_file_name)
131
+ try:
132
+ g_drive_link = await upload_file(
133
+ http,
134
+ required_file_name,
135
+ file_name,
136
+ mime_type,
137
+ mone,
138
+ Redis("GDRIVE_FOLDER_ID"),
139
+ )
140
+ await mone.edit(
141
+ "**Successfully Uploaded File on G-Drive :**\n\n[{}]({})".format(
142
+ file_name, g_drive_link
143
+ )
144
+ )
145
+ except Exception as e:
146
+ await mone.edit(f"Exception occurred while uploading to gDrive {e}")
147
+ else:
148
+ return await eod(mone, "`File Not found in local server.`", time=10)
149
+
150
+
151
+ @ultroid_cmd(
152
+ pattern="drivesearch ?(.*)",
153
+ )
154
+ async def sch(event):
155
+ if not os.path.exists(TOKEN_FILE):
156
+ return await eod(mone, f"`Go to `{Var.BOT_USERNAME}` and send ``/auth.`")
157
+ http = authorize(TOKEN_FILE, None)
158
+ input_str = event.pattern_match.group(1).strip()
159
+ a = await eor(event, "Searching for {} in G-Drive.".format(input_str))
160
+ if Redis("GDRIVE_FOLDER_ID") is not None:
161
+ query = "'{}' in parents and (title contains '{}')".format(
162
+ Redis("GDRIVE_FOLDER_ID"), input_str
163
+ )
164
+ else:
165
+ query = "title contains '{}'".format(input_str)
166
+ try:
167
+ msg = await gsearch(http, query, input_str)
168
+ return await a.edit(str(msg))
169
+ except Exception as ex:
170
+ return await a.edit(str(ex))
171
+
172
+
173
+ @ultroid_cmd(
174
+ pattern="uldir ?(.*)",
175
+ )
176
+ async def _(event):
177
+ if not os.path.exists(TOKEN_FILE):
178
+ return await eod(mone, f"`Go to `{Var.BOT_USERNAME}` and send ``/auth.`")
179
+ input_str = event.pattern_match.group(1)
180
+ if os.path.isdir(input_str):
181
+ http = authorize(TOKEN_FILE, None)
182
+ a = await eor(event, "Uploading `{}` to G-Drive...".format(input_str))
183
+ dir_id = await create_directory(
184
+ http,
185
+ os.path.basename(os.path.abspath(input_str)),
186
+ Redis("GDRIVE_FOLDER_ID"),
187
+ )
188
+ await DoTeskWithDir(http, input_str, event, dir_id)
189
+ dir_link = "https://drive.google.com/folderview?id={}".format(dir_id)
190
+ await eod(
191
+ a,
192
+ f"**Successfully Uploaded Folder To G-Drive...**\n[{input_str}]({dir_link})",
193
+ )
194
+ else:
195
+ return await eod(event, f"Directory {input_str} does not seem to exist", time=5)
196
+
197
+
198
+ @ultroid_cmd(
199
+ pattern="gfolder$",
200
+ )
201
+ async def _(event):
202
+ if Redis("GDRIVE_FOLDER_ID"):
203
+ folder_link = "https://drive.google.com/folderview?id=" + Redis(
204
+ "GDRIVE_FOLDER_ID"
205
+ )
206
+ await eod(event, "`Here is Your G-Drive Folder link : `\n" + folder_link)
207
+ else:
208
+ await eod(event, "Set GDRIVE_FOLDER_ID with value of your folder id")
209
+
210
+
211
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/github.py CHANGED
@@ -67,4 +67,4 @@ async def gitsearch(event):
67
  )
68
 
69
 
70
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
67
  )
68
 
69
 
70
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/globaltools.py ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ """
9
+ ✘ Commands Available -
10
+
11
+ • `{i}gban <reply user/ username>`
12
+ Globally Ban User.
13
+
14
+ • `{i}ungban <reply user/ username>`
15
+ Unban Globally.
16
+
17
+ • `{i}gmute <reply user/ username>`
18
+ Globally Mute the User.
19
+
20
+ • `{i}ungmute <reply user/ username>`
21
+ UnMute Globally.
22
+
23
+ • `{i}gkick <reply user/ username>`
24
+ Globally Kick User.
25
+
26
+ • `{i}gcast <Message>`
27
+ Globally Send that msg in all grps.
28
+ """
29
+
30
+ from telethon import events
31
+ from telethon.tl.functions.channels import EditBannedRequest
32
+ from telethon.tl.types import ChatBannedRights
33
+
34
+ from . import *
35
+
36
+
37
+ @ultroid_cmd(
38
+ pattern="ungban ?(.*)",
39
+ )
40
+ async def _(e):
41
+ xx = await eor(e, "`UnGbanning...`")
42
+ if e.is_private:
43
+ userid = (await e.get_chat()).id
44
+ elif e.reply_to_msg_id:
45
+ userid = (await e.get_reply_message()).sender_id
46
+ elif e.pattern_match.group(1):
47
+ if (e.pattern_match.group(1)).isdigit():
48
+ try:
49
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
50
+ except ValueError as err:
51
+ return await eod(xx, f"{str(err)}", time=5)
52
+ else:
53
+ try:
54
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
55
+ except ValueError as err:
56
+ return await eod(xx, f"{str(err)}", time=5)
57
+ else:
58
+ return await eod(xx, "`Reply to some msg or add their id.`", time=5)
59
+ name = (await e.client.get_entity(userid)).first_name
60
+ chats = 0
61
+ if not is_gbanned(userid):
62
+ return await eod(xx, "`User is not gbanned.`", time=3)
63
+ async for ggban in e.client.iter_dialogs():
64
+ if ggban.is_group or ggban.is_channel:
65
+ try:
66
+ await e.client.edit_permissions(ggban.id, userid, view_messages=True)
67
+ chats += 1
68
+ except:
69
+ pass
70
+ ungban(userid)
71
+ await xx.edit(
72
+ f"`Ungbanned` [{name}](tg://user?id={userid}) `in {chats} chats.\nRemoved from gbanwatch.`"
73
+ )
74
+
75
+
76
+ @ultroid_cmd(
77
+ pattern="gban ?(.*)",
78
+ )
79
+ async def _(e):
80
+ xx = await eor(e, "`Gbanning...`")
81
+ if e.is_private:
82
+ userid = (await e.get_chat()).id
83
+ elif e.reply_to_msg_id:
84
+ userid = (await e.get_reply_message()).sender_id
85
+ elif e.pattern_match.group(1):
86
+ if (e.pattern_match.group(1)).isdigit():
87
+ try:
88
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
89
+ except ValueError as err:
90
+ return await eod(xx, f"{str(err)}", time=5)
91
+ else:
92
+ try:
93
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
94
+ except ValueError as err:
95
+ return await eod(xx, f"{str(err)}", time=5)
96
+ else:
97
+ return await eod(xx, "`Reply to some msg or add their id.`", tome=5)
98
+ name = (await e.client.get_entity(userid)).first_name
99
+ chats = 0
100
+ if userid == ultroid_bot.uid:
101
+ return await eod(xx, "`I can't gban myself.`", time=3)
102
+ if str(userid) in DEVLIST:
103
+ return await eod(xx, "`I can't gban my Developers.`", time=3)
104
+ if str(userid) in (Redis("SUDOS")).split(" "):
105
+ return await eod(xx, "`I can't gban a sudo user.`", time=3)
106
+ if is_gbanned(userid):
107
+ return await eod(
108
+ xx, "`User is already gbanned and added to gbanwatch.`", time=4
109
+ )
110
+ async for ggban in e.client.iter_dialogs():
111
+ if ggban.is_group or ggban.is_channel:
112
+ try:
113
+ await e.client.edit_permissions(ggban.id, userid, view_messages=False)
114
+ chats += 1
115
+ except:
116
+ pass
117
+ gban(userid)
118
+ await xx.edit(
119
+ f"`Gbanned` [{name}](tg://user?id={userid}) `in {chats} chats.\nAdded to gbanwatch.`"
120
+ )
121
+
122
+
123
+ @ultroid_cmd(
124
+ pattern="gcast ?(.*)",
125
+ )
126
+ async def gcast(event):
127
+ xx = event.pattern_match.group(1)
128
+ if not xx:
129
+ return eor(event, "`Give some text to Globally Broadcast`")
130
+ tt = event.text
131
+ msg = tt[6:]
132
+ kk = await eor(event, "`Globally Broadcasting Msg...`")
133
+ er = 0
134
+ done = 0
135
+ async for x in ultroid_bot.iter_dialogs():
136
+ if x.is_group:
137
+ chat = x.id
138
+ try:
139
+ done += 1
140
+ await ultroid_bot.send_message(chat, msg)
141
+ except:
142
+ er += 1
143
+ pass
144
+ await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
145
+
146
+
147
+ @ultroid_cmd(
148
+ pattern="gkick ?(.*)",
149
+ )
150
+ async def gkick(e):
151
+ xx = await eor(e, "`Gkicking...`")
152
+ if e.is_private:
153
+ userid = (await e.get_chat()).id
154
+ elif e.reply_to_msg_id:
155
+ userid = (await e.get_reply_message()).sender_id
156
+ elif e.pattern_match.group(1):
157
+ if (e.pattern_match.group(1)).isdigit():
158
+ try:
159
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
160
+ except ValueError as err:
161
+ return await eod(xx, f"{str(err)}", time=5)
162
+ else:
163
+ try:
164
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
165
+ except ValueError as err:
166
+ return await eod(xx, f"{str(err)}", time=5)
167
+ else:
168
+ return await eod(xx, "`Reply to some msg or add their id.`", time=5)
169
+ name = (await e.client.get_entity(userid)).first_name
170
+ chats = 0
171
+ if userid == ultroid_bot.uid:
172
+ return await eod(xx, "`I can't gkick myself.`", time=3)
173
+ if str(userid) in DEVLIST:
174
+ return await eod(xx, "`I can't gkick my Developers.`", time=3)
175
+ if str(userid) in (Redis("SUDOS")).split(" "):
176
+ return await eod(xx, "`I can't gkick a sudo user.`", time=3)
177
+ async for gkick in e.client.iter_dialogs():
178
+ if gkick.is_group or gkick.is_channel:
179
+ try:
180
+ await ultroid_bot.kick_participant(gkick.id, userid)
181
+ chats += 1
182
+ except:
183
+ pass
184
+ await xx.edit(f"`Gkicked` [{name}](tg://user?id={userid}) `in {chats} chats.`")
185
+
186
+
187
+ @ultroid_cmd(
188
+ pattern="gmute ?(.*)",
189
+ )
190
+ async def _(e):
191
+ xx = await eor(e, "`Gmuting...`")
192
+ if e.is_private:
193
+ userid = (await e.get_chat()).id
194
+ elif e.reply_to_msg_id:
195
+ userid = (await e.get_reply_message()).sender_id
196
+ elif e.pattern_match.group(1):
197
+ if (e.pattern_match.group(1)).isdigit():
198
+ try:
199
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
200
+ except ValueError as err:
201
+ return await eod(xx, f"{str(err)}", time=5)
202
+ else:
203
+ try:
204
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
205
+ except ValueError as err:
206
+ return await eod(xx, f"{str(err)}", time=5)
207
+ else:
208
+ return await eod(xx, "`Reply to some msg or add their id.`", tome=5)
209
+ name = (await e.client.get_entity(userid)).first_name
210
+ chats = 0
211
+ if userid == ultroid_bot.uid:
212
+ return await eod(xx, "`I can't gmute myself.`", time=3)
213
+ if str(userid) in DEVLIST:
214
+ return await eod(xx, "`I can't gmute my Developers.`", time=3)
215
+ if is_gmuted(userid):
216
+ return await eod(xx, "`User is already gmuted.`", time=4)
217
+ async for onmute in e.client.iter_dialogs():
218
+ if onmute.is_group:
219
+ try:
220
+ await e.client(
221
+ EditBannedRequest(
222
+ onmute.id,
223
+ userid,
224
+ ChatBannedRights(until_date=None, send_messages=True),
225
+ )
226
+ )
227
+ chats += 1
228
+ except:
229
+ pass
230
+ gmute(userid)
231
+ await xx.edit(f"`Gmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
232
+
233
+
234
+ @ultroid_cmd(
235
+ pattern="ungmute ?(.*)",
236
+ )
237
+ async def _(e):
238
+ xx = await eor(e, "`UnGmuting...`")
239
+ if e.is_private:
240
+ userid = (await e.get_chat()).id
241
+ elif e.reply_to_msg_id:
242
+ userid = (await e.get_reply_message()).sender_id
243
+ elif e.pattern_match.group(1):
244
+ if (e.pattern_match.group(1)).isdigit():
245
+ try:
246
+ userid = (await e.client.get_entity(int(e.pattern_match.group(1)))).id
247
+ except ValueError as err:
248
+ return await eod(xx, f"{str(err)}", time=5)
249
+ else:
250
+ try:
251
+ userid = (await e.client.get_entity(str(e.pattern_match.group(1)))).id
252
+ except ValueError as err:
253
+ return await eod(xx, f"{str(err)}", time=5)
254
+ else:
255
+ return await eod(xx, "`Reply to some msg or add their id.`", time=5)
256
+ name = (await e.client.get_entity(userid)).first_name
257
+ chats = 0
258
+ if not is_gmuted(userid):
259
+ return await eod(xx, "`User is not gmuted.`", time=3)
260
+ async for hurr in e.client.iter_dialogs():
261
+ if hurr.is_group:
262
+ try:
263
+ await e.client(
264
+ EditBannedRequest(
265
+ hurr.id,
266
+ userid,
267
+ ChatBannedRights(until_date=None, send_messages=False),
268
+ )
269
+ )
270
+ chats += 1
271
+ except:
272
+ pass
273
+ ungmute(userid)
274
+ await xx.edit(f"`Ungmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
275
+
276
+
277
+ @ultroid_bot.on(events.ChatAction)
278
+ async def _(e):
279
+ if e.user_joined or e.added_by:
280
+ user = await e.get_user()
281
+ chat = await e.get_chat()
282
+ if is_gbanned(str(user.id)):
283
+ if chat.admin_rights:
284
+ try:
285
+ await e.client.edit_permissions(
286
+ chat.id, user.id, view_messages=False
287
+ )
288
+ gban_watch = f"`Gbanned User` [{user.first_name}](tg://user?id={user.id}) `Spotted\n"
289
+ gban_watch += f"Banned Successfully`"
290
+ except:
291
+ pass
292
+ else:
293
+ gban_watch = (
294
+ f"@admins `Gbanned user` [{user.first_name}]({user.id}) `Spotted.`"
295
+ )
296
+ await e.reply(gban_watch)
297
+
298
+
299
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/google.py CHANGED
@@ -117,4 +117,4 @@ async def reverse(event):
117
  os.remove(dl)
118
 
119
 
120
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
117
  os.remove(dl)
118
 
119
 
120
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/imagetools.py CHANGED
@@ -465,4 +465,4 @@ async def ultd(event):
465
  os.remove(ultt)
466
 
467
 
468
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
465
  os.remove(ultt)
466
 
467
 
468
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/mute.py CHANGED
@@ -214,4 +214,4 @@ async def _(e):
214
  await eod(xx, f"`{str(m)}`")
215
 
216
 
217
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
214
  await eod(xx, f"`{str(m)}`")
215
 
216
 
217
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/pdftools.py CHANGED
@@ -292,4 +292,4 @@ async def sendpdf(event):
292
  os.makedirs("pdf/")
293
 
294
 
295
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
292
  os.makedirs("pdf/")
293
 
294
 
295
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/pmpermit.py CHANGED
@@ -25,6 +25,7 @@ from pyUltroid.functions.pmpermit_db import *
25
  from telethon import events
26
  from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
27
  from telethon.tl.functions.messages import ReportSpamRequest
 
28
 
29
  from . import *
30
 
@@ -35,21 +36,20 @@ if Redis("PMPIC"):
35
  PMPIC = Redis("PMPIC")
36
  else:
37
  PMPIC = "https://telegra.ph/file/94f6a4aeb21ce2d58dd41.jpg"
 
38
  if not Redis("PM_TEXT"):
39
  UNAPPROVED_MSG = """
40
  **PMSecurity of {}!**
 
41
  Please wait for me to respnd or you will be blocked and reported as spam!!
42
 
43
  You have {}/{} warnings!"""
44
  else:
45
  UNAPPROVED_MSG = (
46
  """
47
- **PMSecurity of {}!**
48
-
49
- """
50
  f"""{Redis("PM_TEXT")}"""
51
  """
52
-
53
  Please wait for me to respnd or you will be blocked and reported as spam!!
54
 
55
  You have {}/{} warnings!"""
@@ -57,6 +57,7 @@ You have {}/{} warnings!"""
57
 
58
  UND = "Please wait for me to respnd or you will be blocked and reported as spam!!"
59
  UNS = "You were spamming my Master's PM, which I didn't like."
 
60
 
61
  WARNS = 3
62
  NO_REPLY = "Reply to someone's msg or try this commmand in private."
@@ -70,7 +71,18 @@ PMCMDS = [
70
  ]
71
  # =================================================================
72
 
73
- sett = udB.get("PMSETTING")
 
 
 
 
 
 
 
 
 
 
 
74
  if sett is None:
75
  sett = True
76
  if sett == "True" and sett != "False":
@@ -80,6 +92,8 @@ if sett == "True" and sett != "False":
80
  miss = await e.get_chat()
81
  if miss.bot or miss.is_self or miss.verified:
82
  return
 
 
83
  mssg = e.text
84
  if mssg in PMCMDS: # do not approve if outgoing is a command.
85
  return
@@ -94,7 +108,7 @@ if sett == "True" and sett != "False":
94
  name0 = str(name.first_name)
95
  await e.client.send_message(
96
  Var.LOG_CHANNEL,
97
- f"#AutoApproved\nUser - [{name0}](tg://user?id={e.chat_id})",
98
  )
99
 
100
  @ultroid_bot.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
@@ -102,8 +116,15 @@ if sett == "True" and sett != "False":
102
  user = await event.get_chat()
103
  if user.bot or user.is_self or user.verified:
104
  return
 
 
105
  apprv = is_approved(user.id)
106
  if not apprv and event.text != UND:
 
 
 
 
 
107
  try:
108
  wrn = COUNT_PM[user.id]
109
  except KeyError:
@@ -115,6 +136,7 @@ if sett == "True" and sett != "False":
115
  user.id, search=UND
116
  ):
117
  await message.delete()
 
118
  async for message in event.client.iter_messages(
119
  user.id, search=UNS
120
  ):
@@ -176,6 +198,10 @@ if sett == "True" and sett != "False":
176
  reply = await apprvpm.get_reply_message()
177
  replied_user = await apprvpm.client.get_entity(reply.sender_id)
178
  aname = replied_user.id
 
 
 
 
179
  name0 = str(replied_user.first_name)
180
  uid = replied_user.id
181
  if not is_approved(uid):
@@ -190,12 +216,17 @@ if sett == "True" and sett != "False":
190
  elif apprvpm.is_private:
191
  user = await apprvpm.get_chat()
192
  aname = await apprvpm.client.get_entity(user.id)
 
 
 
 
193
  name0 = str(aname.first_name)
194
  uid = user.id
195
  if not is_approved(uid):
196
  approve_user(uid)
197
  await apprvpm.edit(f"[{name0}](tg://user?id={uid}) `approved to PM!`")
198
  async for message in apprvpm.client.iter_messages(user.id, search=UND):
 
199
  await message.delete()
200
  async for message in apprvpm.client.iter_messages(user.id, search=UNS):
201
  await message.delete()
@@ -224,6 +255,10 @@ if sett == "True" and sett != "False":
224
  reply = await e.get_reply_message()
225
  replied_user = await e.client.get_entity(reply.sender_id)
226
  aname = replied_user.id
 
 
 
 
227
  name0 = str(replied_user.first_name)
228
  if is_approved(replied_user.id):
229
  disapprove_user(replied_user.id)
@@ -241,6 +276,10 @@ if sett == "True" and sett != "False":
241
  elif e.is_private:
242
  bbb = await e.get_chat()
243
  aname = await e.client.get_entity(bbb.id)
 
 
 
 
244
  name0 = str(aname.first_name)
245
  if is_approved(bbb.id):
246
  disapprove_user(bbb.id)
@@ -265,12 +304,20 @@ if sett == "True" and sett != "False":
265
  reply = await block.get_reply_message()
266
  replied_user = await block.client.get_entity(reply.sender_id)
267
  aname = replied_user.id
 
 
 
 
268
  name0 = str(replied_user.first_name)
269
  await block.client(BlockRequest(replied_user.id))
270
  await block.edit("`You've been blocked!`")
271
  uid = replied_user.id
272
  elif block.is_private:
273
  bbb = await block.get_chat()
 
 
 
 
274
  await block.client(BlockRequest(bbb.id))
275
  aname = await block.client.get_entity(bbb.id)
276
  await block.edit("`You've been blocked!`")
@@ -304,4 +351,4 @@ if sett == "True" and sett != "False":
304
  )
305
 
306
 
307
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
25
  from telethon import events
26
  from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
27
  from telethon.tl.functions.messages import ReportSpamRequest
28
+ from telethon.utils import get_display_name
29
 
30
  from . import *
31
 
 
36
  PMPIC = Redis("PMPIC")
37
  else:
38
  PMPIC = "https://telegra.ph/file/94f6a4aeb21ce2d58dd41.jpg"
39
+
40
  if not Redis("PM_TEXT"):
41
  UNAPPROVED_MSG = """
42
  **PMSecurity of {}!**
43
+
44
  Please wait for me to respnd or you will be blocked and reported as spam!!
45
 
46
  You have {}/{} warnings!"""
47
  else:
48
  UNAPPROVED_MSG = (
49
  """
50
+ **PMSecurity of {}!**"""
 
 
51
  f"""{Redis("PM_TEXT")}"""
52
  """
 
53
  Please wait for me to respnd or you will be blocked and reported as spam!!
54
 
55
  You have {}/{} warnings!"""
 
57
 
58
  UND = "Please wait for me to respnd or you will be blocked and reported as spam!!"
59
  UNS = "You were spamming my Master's PM, which I didn't like."
60
+ # 1
61
 
62
  WARNS = 3
63
  NO_REPLY = "Reply to someone's msg or try this commmand in private."
 
71
  ]
72
  # =================================================================
73
 
74
+
75
+ @ultroid_bot.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
76
+ async def permitpm(event):
77
+ user = await event.get_chat()
78
+ if user.bot or user.is_self:
79
+ return
80
+ apprv = is_approved(user.id)
81
+ if apprv and (Redis("PMLOG") == "True"):
82
+ await event.forward_to(Var.LOG_CHANNEL)
83
+
84
+
85
+ sett = Redis("PMSETTING")
86
  if sett is None:
87
  sett = True
88
  if sett == "True" and sett != "False":
 
92
  miss = await e.get_chat()
93
  if miss.bot or miss.is_self or miss.verified:
94
  return
95
+ if str(miss.id) in DEVLIST:
96
+ return
97
  mssg = e.text
98
  if mssg in PMCMDS: # do not approve if outgoing is a command.
99
  return
 
108
  name0 = str(name.first_name)
109
  await e.client.send_message(
110
  Var.LOG_CHANNEL,
111
+ f"#AutoApproved\nßecoz of outgoing msg\nUser - [{name0}](tg://user?id={e.chat_id})",
112
  )
113
 
114
  @ultroid_bot.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
 
116
  user = await event.get_chat()
117
  if user.bot or user.is_self or user.verified:
118
  return
119
+ if str(user.id) in DEVLIST:
120
+ return
121
  apprv = is_approved(user.id)
122
  if not apprv and event.text != UND:
123
+ name = user.first_name
124
+ fullname = (user.first_name, user.last_name)
125
+ username = user.username
126
+ mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
127
+ count = len(get_approved())
128
  try:
129
  wrn = COUNT_PM[user.id]
130
  except KeyError:
 
136
  user.id, search=UND
137
  ):
138
  await message.delete()
139
+
140
  async for message in event.client.iter_messages(
141
  user.id, search=UNS
142
  ):
 
198
  reply = await apprvpm.get_reply_message()
199
  replied_user = await apprvpm.client.get_entity(reply.sender_id)
200
  aname = replied_user.id
201
+ if str(aname) in DEVLIST:
202
+ return await eor(
203
+ apprvpm, "Lol, He is my Developer\nHe is auto Approved"
204
+ )
205
  name0 = str(replied_user.first_name)
206
  uid = replied_user.id
207
  if not is_approved(uid):
 
216
  elif apprvpm.is_private:
217
  user = await apprvpm.get_chat()
218
  aname = await apprvpm.client.get_entity(user.id)
219
+ if str(user.id) in DEVLIST:
220
+ return await eor(
221
+ apprvpm, "Lol, He is my Developer\nHe is auto Approved"
222
+ )
223
  name0 = str(aname.first_name)
224
  uid = user.id
225
  if not is_approved(uid):
226
  approve_user(uid)
227
  await apprvpm.edit(f"[{name0}](tg://user?id={uid}) `approved to PM!`")
228
  async for message in apprvpm.client.iter_messages(user.id, search=UND):
229
+
230
  await message.delete()
231
  async for message in apprvpm.client.iter_messages(user.id, search=UNS):
232
  await message.delete()
 
255
  reply = await e.get_reply_message()
256
  replied_user = await e.client.get_entity(reply.sender_id)
257
  aname = replied_user.id
258
+ if str(aname) in DEVLIST:
259
+ return await eor(
260
+ e, "`Lol, He is my Developer\nHe Can't Be DisApproved.`"
261
+ )
262
  name0 = str(replied_user.first_name)
263
  if is_approved(replied_user.id):
264
  disapprove_user(replied_user.id)
 
276
  elif e.is_private:
277
  bbb = await e.get_chat()
278
  aname = await e.client.get_entity(bbb.id)
279
+ if str(bbb.id) in DEVLIST:
280
+ return await eor(
281
+ e, "`Lol, He is my Developer\nHe Can't Be DisApproved.`"
282
+ )
283
  name0 = str(aname.first_name)
284
  if is_approved(bbb.id):
285
  disapprove_user(bbb.id)
 
304
  reply = await block.get_reply_message()
305
  replied_user = await block.client.get_entity(reply.sender_id)
306
  aname = replied_user.id
307
+ if str(aname) in DEVLIST:
308
+ return await eor(
309
+ block, "`Lol, He is my Developer\nHe Can't Be Blocked`"
310
+ )
311
  name0 = str(replied_user.first_name)
312
  await block.client(BlockRequest(replied_user.id))
313
  await block.edit("`You've been blocked!`")
314
  uid = replied_user.id
315
  elif block.is_private:
316
  bbb = await block.get_chat()
317
+ if str(bbb.id) in DEVLIST:
318
+ return await eor(
319
+ block, "`Lol, He is my Developer\nHe Can't Be Blocked`"
320
+ )
321
  await block.client(BlockRequest(bbb.id))
322
  aname = await block.client.get_entity(bbb.id)
323
  await block.edit("`You've been blocked!`")
 
351
  )
352
 
353
 
354
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/profile.py CHANGED
@@ -28,7 +28,8 @@ import asyncio
28
  import os
29
 
30
  from telethon.tl import functions
31
- from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest
 
32
  from telethon.tl.types import InputPhoto
33
 
34
  from . import *
@@ -160,4 +161,4 @@ async def gpoto(e):
160
  await eor(e, f"ERROR - {str(e)}")
161
 
162
 
163
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
28
  import os
29
 
30
  from telethon.tl import functions
31
+ from telethon.tl.functions.photos import (DeletePhotosRequest,
32
+ GetUserPhotosRequest)
33
  from telethon.tl.types import InputPhoto
34
 
35
  from . import *
 
161
  await eor(e, f"ERROR - {str(e)}")
162
 
163
 
164
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/redis.py CHANGED
@@ -8,6 +8,11 @@
8
  """
9
  ✘ Commands Available -
10
 
 
 
 
 
 
11
  • `{i}setredis key | value`
12
  Redis Set Value.
13
  e.g :
@@ -39,7 +44,7 @@ async def _(ult):
39
  ok = await eor(ult, "`...`")
40
  try:
41
  delim = " " if re.search("[|]", ult.pattern_match.group(1)) is None else " | "
42
- data = ult.pattern_match.group(1).split(delim)
43
  udB.set(data[0], data[1])
44
  redisdata = Redis(data[0])
45
  await ok.edit(
@@ -112,4 +117,18 @@ async def _(ult):
112
  await ok.edit("**List of Redis Keys :**\n{}".format(msg))
113
 
114
 
115
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  """
9
  ✘ Commands Available -
10
 
11
+ **DataBase Commands, do not use if you don't know what it is.**
12
+
13
+ • `{i}redisusage`
14
+ Check Storaged Data Capacity.
15
+
16
  • `{i}setredis key | value`
17
  Redis Set Value.
18
  e.g :
 
44
  ok = await eor(ult, "`...`")
45
  try:
46
  delim = " " if re.search("[|]", ult.pattern_match.group(1)) is None else " | "
47
+ data = ult.pattern_match.group(1).split(delim, maxsplit=1)
48
  udB.set(data[0], data[1])
49
  redisdata = Redis(data[0])
50
  await ok.edit(
 
117
  await ok.edit("**List of Redis Keys :**\n{}".format(msg))
118
 
119
 
120
+ @ultroid_cmd(
121
+ pattern="redisusage$",
122
+ )
123
+ async def _(ult):
124
+ ok = await eor(ult, "`Calculating ...`")
125
+ x = 30 * 1024 * 1024
126
+ z = 0
127
+ for n in udB.keys():
128
+ z += udB.memory_usage(n)
129
+ a = humanbytes(z) + "/" + humanbytes(x)
130
+ b = str(round(z / x * 100, 3)) + "%" + " Used"
131
+ await ok.edit(f"{a}\n{b}")
132
+
133
+
134
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/specialtools.py CHANGED
@@ -243,4 +243,4 @@ async def wall(event):
243
  await nn.delete()
244
 
245
 
246
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
243
  await nn.delete()
244
 
245
 
246
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/stickertools.py CHANGED
@@ -14,8 +14,8 @@
14
  • `{i}tiny <reply to media>`
15
  To create Tiny stickers.
16
 
17
- • `{i}convert <gif/img/sticker>`
18
- Reply to animated sticker.
19
 
20
  • `{i}kang <reply to image/sticker>`
21
  Kang the sticker (add to your pack).
@@ -39,12 +39,10 @@ from os import remove
39
  import cv2
40
  import numpy as np
41
  from PIL import Image, ImageDraw
42
- from telethon.errors import ChatSendInlineForbiddenError, ChatSendStickersForbiddenError
43
- from telethon.tl.types import (
44
- DocumentAttributeFilename,
45
- DocumentAttributeSticker,
46
- MessageMediaPhoto,
47
- )
48
 
49
  from . import *
50
 
@@ -108,19 +106,19 @@ async def waifu(animu):
108
  async def uconverter(event):
109
  xx = await eor(event, "`Processing...`")
110
  a = await event.get_reply_message()
 
 
 
111
  input = event.pattern_match.group(1)
112
  b = await event.client.download_media(a, "resources/downloads/")
113
  if "gif" in input:
114
  cmd = ["lottie_convert.py", b, "something.gif"]
115
  file = "something.gif"
116
- elif "sticker" in input:
117
- cmd = ["lottie_convert.py", b, "something.webp"]
118
- file = "something.webp"
119
  elif "img" in input:
120
  cmd = ["lottie_convert.py", b, "something.png"]
121
  file = "something.png"
122
  else:
123
- await xx.edit("**Please select from gif/sticker/img**")
124
  process = await asyncio.create_subprocess_exec(
125
  *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
126
  )
@@ -398,9 +396,12 @@ async def ultdround(event):
398
  )
399
  async def ultdestroy(event):
400
  ult = await event.get_reply_message()
401
- if not (ult and ("tgsticker" in ult.media.document.mime_type)):
402
- await eor(event, "`Reply to Animated Sticker Only...`")
403
- return
 
 
 
404
  roid = await event.client.download_media(ult, "ultroid.tgs")
405
  xx = await eor(event, "`Processing...`")
406
  os.system("lottie_convert.py ultroid.tgs json.json")
@@ -431,9 +432,7 @@ async def ultdestroy(event):
431
  reply_to=event.reply_to_msg_id,
432
  )
433
  await xx.delete()
434
- os.remove("ultroid.tgs")
435
  os.remove("json.json")
436
- os.remove(roid)
437
 
438
 
439
  @ultroid_cmd(
@@ -511,4 +510,4 @@ async def ultiny(event):
511
  os.remove(ik)
512
 
513
 
514
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
14
  • `{i}tiny <reply to media>`
15
  To create Tiny stickers.
16
 
17
+ • `{i}convert <gif/img>`
18
+ Reply to sticker to convert into gif or image.
19
 
20
  • `{i}kang <reply to image/sticker>`
21
  Kang the sticker (add to your pack).
 
39
  import cv2
40
  import numpy as np
41
  from PIL import Image, ImageDraw
42
+ from telethon.errors import (ChatSendInlineForbiddenError,
43
+ ChatSendStickersForbiddenError)
44
+ from telethon.tl.types import (DocumentAttributeFilename,
45
+ DocumentAttributeSticker, MessageMediaPhoto)
 
 
46
 
47
  from . import *
48
 
 
106
  async def uconverter(event):
107
  xx = await eor(event, "`Processing...`")
108
  a = await event.get_reply_message()
109
+ ok = ["image/webp", "application/x-tgsticker"]
110
+ if not (a.media and a.media.document and a.media.document.mime_type in ok):
111
+ return await eor(event, "`Reply to a Sticker...`")
112
  input = event.pattern_match.group(1)
113
  b = await event.client.download_media(a, "resources/downloads/")
114
  if "gif" in input:
115
  cmd = ["lottie_convert.py", b, "something.gif"]
116
  file = "something.gif"
 
 
 
117
  elif "img" in input:
118
  cmd = ["lottie_convert.py", b, "something.png"]
119
  file = "something.png"
120
  else:
121
+ return await xx.edit("**Please select from gif/img**")
122
  process = await asyncio.create_subprocess_exec(
123
  *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
124
  )
 
396
  )
397
  async def ultdestroy(event):
398
  ult = await event.get_reply_message()
399
+ if not event.is_reply:
400
+ return await eor(event, "`Reply to Animated Sticker Only...`")
401
+ if not (
402
+ ult.media and ult.media.document and "tgsticker" in ult.media.document.mime_type
403
+ ):
404
+ return await eor(event, "`Reply to Animated Sticker only`")
405
  roid = await event.client.download_media(ult, "ultroid.tgs")
406
  xx = await eor(event, "`Processing...`")
407
  os.system("lottie_convert.py ultroid.tgs json.json")
 
432
  reply_to=event.reply_to_msg_id,
433
  )
434
  await xx.delete()
 
435
  os.remove("json.json")
 
436
 
437
 
438
  @ultroid_cmd(
 
510
  os.remove(ik)
511
 
512
 
513
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/sudo.py CHANGED
@@ -29,8 +29,18 @@ from . import *
29
  pattern="addsudo ?(.*)",
30
  )
31
  async def _(ult):
 
 
 
 
 
 
 
 
 
 
 
32
  ok = await eor(ult, "`Updating SUDO Users List ...`")
33
-
34
  if ult.reply_to_msg_id:
35
  replied_to = await ult.get_reply_message()
36
  id = replied_to.sender.id
@@ -101,8 +111,18 @@ async def _(ult):
101
  pattern="delsudo ?(.*)",
102
  )
103
  async def _(ult):
 
 
 
 
 
 
 
 
 
 
 
104
  ok = await eor(ult, "`Updating SUDO Users List ...`")
105
-
106
  if ult.reply_to_msg_id:
107
  replied_to = await ult.get_reply_message()
108
  id = replied_to.sender.id
@@ -191,4 +211,4 @@ async def _(ult):
191
  return await ok.edit(f"**List of SUDO Users :**\n{msg}")
192
 
193
 
194
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
29
  pattern="addsudo ?(.*)",
30
  )
31
  async def _(ult):
32
+ if Var.BOT_MODE == True:
33
+ try:
34
+ if ult.sender_id != Var.OWNER_ID:
35
+ return await eor(
36
+ ult, "You are sudo user, You cant add other sudo user."
37
+ )
38
+ except BaseException:
39
+ pass
40
+ else:
41
+ if ult.sender_id != ultroid_bot.uid:
42
+ return await eor(ult, "You are sudo user, You cant add other sudo user.")
43
  ok = await eor(ult, "`Updating SUDO Users List ...`")
 
44
  if ult.reply_to_msg_id:
45
  replied_to = await ult.get_reply_message()
46
  id = replied_to.sender.id
 
111
  pattern="delsudo ?(.*)",
112
  )
113
  async def _(ult):
114
+ if Var.BOT_MODE == True:
115
+ try:
116
+ if ult.sender_id != Var.OWNER_ID:
117
+ return await eor(
118
+ ult, "You are sudo user, You cant add other sudo user."
119
+ )
120
+ except BaseException:
121
+ pass
122
+ else:
123
+ if ult.sender_id != ultroid_bot.uid:
124
+ return await eor(ult, "You are sudo user, You cant add other sudo user.")
125
  ok = await eor(ult, "`Updating SUDO Users List ...`")
 
126
  if ult.reply_to_msg_id:
127
  replied_to = await ult.get_reply_message()
128
  id = replied_to.sender.id
 
211
  return await ok.edit(f"**List of SUDO Users :**\n{msg}")
212
 
213
 
214
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/tag.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultroid - UserBot
2
+ # Copyright (C) 2020 TeamUltroid
3
+ #
4
+ # This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
5
+ # PLease read the GNU Affero General Public License in
6
+ # <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
7
+
8
+ """
9
+ ✘ Commands Available -
10
+
11
+ • `{i}tagall`
12
+ Tag Top 100 Members of chat.
13
+
14
+ • `{i}tagadmins`
15
+ Tag Admins of that chat.
16
+
17
+ • `{i}tagowner`
18
+ Tag Owner of that chat
19
+
20
+ • `{i}tagbots`
21
+ Tag Bots of that chat.
22
+
23
+ • `{i}tagrec`
24
+ Tag recently Active Members.
25
+
26
+ • `{i}tagon`
27
+ Tag online Members(work only if privacy off).
28
+
29
+ • `{i}tagoff`
30
+ Tag Offline Members(work only if privacy off).
31
+ """
32
+
33
+ from telethon.tl.types import ChannelParticipantAdmin as admin
34
+ from telethon.tl.types import ChannelParticipantCreator as owner
35
+ from telethon.tl.types import UserStatusOffline as off
36
+ from telethon.tl.types import UserStatusOnline as onn
37
+ from telethon.tl.types import UserStatusRecently as rec
38
+ from telethon.utils import get_display_name
39
+
40
+ from . import *
41
+
42
+
43
+ @ultroid_cmd(
44
+ pattern="tag(on|off|all|bots|rec|admins|owner)?(.*)",
45
+ groups_only=True,
46
+ )
47
+ async def _(e):
48
+ okk = e.text
49
+ lll = e.pattern_match.group(2)
50
+ users = 0
51
+ o = 0
52
+ nn = 0
53
+ rece = 0
54
+ if lll:
55
+ xx = f"{lll}"
56
+ else:
57
+ xx = ""
58
+ async for bb in e.client.iter_participants(e.chat_id, 99):
59
+ users = users + 1
60
+ x = bb.status
61
+ y = bb.participant
62
+ if isinstance(x, onn):
63
+ o = o + 1
64
+ if "on" in okk:
65
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
66
+ if isinstance(x, off):
67
+ nn = nn + 1
68
+ if "off" in okk:
69
+ if not (bb.bot or bb.deleted):
70
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
71
+ if isinstance(x, rec):
72
+ rece = rece + 1
73
+ if "rec" in okk:
74
+ if not (bb.bot or bb.deleted):
75
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
76
+ if isinstance(y, owner):
77
+ if "admin" or "owner" in okk:
78
+ xx += f"\n꧁[{get_display_name(bb)}](tg://user?id={bb.id})꧂"
79
+ if isinstance(y, admin):
80
+ if "admin" in okk:
81
+ if not bb.deleted:
82
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
83
+ if "all" in okk:
84
+ if not (bb.bot or bb.deleted):
85
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
86
+ if "bot" in okk:
87
+ if bb.bot:
88
+ xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
89
+ if len(xx) > 4096:
90
+ await eor(e, "`Telegram Word Limits Exceeds...`")
91
+ else:
92
+ await e.client.send_message(e.chat_id, xx)
93
+ await e.delete()
94
+
95
+
96
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/tools.py CHANGED
@@ -244,10 +244,10 @@ async def _(e):
244
  pattern="bash",
245
  )
246
  async def _(event):
247
- if (Var.I_DEV if Var.I_DEV else Redis("I_DEV")) != "True":
248
  await eor(
249
  event,
250
- "Developer Restricted!\nIf you know what this does, and want to proceed\n\n set var `I_DEV` as `True`\n\nThis Might Be Dangerous.",
251
  )
252
  return
253
  xx = await eor(event, "`Processing...`")
@@ -295,10 +295,10 @@ async def _(event):
295
  pattern="eval",
296
  )
297
  async def _(event):
298
- if (Var.I_DEV if Var.I_DEV else Redis("I_DEV")) != "True":
299
  await eor(
300
  event,
301
- "Developer Restricted!\nIf you know what this does, and want to proceed\n\n set var `I_DEV` as `True`\n\nThis Might Be Dangerous.",
302
  )
303
  return
304
  xx = await eor(event, "`Processing ...`")
@@ -412,4 +412,4 @@ async def lastname(steal):
412
  return await lol.edit("Error: @SangMataInfo_bot is not responding!.")
413
 
414
 
415
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
244
  pattern="bash",
245
  )
246
  async def _(event):
247
+ if Redis("I_DEV") != "True":
248
  await eor(
249
  event,
250
+ f"Developer Restricted!\nIf you know what this does, and want to proceed\n\n `{HNDLR}setredis I_DEV True`\n\nThis Might Be Dangerous.",
251
  )
252
  return
253
  xx = await eor(event, "`Processing...`")
 
295
  pattern="eval",
296
  )
297
  async def _(event):
298
+ if Redis("I_DEV") != "True":
299
  await eor(
300
  event,
301
+ f"Developer Restricted!\nIf you know what this does, and want to proceed\n\n `{HNDLR}setredis I_DEV True`\n\nThis Might Be Dangerous.",
302
  )
303
  return
304
  xx = await eor(event, "`Processing ...`")
 
412
  return await lol.edit("Error: @SangMataInfo_bot is not responding!.")
413
 
414
 
415
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/uploads_files.py CHANGED
@@ -172,4 +172,4 @@ async def _(event):
172
  return await eod(xx, "`Reply to a readable file`", time=10)
173
 
174
 
175
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
172
  return await eod(xx, "`Reply to a readable file`", time=10)
173
 
174
 
175
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/utilities.py CHANGED
@@ -46,6 +46,9 @@
46
 
47
  • `{i}json <reply to msg>`
48
  Get the json encoding of the message.
 
 
 
49
  """
50
  import asyncio
51
  import calendar
@@ -62,12 +65,16 @@ import requests
62
  from telegraph import Telegraph
63
  from telegraph import upload_file as uf
64
  from telethon import functions
65
- from telethon.errors.rpcerrorlist import BotInlineDisabledError, BotResponseTimeoutError
 
 
 
66
  from telethon.events import NewMessage
67
  from telethon.tl.custom import Dialog
68
  from telethon.tl.functions.channels import LeaveChannelRequest
69
  from telethon.tl.functions.photos import GetUserPhotosRequest
70
- from telethon.tl.types import Channel, Chat, User
 
71
  from telethon.utils import get_input_location
72
 
73
  # =================================================================#
@@ -305,12 +312,17 @@ async def _(event):
305
  .get("key")
306
  )
307
  q = f"paste-{key}"
 
308
  try:
309
  ok = await ultroid_bot.inline_query(Var.BOT_USERNAME, q)
310
  await ok[0].click(event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True)
311
  await xx.delete()
312
- except BotInlineDisabledError or BotResponseTimeoutError: # incase the bot doesnt respond
313
  await xx.edit(reply_text)
 
 
 
 
314
 
315
 
316
  @ultroid_cmd(
@@ -454,7 +466,7 @@ async def _(ult):
454
 
455
 
456
  @ultroid_cmd(
457
- pattern=r"rmbg ?(.*)",
458
  )
459
  async def rmbg(event):
460
  RMBG_API = udB.get("RMBG_API")
@@ -463,50 +475,42 @@ async def rmbg(event):
463
  return await xx.edit(
464
  "Get your API key from [here](https://www.remove.bg/) for this plugin to work.",
465
  )
466
- input_str = event.pattern_match.group(1)
467
- message_id = event.message.id
468
  if event.reply_to_msg_id:
469
- message_id = event.reply_to_msg_id
470
- reply_message = await event.get_reply_message()
471
- try:
472
- dl_file = await ultroid_bot.download_media(
473
- reply_message, TMP_DOWNLOAD_DIRECTORY
474
- )
475
- except Exception as e:
476
- return await xx.edit("**ERROR:**\n`{}`".format(str(e)))
477
- else:
478
- await xx.edit("`Sending to remove.bg`")
479
- output_file_name = ReTrieveFile(dl_file)
480
- os.remove(dl_file)
481
- elif input_str:
482
  await xx.edit("`Sending to remove.bg`")
483
- output_file_name = ReTrieveURL(input_str)
 
 
484
  else:
485
- await xx.edit(
486
- f"Use `{Var.HNDLR}rmbg` as reply to a pic to remove its background."
487
- )
488
  await asyncio.sleep(5)
489
  await xx.delete()
490
  return
491
- contentType = output_file_name.headers.get("content-type")
 
492
  if "image" in contentType:
493
- with io.BytesIO(output_file_name.content) as remove_bg_image:
494
- remove_bg_image.name = "rmbg-ult.png"
495
- await ultroid_bot.send_file(
496
- event.chat_id,
497
- remove_bg_image,
498
- force_document=True,
499
- supports_streaming=False,
500
- allow_cache=False,
501
- reply_to=message_id,
502
- )
503
- await xx.edit("`Done.`")
504
  else:
 
505
  await xx.edit(
506
- "RemoveBG returned an error - \n`{}`".format(
507
- output_file_name.content.decode("UTF-8")
508
- ),
509
  )
 
 
 
 
 
 
 
 
 
 
 
510
 
511
 
512
  @ultroid_cmd(
@@ -580,4 +584,31 @@ async def _(event):
580
  await eor(event, f"```{the_real_message}```")
581
 
582
 
583
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  • `{i}json <reply to msg>`
48
  Get the json encoding of the message.
49
+
50
+ • `{i}suggest <reply to message>`
51
+ Create a Yes/No poll for the replied suggestion.
52
  """
53
  import asyncio
54
  import calendar
 
65
  from telegraph import Telegraph
66
  from telegraph import upload_file as uf
67
  from telethon import functions
68
+ from telethon.errors.rpcerrorlist import BotInlineDisabledError
69
+ from telethon.errors.rpcerrorlist import BotMethodInvalidError as bmi
70
+ from telethon.errors.rpcerrorlist import (BotResponseTimeoutError,
71
+ ChatSendInlineForbiddenError)
72
  from telethon.events import NewMessage
73
  from telethon.tl.custom import Dialog
74
  from telethon.tl.functions.channels import LeaveChannelRequest
75
  from telethon.tl.functions.photos import GetUserPhotosRequest
76
+ from telethon.tl.types import (Channel, Chat, InputMediaPoll, Poll, PollAnswer,
77
+ User)
78
  from telethon.utils import get_input_location
79
 
80
  # =================================================================#
 
312
  .get("key")
313
  )
314
  q = f"paste-{key}"
315
+ reply_text = f"• **Pasted to Nekobin :** [Neko](https://nekobin.com/{key})\n• **Raw Url :** : [Raw](https://nekobin.com/raw/{key})"
316
  try:
317
  ok = await ultroid_bot.inline_query(Var.BOT_USERNAME, q)
318
  await ok[0].click(event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True)
319
  await xx.delete()
320
+ except BotInlineDisabledError or BotResponseTimeoutError or ChatSendInlineForbiddenError: # handling possible exceptions
321
  await xx.edit(reply_text)
322
+ except bmi:
323
+ await xx.edit(
324
+ f"**Inline Not Available as You Are in Bot Mode\nPasted to Nekobin :**\n{reply_text}"
325
+ )
326
 
327
 
328
  @ultroid_cmd(
 
466
 
467
 
468
  @ultroid_cmd(
469
+ pattern=r"rmbg$",
470
  )
471
  async def rmbg(event):
472
  RMBG_API = udB.get("RMBG_API")
 
475
  return await xx.edit(
476
  "Get your API key from [here](https://www.remove.bg/) for this plugin to work.",
477
  )
 
 
478
  if event.reply_to_msg_id:
479
+ reply = await event.get_reply_message()
480
+ dl = await ultroid_bot.download_media(reply)
481
+ if not dl.endswith(("webp", "jpg", "png", "jpeg")):
482
+ os.remove(dl)
483
+ return await xx.edit("`Unsupported Media`")
 
 
 
 
 
 
 
 
484
  await xx.edit("`Sending to remove.bg`")
485
+ out = ReTrieveFile("ult.png")
486
+ os.remove("ult.png")
487
+ os.remove(dl)
488
  else:
489
+ await xx.edit(f"Use `{HNDLR}rmbg` as reply to a pic to remove its background.")
 
 
490
  await asyncio.sleep(5)
491
  await xx.delete()
492
  return
493
+ contentType = out.headers.get("content-type")
494
+ rmbgp = "ult.png"
495
  if "image" in contentType:
496
+ with open(rmbgp, "wb") as rmbg:
497
+ rmbg.write(out.content)
 
 
 
 
 
 
 
 
 
498
  else:
499
+ error = out.json()
500
  await xx.edit(
501
+ f"**Error ~** `{error['errors'][0]['title']}`,\n`{error['errors'][0]['detail']}`"
 
 
502
  )
503
+ zz = Image.open(rmbgp)
504
+ if zz.mode != "RGB":
505
+ zz.convert("RGB")
506
+ zz.save("ult.webp", "webp")
507
+ await ultroid_bot.send_file(
508
+ event.chat_id, rmbgp, force_document=True, reply_to=reply
509
+ )
510
+ await ultroid_bot.send_file(event.chat_id, "ult.webp", reply_to=reply)
511
+ os.remove(rmbgp)
512
+ os.remove("ult.webp")
513
+ await xx.delete()
514
 
515
 
516
  @ultroid_cmd(
 
584
  await eor(event, f"```{the_real_message}```")
585
 
586
 
587
+ @ultroid_cmd(pattern="suggest")
588
+ async def sugg(event):
589
+ if await event.get_reply_message():
590
+ msgid = (await event.get_reply_message()).id
591
+ try:
592
+ await ultroid.send_message(
593
+ event.chat_id,
594
+ file=InputMediaPoll(
595
+ poll=Poll(
596
+ id=12345,
597
+ question="Do you agree to the replied suggestion?",
598
+ answers=[PollAnswer("Yes", b"1"), PollAnswer("No", b"2")],
599
+ )
600
+ ),
601
+ reply_to=msgid,
602
+ )
603
+ except Exception as e:
604
+ return await eod(
605
+ event, f"`Oops, you can't send polls here!\n\n{str(e)}`", time=5
606
+ )
607
+ await event.delete()
608
+ else:
609
+ return await eod(
610
+ event, "`Please reply to a message to make a suggestion poll!`", time=5
611
+ )
612
+
613
+
614
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
plugins/words.py CHANGED
@@ -142,4 +142,4 @@ async def _(event):
142
  await xx.edit(f"**No result found for** `{word}`")
143
 
144
 
145
- HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
 
142
  await xx.edit(f"**No result found for** `{word}`")
143
 
144
 
145
+ HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
requirements.txt CHANGED
@@ -1,10 +1,10 @@
1
- py-Ultroid==2021.2.24
2
  asyncurban
3
  carbonnow
4
  cairosvg
5
  emoji
6
  GitPython
7
- googletrans==3.1.0a0
8
  heroku3
9
  imutils
10
  lottie
@@ -20,6 +20,7 @@ psutil
20
  pytz
21
  requests>=2.18.4
22
  scikit-image
 
23
  speedtest-cli==2.1.2
24
  telegraph
25
  validators
 
1
+ py-Ultroid==2021.3.04
2
  asyncurban
3
  carbonnow
4
  cairosvg
5
  emoji
6
  GitPython
7
+ googletrans==4.0.0rc1
8
  heroku3
9
  imutils
10
  lottie
 
20
  pytz
21
  requests>=2.18.4
22
  scikit-image
23
+ selenium
24
  speedtest-cli==2.1.2
25
  telegraph
26
  validators
resources/startup/deploy.sh CHANGED
@@ -61,7 +61,9 @@ apt update && apt upgrade -y && apt install --no-install-recommends -y \
61
  make \
62
  libopus0 \
63
  libopus-dev \
64
- gcc
 
 
65
 
66
  echo '
67
  •• Cloning Repository
@@ -69,6 +71,7 @@ echo '
69
 
70
  git clone https://github.com/Teamultroid/Ultroid.git /root/TeamUltroid/
71
 
 
72
  echo '
73
  •• Getting Libraries and Installing
74
  '
 
61
  make \
62
  libopus0 \
63
  libopus-dev \
64
+ gcc \
65
+ mediainfo \
66
+ megatools
67
 
68
  echo '
69
  •• Cloning Repository
 
71
 
72
  git clone https://github.com/Teamultroid/Ultroid.git /root/TeamUltroid/
73
 
74
+
75
  echo '
76
  •• Getting Libraries and Installing
77
  '