Spaces:
Running
Running
Update akn/AllDownloaderBot/main.py
Browse files- akn/AllDownloaderBot/main.py +31 -1
akn/AllDownloaderBot/main.py
CHANGED
@@ -47,6 +47,7 @@ COMMAND = """
|
|
47 |
/rmblacklist: To Unblacklisted user from bots
|
48 |
/stats: To Get Stats Users
|
49 |
/broadcast: To Broadcast all users
|
|
|
50 |
"""
|
51 |
|
52 |
@Client.on_message(
|
@@ -80,7 +81,7 @@ async def startbot(c, m):
|
|
80 |
user_now = await db.get_alldlbot_by_no_button(c.me.id)
|
81 |
reply_markup = InlineKeyboardMarkup(buttons_start_in_group) if user_now else InlineKeyboardMarkup(buttons)
|
82 |
try:
|
83 |
-
await db.
|
84 |
await m.reply_text(
|
85 |
text=COMMAND,
|
86 |
disable_web_page_preview=True,
|
@@ -185,6 +186,35 @@ async def statscmd(c, m):
|
|
185 |
await m.reply_text(f"**Total Users:** `{total_users}`\n**Total Blacklist Users:** `{total_bl_users}`")
|
186 |
except Exception as e:
|
187 |
await m.reply_text(f"Error: {e.MESSAGE}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
@Client.on_message(
|
190 |
~filters.scheduled
|
|
|
47 |
/rmblacklist: To Unblacklisted user from bots
|
48 |
/stats: To Get Stats Users
|
49 |
/broadcast: To Broadcast all users
|
50 |
+
/rmdup: To Remove duplicate user_id same issue
|
51 |
"""
|
52 |
|
53 |
@Client.on_message(
|
|
|
81 |
user_now = await db.get_alldlbot_by_no_button(c.me.id)
|
82 |
reply_markup = InlineKeyboardMarkup(buttons_start_in_group) if user_now else InlineKeyboardMarkup(buttons)
|
83 |
try:
|
84 |
+
await db.update_alldlbot_broadcast(c.me.id, m.from_user.id, "add")
|
85 |
await m.reply_text(
|
86 |
text=COMMAND,
|
87 |
disable_web_page_preview=True,
|
|
|
186 |
await m.reply_text(f"**Total Users:** `{total_users}`\n**Total Blacklist Users:** `{total_bl_users}`")
|
187 |
except Exception as e:
|
188 |
await m.reply_text(f"Error: {e.MESSAGE}")
|
189 |
+
|
190 |
+
@Client.on_message(
|
191 |
+
~filters.scheduled
|
192 |
+
& filters.command(["rmdup"])
|
193 |
+
& ~filters.forwarded
|
194 |
+
)
|
195 |
+
async def duplicate_remove(c, m):
|
196 |
+
protect_own = await db.get_alldlbot_by_user_id(m.from_user.id)
|
197 |
+
if not protect_own:
|
198 |
+
return await m.reply_text("You are not allowed here.")
|
199 |
+
|
200 |
+
user_id = None
|
201 |
+
if not m.reply_to_message:
|
202 |
+
if len(m.command) < 2:
|
203 |
+
return await m.reply_text(
|
204 |
+
"Reply to a user or pass a user_id to blacklist"
|
205 |
+
)
|
206 |
+
try:
|
207 |
+
getuser = m.command[1]
|
208 |
+
except Exception as e:
|
209 |
+
return await m.reply_text(f"`{str(e)}`")
|
210 |
+
else:
|
211 |
+
getuser = m.reply_to_message.from_user.id
|
212 |
+
try:
|
213 |
+
user_id = (await c.get_users(getuser)).id
|
214 |
+
await db.update_alldlbot_broadcast(c.me.id, user_id, "remove")
|
215 |
+
await m.reply_text(f"Successfully remove duplicate `{user_id}` from bots.")
|
216 |
+
except Exception as e:
|
217 |
+
await m.reply_text(f"Error: {e.MESSAGE}")
|
218 |
|
219 |
@Client.on_message(
|
220 |
~filters.scheduled
|