From 55f6b30906db0e46ef810cd3ed2a1984d7015838 Mon Sep 17 00:00:00 2001
From: Avi Patil <67785446+avipatilpro@users.noreply.github.com>
Date: Thu, 17 Sep 2020 08:13:14 +0530
Subject: [PATCH 1/6] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index dfe7b09b..958ab91e 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-![logo](https://i.ibb.co/02QVkHC/headersmina.jpg)
+![logo](#)
```
#include
@@ -72,4 +72,4 @@ and many more people who aren't mentioned here, but may be found in [Contributor
## License
-This userbot licensed on [Raphielscape Public License](https://github.com/MoveAngel/One4uBot/blob/sql-extended/LICENSE) - Version 1.d, February 2020
\ No newline at end of file
+This userbot licensed on [Raphielscape Public License](https://github.com/MoveAngel/One4uBot/blob/sql-extended/LICENSE) - Version 1.d, February 2020
From a0b85f59d06a7e49798f9ea8efa8d2ad0b2d367e Mon Sep 17 00:00:00 2001
From: Avi Patil <67785446+avipatilpro@users.noreply.github.com>
Date: Thu, 17 Sep 2020 11:09:40 +0530
Subject: [PATCH 2/6] Create timefunc.py
---
userbot/modules/timefunc.py | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 userbot/modules/timefunc.py
diff --git a/userbot/modules/timefunc.py b/userbot/modules/timefunc.py
new file mode 100644
index 00000000..9c4b4e25
--- /dev/null
+++ b/userbot/modules/timefunc.py
@@ -0,0 +1,31 @@
+import time
+
+uptimebot = time.time()
+
+
+def get_readable_time(seconds: int) -> str:
+ count = 0
+ ping_time = ""
+ time_list = []
+ time_suffix_list = ["s", "m", "h", "days"]
+
+ while count < 4:
+ count += 1
+ if count < 3:
+ remainder, result = divmod(seconds, 60)
+ else:
+ remainder, result = divmod(seconds, 24)
+ if seconds == 0 and remainder == 0:
+ break
+ time_list.append(int(result))
+ seconds = int(remainder)
+
+ for x in range(len(time_list)):
+ time_list[x] = str(time_list[x]) + time_suffix_list[x]
+ if len(time_list) == 4:
+ ping_time += time_list.pop() + ", "
+
+ time_list.reverse()
+ ping_time += ":".join(time_list)
+
+ return ping_time
From 3e93250d40bd77661ccb438427e16d6c1b86bf1b Mon Sep 17 00:00:00 2001
From: Avi Patil <67785446+avipatilpro@users.noreply.github.com>
Date: Thu, 17 Sep 2020 11:14:56 +0530
Subject: [PATCH 3/6] Create lydia.py
---
userbot/modules/lydia.py | 79 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 userbot/modules/lydia.py
diff --git a/userbot/modules/lydia.py b/userbot/modules/lydia.py
new file mode 100644
index 00000000..e0bd4673
--- /dev/null
+++ b/userbot/modules/lydia.py
@@ -0,0 +1,79 @@
+# Copyright 2019 - 2020 AviPatilPro
+
+
+from coffeehouse.lydia import LydiaAI
+from coffeehouse.api import API
+import asyncio
+from telethon import events
+
+# Non-SQL Mode
+ACC_LYDIA = {}
+
+if Var.LYDIA_API_KEY:
+ api_key = Var.LYDIA_API_KEY
+ api_client = API(api_key)
+ lydia = LydiaAI(api_client)
+
+@command(pattern="^.repcf", outgoing=True)
+async def repcf(event):
+ if event.fwd_from:
+ return
+ await event.edit("Processing...")
+ try:
+ session = lydia.create_session()
+ session_id = session.id
+ reply = await event.get_reply_message()
+ msg = reply.text
+ text_rep = session.think_thought(msg)
+ await event.edit("💫 {0}".format(text_rep))
+ except Exception as e:
+ await event.edit(str(e))
+
+@command(pattern="^.addcf", outgoing=True)
+async def addcf(event):
+ if event.fwd_from:
+ return
+ await event.edit("Running on Non-SQL mode for now...")
+ await asyncio.sleep(3)
+ await event.edit("Processing...")
+ reply_msg = await event.get_reply_message()
+ if reply_msg:
+ session = lydia.create_session()
+ session_id = session.id
+ if reply_msg.from_id is None:
+ return await event.edit("Invalid user type.")
+ ACC_LYDIA.update({(event.chat_id & reply_msg.from_id): session})
+ await event.edit("Lydia successfully (re)enabled for user: {} in chat: {}".format(str(reply_msg.from_id), str(event.chat_id)))
+ else:
+ await event.edit("Reply to a user to activate Lydia AI on them")
+
+@command(pattern="^.remcf", outgoing=True)
+async def remcf(event):
+ if event.fwd_from:
+ return
+ await event.edit("Running on Non-SQL mode for now...")
+ await asyncio.sleep(3)
+ await event.edit("Processing...")
+ reply_msg = await event.get_reply_message()
+ try:
+ del ACC_LYDIA[event.chat_id & reply_msg.from_id]
+ await event.edit("Lydia successfully disabled for user: {} in chat: {}".format(str(reply_msg.from_id), str(event.chat_id)))
+ except Exception:
+ await event.edit("This person does not have Lydia activated on him/her.")
+
+
+@bot.on(events.NewMessage(incoming=True))
+async def user(event):
+ user_text = event.text
+ try:
+ session = ACC_LYDIA[event.chat_id & event.from_id]
+ msg = event.text
+ async with event.client.action(event.chat_id, "typing"):
+ text_rep = session.think_thought(msg)
+ wait_time = 0
+ for i in range(len(text_rep)):
+ wait_time = wait_time + 0.1
+ await asyncio.sleep(wait_time)
+ await event.reply(text_rep)
+ except (KeyError, TypeError):
+ return
From 006718d789ba8c1e9bed6160bee8f6c53eec1925 Mon Sep 17 00:00:00 2001
From: Avi Patil <67785446+avipatilpro@users.noreply.github.com>
Date: Mon, 21 Sep 2020 16:27:33 +0530
Subject: [PATCH 4/6] Initial Commit
---
userbot/modules/about.py | 28 ++
userbot/modules/actionwallpapers.py | 71 +++
userbot/modules/actressdp.py | 70 +++
userbot/modules/addprivate.py | 38 ++
userbot/modules/afk2.py | 179 +++++++
userbot/modules/angry.py | 35 ++
userbot/modules/anime_dwn.py | 88 ++++
userbot/modules/art==new.py | 108 ++++
userbot/modules/bigoof.py | 39 ++
userbot/modules/botgban.py | 49 ++
userbot/modules/buttonpost.py | 94 ++++
userbot/modules/bye.py | 24 +
userbot/modules/calculator.py | 67 +++
userbot/modules/calendar.py | 40 ++
userbot/modules/call.py | 54 ++
userbot/modules/chatinfo.py | 558 ++++++++++-----------
userbot/modules/clock_name.py | 40 ++
userbot/modules/ctext.py | 27 +
userbot/modules/ctg.py | 36 ++
userbot/modules/dartndice.py | 32 ++
userbot/modules/dice_dart_ball.py | 32 ++
userbot/modules/dlinks.py | 337 +++++++++++++
userbot/modules/funnyfonts.py | 188 +++++++
userbot/modules/gaana.py | 126 +++++
userbot/modules/gnight.py | 13 +
userbot/modules/grs.py | 154 ++++++
userbot/modules/idea.py | 45 ++
userbot/modules/indainflag.py | 25 +
userbot/modules/indainmap.py | 26 +
userbot/modules/letmesaerch.py | 188 +++++++
userbot/modules/link.py | 83 ++++
userbot/modules/moon2.py | 17 +
userbot/modules/mystatus.py | 97 ++++
userbot/modules/noice.py | 732 ++++++++++++++++++++++++++++
userbot/modules/omg.py | 16 +
userbot/modules/ophack.py | 53 ++
userbot/modules/owner.py | 39 ++
userbot/modules/picspam.py | 35 ++
userbot/modules/pluginbydead.py | 24 +
userbot/modules/recognize.py | 55 +++
userbot/modules/resend.py | 17 +
userbot/modules/ripper.py | 36 ++
userbot/modules/rt==new.py | 108 ++++
userbot/modules/sniper kill 200.py | 61 +++
userbot/modules/thanos.py | 29 ++
userbot/modules/whois.py | 453 +++++++++++------
46 files changed, 4205 insertions(+), 461 deletions(-)
create mode 100644 userbot/modules/about.py
create mode 100644 userbot/modules/actionwallpapers.py
create mode 100644 userbot/modules/actressdp.py
create mode 100644 userbot/modules/addprivate.py
create mode 100644 userbot/modules/afk2.py
create mode 100644 userbot/modules/angry.py
create mode 100644 userbot/modules/anime_dwn.py
create mode 100644 userbot/modules/art==new.py
create mode 100644 userbot/modules/bigoof.py
create mode 100644 userbot/modules/botgban.py
create mode 100644 userbot/modules/buttonpost.py
create mode 100644 userbot/modules/bye.py
create mode 100644 userbot/modules/calculator.py
create mode 100644 userbot/modules/calendar.py
create mode 100644 userbot/modules/call.py
create mode 100644 userbot/modules/clock_name.py
create mode 100644 userbot/modules/ctext.py
create mode 100644 userbot/modules/ctg.py
create mode 100644 userbot/modules/dartndice.py
create mode 100644 userbot/modules/dice_dart_ball.py
create mode 100644 userbot/modules/dlinks.py
create mode 100644 userbot/modules/funnyfonts.py
create mode 100644 userbot/modules/gaana.py
create mode 100644 userbot/modules/gnight.py
create mode 100644 userbot/modules/grs.py
create mode 100644 userbot/modules/idea.py
create mode 100644 userbot/modules/indainflag.py
create mode 100644 userbot/modules/indainmap.py
create mode 100644 userbot/modules/letmesaerch.py
create mode 100644 userbot/modules/link.py
create mode 100644 userbot/modules/moon2.py
create mode 100644 userbot/modules/mystatus.py
create mode 100644 userbot/modules/noice.py
create mode 100644 userbot/modules/omg.py
create mode 100644 userbot/modules/ophack.py
create mode 100644 userbot/modules/owner.py
create mode 100644 userbot/modules/picspam.py
create mode 100644 userbot/modules/pluginbydead.py
create mode 100644 userbot/modules/recognize.py
create mode 100644 userbot/modules/resend.py
create mode 100644 userbot/modules/ripper.py
create mode 100644 userbot/modules/rt==new.py
create mode 100644 userbot/modules/sniper kill 200.py
create mode 100644 userbot/modules/thanos.py
diff --git a/userbot/modules/about.py b/userbot/modules/about.py
new file mode 100644
index 00000000..c3dc4f54
--- /dev/null
+++ b/userbot/modules/about.py
@@ -0,0 +1,28 @@
+# Ported from other Telegram UserBots for TeleBot//Made for TeleBot
+# Kangers, don't remove this line
+# @its_xditya
+"""Available Commands:
+.info
+"""
+import asyncio
+
+from userbot.utils import admin_cmd
+
+
+@borg.on(admin_cmd("infowho"))
+async def _(event):
+ if event.fwd_from:
+ return
+ animation_interval = 0.1
+ animation_ttl = range(0, 36)
+ # input_str = event.pattern_match.group(1)
+ # if input_str == "Visit this page to know more about TeleBot.":
+ await event.edit("Thanks")
+ animation_chars = [
+ "**TeleBot**", "[More Info](https://telegra.ph/TeleBot-07-08)"
+ ]
+
+ for i in animation_ttl:
+
+ await asyncio.sleep(animation_interval)
+ await event.edit(animation_chars[i % 18])
\ No newline at end of file
diff --git a/userbot/modules/actionwallpapers.py b/userbot/modules/actionwallpapers.py
new file mode 100644
index 00000000..e3daa0ee
--- /dev/null
+++ b/userbot/modules/actionwallpapers.py
@@ -0,0 +1,71 @@
+import asyncio
+import os
+import random
+import re
+import urllib
+from datetime import datetime
+from time import sleep
+
+import requests
+from PIL import Image
+from PIL import ImageDraw
+from PIL import ImageFont
+from telethon.tl import functions
+
+from userbot.utils import admin_cmd
+
+COLLECTION_STRINGZ = [
+ "Vietnam-War-Wallpapers",
+ "War-of-the-Worlds-Wallpaper",
+ "War-Plane-Wallpaper",
+ "World-War-Ii-Wallpaper",
+ "Cool-War-Wallpapers",
+ "World-War-2-Wallpaper-HD",
+]
+
+
+async def animepp():
+
+ os.system("rm -rf donot.jpg")
+
+ rnd = random.randint(0, len(COLLECTION_STRINGZ) - 1)
+
+ pack = COLLECTION_STRINGZ[rnd]
+
+ pc = requests.get("http://getwallpapers.com/collection/" + pack).text
+
+ f = re.compile("/\w+/full.+.jpg")
+
+ f = f.findall(pc)
+
+ fy = "http://getwallpapers.com" + random.choice(f)
+
+ print(fy)
+
+ if not os.path.exists("f.ttf"):
+
+ urllib.request.urlretrieve(
+ "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
+ "f.ttf",
+ )
+
+ urllib.request.urlretrieve(fy, "donottouch.jpg")
+
+
+@borg.on(admin_cmd(pattern="fire ?(.*)"))
+async def main(event):
+
+ await event.edit(
+ "**Uplaoding Walpapers \n please wait...\n\nDone !!! Check Your DP")
+
+ while True:
+
+ await animepp()
+
+ file = await event.client.upload_file("donottouch.jpg")
+
+ await event.client(functions.photos.UploadProfilePhotoRequest(file))
+
+ os.system("rm -rf donottouch.jpg")
+
+ await asyncio.sleep(60) # Edit this to your required needs
\ No newline at end of file
diff --git a/userbot/modules/actressdp.py b/userbot/modules/actressdp.py
new file mode 100644
index 00000000..d64281f7
--- /dev/null
+++ b/userbot/modules/actressdp.py
@@ -0,0 +1,70 @@
+# Ported from other Telegram UserBots for TeleBot//Made for TeleBot
+# Kangers, don't remove this line
+# @its_xditya
+# Usage .actressdp Im Not Responsible For Any Ban caused By This
+import asyncio
+import os
+import random
+import re
+import urllib
+
+import requests
+from telethon.tl import functions
+
+from userbot.utils import admin_cmd
+
+COLLECTION_STRING = [
+ "indian-actress-wallpapers",
+ "latest-bollywood-actress-wallpapers-2018-hd",
+ "bollywood-actress-wallpaper",
+ "hd-wallpapers-of-bollywood-actress",
+ "new-bollywood-actress-wallpaper-2018",
+]
+
+
+async def animepp():
+
+ os.system("rm -rf donot.jpg")
+
+ rnd = random.randint(0, len(COLLECTION_STRING) - 1)
+
+ pack = COLLECTION_STRING[rnd]
+
+ pc = requests.get("http://getwallpapers.com/collection/" + pack).text
+
+ f = re.compile("/\w+/full.+.jpg")
+
+ f = f.findall(pc)
+
+ fy = "http://getwallpapers.com" + random.choice(f)
+
+ print(fy)
+
+ if not os.path.exists("f.ttf"):
+
+ urllib.request.urlretrieve(
+ "https://github.com/rebel6969/mym/raw/master/Rebel-robot-Regular.ttf",
+ "f.ttf",
+ )
+
+ urllib.request.urlretrieve(fy, "donottouch.jpg")
+
+
+@borg.on(admin_cmd(pattern="actressdp ?(.*)"))
+async def main(event):
+
+ await event.edit(
+ "**Starting Actress Profile Pic...\n\nDone !!! Check Your DP in 5 seconds. \n By [TeleBot](https://github.com/xditya/TeleBot)**"
+ )
+
+ while True:
+
+ await animepp()
+
+ file = await event.client.upload_file("donottouch.jpg")
+
+ await event.client(functions.photos.UploadProfilePhotoRequest(file))
+
+ os.system("rm -rf donottouch.jpg")
+
+ await asyncio.sleep(600) # Edit this to your required needs
\ No newline at end of file
diff --git a/userbot/modules/addprivate.py b/userbot/modules/addprivate.py
new file mode 100644
index 00000000..ac922f24
--- /dev/null
+++ b/userbot/modules/addprivate.py
@@ -0,0 +1,38 @@
+"""Invite the user(s) to the current chat
+Syntax: .invite """
+from telethon import functions
+
+from userbot.utils import admin_cmd
+
+
+@borg.on(admin_cmd(pattern="add ?(.*)"))
+async def _(event):
+ if event.fwd_from:
+ return
+ to_add_users = event.pattern_match.group(1)
+ if event.is_private:
+ await event.edit("`.invite` users to a chat, not to a Private Message")
+ else:
+ logger.info(to_add_users)
+ if not event.is_channel and event.is_group:
+ # https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html
+ for user_id in to_add_users.split(" "):
+ try:
+ await borg(
+ functions.messages.AddChatUserRequest(
+ chat_id=event.chat_id,
+ user_id=user_id,
+ fwd_limit=1000000))
+ except Exception as e:
+ await event.reply(str(e))
+ await event.edit("Invited Successfully")
+ else:
+ # https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
+ for user_id in to_add_users.split(" "):
+ try:
+ await borg(
+ functions.channels.InviteToChannelRequest(
+ channel=event.chat_id, users=[user_id]))
+ except Exception as e:
+ await event.reply(str(e))
+ await event.edit("Invited Successfully")
\ No newline at end of file
diff --git a/userbot/modules/afk2.py b/userbot/modules/afk2.py
new file mode 100644
index 00000000..d667b458
--- /dev/null
+++ b/userbot/modules/afk2.py
@@ -0,0 +1,179 @@
+"""AFK Plugin for @UniBorg
+Syntax: .affk REASON"""
+import asyncio
+import datetime
+from datetime import datetime
+
+from telethon import events
+from telethon.tl import functions
+from telethon.tl import types
+
+from userbot import CMD_HELP
+from userbot.utils import admin_cmd
+
+global USER_AFK # pylint:disable=E0602
+global afk_time # pylint:disable=E0602
+global last_afk_message # pylint:disable=E0602
+global afk_start
+global afk_end
+USER_AFK = {}
+afk_time = None
+last_afk_message = {}
+afk_start = {}
+
+
+@borg.on(events.NewMessage(outgoing=True)) # pylint:disable=E0602
+async def set_not_afk(event):
+ global USER_AFK # pylint:disable=E0602
+ global afk_time # pylint:disable=E0602
+ global last_afk_message # pylint:disable=E0602
+ global afk_start
+ global afk_end
+ back_alive = datetime.now()
+ afk_end = back_alive.replace(microsecond=0)
+ if afk_start != {}:
+ total_afk_time = str((afk_end - afk_start))
+ current_message = event.message.message
+ if ".affk" not in current_message and "yes" in USER_AFK: # pylint:disable=E0602
+ shite = await borg.send_message(
+ event.chat_id,
+ "__Back alive!__\n**No Longer afk.**\n `Was afk for:``" +
+ total_afk_time + "`",
+ )
+ try:
+ await borg.send_message( # pylint:disable=E0602
+ Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
+ "#AFKFALSE \n Set AFK mode to False\n" +
+ "__Back alive!__\n**No Longer afk.**\n `Was afk for:``" +
+ total_afk_time + "`",
+ )
+ except Exception as e: # pylint:disable=C0103,W0703
+ await borg.send_message( # pylint:disable=E0602
+ event.chat_id,
+ "Please set `PRIVATE_GROUP_BOT_API_ID` " +
+ "for the proper functioning of afk functionality " +
+ "check pinned message in @catuserbot17.\n\n `{}`".format(
+ str(e)),
+ reply_to=event.message.id,
+ silent=True,
+ )
+ await asyncio.sleep(5)
+ await shite.delete()
+ USER_AFK = {} # pylint:disable=E0602
+ afk_time = None # pylint:disable=E0602
+
+
+@borg.on(admin_cmd(pattern=r"affk ?(.*)")) # pylint:disable=E0602
+async def _(event):
+ if event.fwd_from:
+ return
+ global USER_AFK # pylint:disable=E0602
+ global afk_time # pylint:disable=E0602
+ global last_afk_message # pylint:disable=E0602
+ global afk_start
+ global afk_end
+ global reason
+ USER_AFK = {}
+ afk_time = None
+ last_afk_message = {}
+ afk_end = {}
+ start_1 = datetime.now()
+ afk_start = start_1.replace(microsecond=0)
+ reason = event.pattern_match.group(1)
+ if not USER_AFK: # pylint:disable=E0602
+ last_seen_status = await borg( # pylint:disable=E0602
+ functions.account.GetPrivacyRequest(
+ types.InputPrivacyKeyStatusTimestamp()))
+ if isinstance(last_seen_status.rules, types.PrivacyValueAllowAll):
+ afk_time = datetime.datetime.now() # pylint:disable=E0602
+ USER_AFK = f"yes: {reason}" # pylint:disable=E0602
+ if reason:
+ await borg.send_message(
+ event.chat_id,
+ f"**I shall be Going AFK!** __because ~ {reason}__")
+ else:
+ await borg.send_message(event.chat_id, f"**I am Going AFK!**")
+ await asyncio.sleep(2)
+ await event.delete()
+ try:
+ await borg.send_message( # pylint:disable=E0602
+ Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
+ f"#AFKTRUE \n Set AFK mode to True, and Reason is {reason}",
+ )
+ except Exception as e: # pylint:disable=C0103,W0703
+ logger.warn(str(e)) # pylint:disable=E0602
+
+
+@borg.on(
+ events.NewMessage( # pylint:disable=E0602
+ incoming=True,
+ func=lambda e: bool(e.mentioned or e.is_private)))
+async def on_afk(event):
+ if event.fwd_from:
+ return
+ global USER_AFK # pylint:disable=E0602
+ global afk_time # pylint:disable=E0602
+ global last_afk_message # pylint:disable=E0602
+ global afk_start
+ global afk_end
+ back_alivee = datetime.now()
+ afk_end = back_alivee.replace(microsecond=0)
+ if afk_start != {}:
+ total_afk_time = str((afk_end - afk_start))
+ afk_since = "**a while ago**"
+ current_message_text = event.message.message.lower()
+ if "affk" in current_message_text:
+ # userbot's should not reply to other userbot's
+ # https://core.telegram.org/bots/faq#why-doesn-39t-my-bot-see-messages-from-other-bots
+ return False
+ if USER_AFK and not (await event.get_sender()).bot: # pylint:disable=E0602
+ if afk_time: # pylint:disable=E0602
+ now = datetime.datetime.now()
+ datime_since_afk = now - afk_time # pylint:disable=E0602
+ time = float(datime_since_afk.seconds)
+ days = time // (24 * 3600)
+ time = time % (24 * 3600)
+ hours = time // 3600
+ time %= 3600
+ minutes = time // 60
+ time %= 60
+ seconds = time
+ if days == 1:
+ afk_since = "**Yesterday**"
+ elif days > 1:
+ if days > 6:
+ date = now + datetime.timedelta(
+ days=-days, hours=-hours, minutes=-minutes)
+ afk_since = date.strftime("%A, %Y %B %m, %H:%I")
+ else:
+ wday = now + datetime.timedelta(days=-days)
+ afk_since = wday.strftime("%A")
+ elif hours > 1:
+ afk_since = f"`{int(hours)}h{int(minutes)}m` **ago**"
+ elif minutes > 0:
+ afk_since = f"`{int(minutes)}m{int(seconds)}s` **ago**"
+ else:
+ afk_since = f"`{int(seconds)}s` **ago**"
+ msg = None
+ message_to_reply = (
+ f"__My Master Has Been In afk For__ `{total_afk_time}`\nWhere He Is: ONLY GOD KNOWS "
+ +
+ f"\n\n__I promise He'll back in a few light years__\n**REASON**: {reason}"
+ if reason else
+ f"**Heya!**\n__I am currently unavailable. Since when, you ask? For {total_afk_time} I guess.__\n\n\n**Important Notice**\n\n[This User Is Dead Forever...](https://telegra.ph/file/a4821748db331a0c899a0.mp4)"
+ )
+ msg = await event.reply(message_to_reply)
+ await asyncio.sleep(5)
+ if event.chat_id in last_afk_message: # pylint:disable=E0602
+ await last_afk_message[event.chat_id].delete() # pylint:disable=E0602
+ last_afk_message[event.chat_id] = msg # pylint:disable=E0602
+
+
+CMD_HELP.update({
+ "affk":
+ ".affk [Optional Reason]\
+\nUsage: Sets you as afk.\nReplies to anyone who tags/PM's \
+you telling them that you are AFK(reason).\n\nSwitches off AFK when you type back anything, anywhere.\
+\n afk full form away from keyboard/keypad.\
+"
+})
\ No newline at end of file
diff --git a/userbot/modules/angry.py b/userbot/modules/angry.py
new file mode 100644
index 00000000..aff6e801
--- /dev/null
+++ b/userbot/modules/angry.py
@@ -0,0 +1,35 @@
+"""Emoji
+Available Commands:
+.angry"""
+import asyncio
+
+from telethon import events
+
+from userbot.utils import admin_cmd
+
+
+@borg.on(admin_cmd("angry"))
+async def _(event):
+ if event.fwd_from:
+ return
+ animation_interval = 3
+ animation_ttl = range(0, 18)
+
+ # await event.edit(input_str)
+ await event.edit("I am getting angry now")
+ animation_chars = [
+ "😡😡😡",
+ "I am angry with you",
+ "Just shut up",
+ "And RUN Away NOW",
+ "Or else",
+ "I would call CEO of Telegram",
+ "My friend is also a hacker...",
+ "I would call him if you don't shut up",
+ "🤬🤬Warning you, Don't repeat it again and shut up now...🤬🤬",
+ "🤬🤬🤬🤬🤬 BSDK ab toh chup ho ja.",
+ ]
+
+ for i in animation_ttl:
+ await asyncio.sleep(animation_interval)
+ await event.edit(animation_chars[i % 18])
\ No newline at end of file
diff --git a/userbot/modules/anime_dwn.py b/userbot/modules/anime_dwn.py
new file mode 100644
index 00000000..e9f5a488
--- /dev/null
+++ b/userbot/modules/anime_dwn.py
@@ -0,0 +1,88 @@
+"""
+Anime Batch Downloader Plugin for userbot. //set TEMP_DIR Env Var first.
+usage:- get a link of Animefrenzy.net Anime page and use in cmd.
+cmd:- .anime page_link
+By:- @Zero_cool7870
+"""
+import asyncio
+import os
+
+import requests
+from bs4 import BeautifulSoup as bs
+from telethon import events
+
+from userbot.utils import admin_cmd
+
+chunk_size = 3242880
+
+
+async def get_file_name(link):
+ new_link = link[26:]
+ l = ""
+ for c in new_link:
+ if c == "?":
+ break
+ l = l + c
+ l = l.replace("/", "_")
+ return l
+
+
+async def download_file(url, filename):
+ response = requests.get(url, stream=True)
+ handle = open(filename, "wb")
+ for chunk in response.iter_content(chunk_size=chunk_size):
+ if chunk: # filter out keep-alive new chunks
+ handle.write(chunk)
+ handle.close()
+
+
+@borg.on(admin_cmd(pattern=r"danime"))
+async def anime_download(event):
+ urls = []
+ url_links = []
+ if event.fwd_from:
+ return
+ if Config.TEMP_DIR is None:
+ await event.edit("Please Set Required ENV Variables First.")
+ return
+ download_dir = Config.TEMP_DIR
+ try:
+ os.makedirs(download_dir)
+ except:
+ pass
+
+ var = event.text
+ var = var[6:]
+ res = requests.get(var)
+ source = bs(res.text, "lxml")
+
+ for a in source.find_all("a", {"class": "infovan"}):
+ url_links.append(a["href"])
+
+ for i in url_links:
+ res = requests.get(i)
+ source = bs(res.text, "lxml")
+
+ for a in source.find_all("a", {"class": "an"}):
+ urls.append(a["href"])
+ print("Getting Link...")
+
+ counter = 0
+ for url in urls:
+ if "download.php?" in url:
+ urls.pop(counter)
+ counter = counter + 1
+
+ counter = 0
+ for url in urls:
+ if "#" in url:
+ urls.pop(counter)
+ counter = counter + 1
+ await event.edit("Downloading Episodes...")
+
+ for i in urls:
+ filename = await get_file_name(i)
+ print(filename)
+ filename = download_dir + "/" + filename
+ await download_file(i, filename)
+ await event.edit("All Episodes Downloaded.")
\ No newline at end of file
diff --git a/userbot/modules/art==new.py b/userbot/modules/art==new.py
new file mode 100644
index 00000000..3d01997a
--- /dev/null
+++ b/userbot/modules/art==new.py
@@ -0,0 +1,108 @@
+import asyncio
+from platform import uname
+
+from telethon import events
+from telethon.tl.types import ChannelParticipantsAdmins
+
+from userbot import ALIVE_NAME
+from userbot.utils import admin_cmd
+
+n = str(
+ ALIVE_NAME) if ALIVE_NAME else "Set ALIVE_NAME in config vars in Heroku"
+
+
+# @command(outgoing=True, pattern="^.ded$")
+@borg.on(admin_cmd(pattern=r"ded"))
+async def bluedevilded(ded):
+ await ded.edit(n + " == |\n |"
+ "\n | \n"
+ " | \n"
+ " | \n"
+ " | \n"
+ " | \n"
+ " | \n"
+ " | \n"
+ " / ̄ ̄\| \n"
+ "< ´・ |\ \n"
+ " | 3 | 丶\ \n"
+ "< 、・ | \ \n"
+ " \__/∪ _ ∪) \n"
+ " U U\n")
+
+
+M = ("▄███████▄\n"
+ "█▄█████▄█\n"
+ "█▼▼▼▼▼█\n"
+ "██________█▌\n"
+ "█▲▲▲▲▲█\n"
+ "█████████\n"
+ "_████\n")
+P = ("┈┈┏━╮╭━┓┈╭━━━━╮\n"
+ "┈┈┃┏┗┛┓┃╭┫ⓞⓘⓝⓚ┃\n"
+ "┈┈╰┓▋▋┏╯╯╰━━━━╯\n"
+ "┈╭━┻╮╲┗━━━━╮╭╮┈\n"
+ "┈┃▎▎┃╲╲╲╲╲╲┣━╯┈\n"
+ "┈╰━┳┻▅╯╲╲╲╲┃┈┈┈\n"
+ "┈┈┈╰━┳┓┏┳┓┏╯┈┈┈\n"
+ "┈┈┈┈┈┗┻┛┗┻┛┈┈┈┈\n")
+K = "_/﹋\_\n" "(҂`_´)\n" "<,︻╦╤─ ҉ - -\n" "_/﹋\_\n"
+G = ("........___________________\n"
+ "....../ `-___________--_____|] - - - - - -\n"
+ " - - ░ ▒▓▓█D \n"
+ "...../==o;;;;;;;;______.:/\n"
+ ".....), -.(_(__) /\n"
+ "....// (..) ), —\n"
+ "...//___//\n")
+D = ("╥━━━━━━━━╭━━╮━━┳\n"
+ "╢╭╮╭━━━━━┫┃▋▋━▅┣\n"
+ "╢┃╰┫┈┈┈┈┈┃┃┈┈╰┫┣\n"
+ "╢╰━┫┈┈┈┈┈╰╯╰┳━╯┣\n"
+ "╢┊┊┃┏┳┳━━┓┏┳┫┊┊┣\n"
+ "╨━━┗┛┗┛━━┗┛┗┛━━┻\n")
+H = ("▬▬▬.◙.▬▬▬ \n"
+ "═▂▄▄▓▄▄▂ \n"
+ "◢◤ █▀▀████▄▄▄▄◢◤ \n"
+ "█▄ █ █▄ ███▀▀▀▀▀▀▀╬ \n"
+ "◥█████◤ \n"
+ "══╩══╩══ \n"
+ "╬═╬ \n"
+ "╬═╬ \n"
+ "╬═╬ \n"
+ "╬═╬ \n"
+ "╬═╬ \n"
+ "╬═╬ \n"
+ "╬═╬ Hello, my friend :D \n"
+ "╬═╬☻/ \n"
+ "╬═╬/▌ \n"
+ "╬═╬/ \\n")
+
+
+@borg.on(admin_cmd(pattern=r"monster"))
+async def bluedevilmonster(monster):
+ await monster.edit(M)
+
+
+@borg.on(admin_cmd(pattern=r"pig"))
+async def bluedevipig(pig):
+ await pig.edit(P)
+
+
+@borg.on(admin_cmd(pattern=r"kiler"))
+async def bluedevikiller(kiler):
+ await kiler.edit(K)
+
+
+@borg.on(admin_cmd(pattern=r"gun"))
+async def bluedevigun(gun):
+ await gun.edit(G)
+
+
+@borg.on(admin_cmd(pattern=r"dog"))
+async def bluedevidog(dog):
+ await dog.edit(D)
+
+
+@borg.on(admin_cmd(pattern=r"hmf"))
+async def bluedevihmf(hmf):
+ await hmf.edit(H)
+© 2020 GitHub, Inc.
\ No newline at end of file
diff --git a/userbot/modules/bigoof.py b/userbot/modules/bigoof.py
new file mode 100644
index 00000000..bbec7f9d
--- /dev/null
+++ b/userbot/modules/bigoof.py
@@ -0,0 +1,39 @@
+"""Available Commands:
+.bigoof
+Credits to @T3b0N3
+ Ultroid
+"""
+import asyncio
+
+from telethon import events
+
+from userbot.utils import admin_cmd
+# Main Credits Goes to @T3b0N3
+# He Worked Very Hard to do this, So Please Respect Him!!
+
+
+@borg.on(admin_cmd("bigoof"))
+async def _(event):
+ if event.fwd_from:
+ return
+ animation_interval = 0.1
+ animation_ttl = range(0, 36)
+ # input_str = event.pattern_match.group(1)
+ # if input_str == "nope":
+ await event.edit(
+ "┏━━━┓╋╋╋╋┏━━━┓ \n┃┏━┓┃╋╋╋╋┃┏━┓┃ \n┃┃╋┃┣┓┏┓┏┫┃╋┃┃ \n┃┃╋┃┃┗┛┗┛┃┃╋┃┃ \n┃┗━┛┣┓┏┓┏┫┗━┛┃ \n┗━━━┛┗┛┗┛┗━━━┛"
+ )
+ animation_chars = [
+ "╭━━━╮╱╱╱╭━╮ \n┃╭━╮┃╱╱╱┃╭╯ \n┃┃╱┃┣━━┳╯╰╮ \n┃┃╱┃┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃┃┃ \n╰━━━┻━━╯╰╯ ",
+ "╭━━━╮╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃┃┃ \n ╰━━━┻━━┻━━╯╰╯",
+ "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
+ "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
+ "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━┻━━╯╰╯",
+ "╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━┻━━╯╰╯",
+ "╭━━━╮╱╱╱╱╱╱╱╱╱╭━╮ \n┃╭━╮┃╱╱╱╱╱╱╱╱╱┃╭╯ \n┃┃╱┃┣━━┳━━┳━━┳╯╰╮ \n┃┃╱┃┃╭╮┃╭╮┃╭╮┣╮╭╯ \n┃╰━╯┃╰╯┃╰╯┃╰╯┃┃┃ \n╰━━━┻━━┻━━┻━━╯╰╯",
+ ]
+
+ for i in animation_ttl:
+
+ await asyncio.sleep(animation_interval)
+ await event.edit(animation_chars[i % 40])
\ No newline at end of file
diff --git a/userbot/modules/botgban.py b/userbot/modules/botgban.py
new file mode 100644
index 00000000..a714581f
--- /dev/null
+++ b/userbot/modules/botgban.py
@@ -0,0 +1,49 @@
+"""Globally Ban users from all the
+Group Administrations bots where you are SUDO
+Available Commands:
+.gban REASON
+.ungban REASON"""
+import asyncio
+
+from telethon import events
+
+from userbot.utils import admin_cmd
+
+
+@borg.on(admin_cmd(pattern="bgban ?(.*)"))
+async def _(event):
+ if Config.G_BAN_LOGGER_GROUP is None:
+ await event.edit("ENV VAR is not set. This module will not work.")
+ return
+ if event.fwd_from:
+ return
+ reason = event.pattern_match.group(1)
+ if event.reply_to_msg_id:
+ r = await event.get_reply_message()
+ if r.forward:
+ r_from_id = r.forward.from_id or r.from_id
+ else:
+ r_from_id = r.from_id
+ await borg.send_message(
+ Config.G_BAN_LOGGER_GROUP,
+ "/gban [user](tg://user?id={}) {}".format(r_from_id, reason),
+ )
+ await event.delete()
+
+
+@borg.on(admin_cmd(pattern="bungban ?(.*)"))
+async def _(event):
+ if Config.G_BAN_LOGGER_GROUP is None:
+ await event.edit("ENV VAR is not set. This module will not work.")
+ return
+ if event.fwd_from:
+ return
+ reason = event.pattern_match.group(1)
+ if event.reply_to_msg_id:
+ r = await event.get_reply_message()
+ r_from_id = r.from_id
+ await borg.send_message(
+ Config.G_BAN_LOGGER_GROUP,
+ "/ungban [user](tg://user?id={}) {}".format(r_from_id, reason),
+ )
+ await event.delete()
\ No newline at end of file
diff --git a/userbot/modules/buttonpost.py b/userbot/modules/buttonpost.py
new file mode 100644
index 00000000..4e4e2eaf
--- /dev/null
+++ b/userbot/modules/buttonpost.py
@@ -0,0 +1,94 @@
+"""Create Button Posts
+"""
+import re
+
+from telethon import custom
+from uniborg.util import admin_cmd
+
+# regex obtained from: https://github.com/PaulSonOfLars/tgbot/blob/master/tg_bot/modules/helper_funcs/string_handling.py#L23
+BTN_URL_REGEX = re.compile(
+ r"(\{([^\[]+?)\}\)")
+
+
+@borg.on(admin_cmd(pattern="cbutton")) # pylint:disable=E0602
+async def _(event):
+ if Config.TG_BOT_USER_NAME_BF_HER is None or tgbot is None:
+ await event.edit(
+ "need to set up a @BotFather bot for this module to work")
+ return
+
+ if Config.PRIVATE_CHANNEL_BOT_API_ID is None:
+ await event.edit(
+ "need to have a `PRIVATE_CHANNEL_BOT_API_ID` for this module to work"
+ )
+ return
+
+ reply_message = await event.get_reply_message()
+ if reply_message is None:
+ await event.edit("reply to a message that I need to parse the magic on"
+ )
+ return
+
+ markdown_note = reply_message.text
+ prev = 0
+ note_data = ""
+ buttons = []
+ for match in BTN_URL_REGEX.finditer(markdown_note):
+ # Check if btnurl is escaped
+ n_escapes = 0
+ to_check = match.start(1) - 1
+ while to_check > 0 and markdown_note[to_check] == "\\":
+ n_escapes += 1
+ to_check -= 1
+
+ # if even, not escaped -> create button
+ if n_escapes % 2 == 0:
+ # create a thruple with button label, url, and newline status
+ buttons.append(
+ (match.group(2), match.group(3), bool(match.group(4))))
+ note_data += markdown_note[prev:match.start(1)]
+ prev = match.end(1)
+
+ # if odd, escaped -> move along
+ else:
+ note_data += markdown_note[prev:to_check]
+ prev = match.start(1) - 1
+
+ note_data += markdown_note[prev:]
+
+ message_text = note_data.strip()
+ tl_ib_buttons = build_keyboard(buttons)
+
+ # logger.info(message_text)
+ # logger.info(tl_ib_buttons)
+
+ tgbot_reply_message = None
+ if reply_message.media is not None:
+ message_id_in_channel = reply_message.id
+ tgbot_reply_message = await tgbot.get_messages(
+ entity=Config.PRIVATE_CHANNEL_BOT_API_ID,
+ ids=message_id_in_channel)
+ tgbot_reply_message = tgbot_reply_message.media
+
+ await tgbot.send_message(
+ entity=Config.PRIVATE_CHANNEL_BOT_API_ID,
+ message=message_text,
+ parse_mode="html",
+ file=tgbot_reply_message,
+ link_preview=False,
+ buttons=tl_ib_buttons,
+ silent=True,
+ )
+
+
+# Helpers
+
+
+def build_keyboard(buttons):
+ keyb = []
+ for btn in buttons:
+ if btn[2] and keyb:
+ keyb[-1].append(custom.Button.url(btn[0], btn[1]))
+ else:
+ keyb.append([custom.Button.url(btn[0], btn[1])])
+ return keyb
\ No newline at end of file
diff --git a/userbot/modules/bye.py b/userbot/modules/bye.py
new file mode 100644
index 00000000..9bd092ed
--- /dev/null
+++ b/userbot/modules/bye.py
@@ -0,0 +1,24 @@
+# Courtesy @yasirsiddiqui
+"""
+.bye
+"""
+import time
+
+from telethon.tl.functions.channels import LeaveChannelRequest
+
+from userbot.utils import admin_cmd
+from userbot.utils import edit_or_reply
+from userbot.utils import sudo_cmd
+
+
+@borg.on(admin_cmd("bye", outgoing=True))
+@borg.on(sudo_cmd("bye", allow_sudo=True))
+async def leave(e):
+ starkgang = await edit_or_reply(e, "Bye Kek")
+ if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
+ await starkgang.edit("`I am leaving this chat.....!`")
+ time.sleep(3)
+ if "-" in str(e.chat_id):
+ await borg(LeaveChannelRequest(e.chat_id))
+ else:
+ await starkgang.edit("`Sir This is Not A Chat`")
\ No newline at end of file
diff --git a/userbot/modules/calculator.py b/userbot/modules/calculator.py
new file mode 100644
index 00000000..aa09d9dc
--- /dev/null
+++ b/userbot/modules/calculator.py
@@ -0,0 +1,67 @@
+# credits to @mrconfused
+import asyncio
+import inspect
+import io
+import sys
+import traceback
+
+from telethon import errors
+from telethon import events
+from telethon import functions
+from telethon import types
+
+from userbot import CMD_HELP
+from userbot.utils import admin_cmd
+
+
+@borg.on(admin_cmd(pattern="calc"))
+async def _(event):
+ if event.fwd_from or event.via_bot_id:
+ return
+ await event.edit("Processing ...")
+ cmd = event.text.split(" ", maxsplit=1)[1]
+ reply_to_id = event.message.id
+ if event.reply_to_msg_id:
+ reply_to_id = event.reply_to_msg_id
+
+ san = f"print({cmd})"
+ old_stderr = sys.stderr
+ old_stdout = sys.stdout
+ redirected_output = sys.stdout = io.StringIO()
+ redirected_error = sys.stderr = io.StringIO()
+ stdout, stderr, exc = None, None, None
+ try:
+ await aexec(san, event)
+ except Exception:
+ exc = traceback.format_exc()
+ stdout = redirected_output.getvalue()
+ stderr = redirected_error.getvalue()
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
+
+ evaluation = ""
+ if exc:
+ evaluation = exc
+ elif stderr:
+ evaluation = stderr
+ elif stdout:
+ evaluation = stdout
+ else:
+ evaluation = "Something went wrong"
+
+ final_output = "**EQUATION**: `{}` \n\n **SOLUTION**: \n`{}` \n".format(
+ cmd, evaluation)
+ await event.edit(final_output)
+
+
+async def aexec(code, event):
+ exec(f"async def __aexec(event): " + "".join(f"\n {l}"
+ for l in code.split("\n")))
+ return await locals()["__aexec"](event)
+
+
+CMD_HELP.update({
+ "calc":
+ "`.calc` your equation :\
+ \nUSAGE: solves the given maths equation by bodmass rule. "
+})
\ No newline at end of file
diff --git a/userbot/modules/calendar.py b/userbot/modules/calendar.py
new file mode 100644
index 00000000..a63a92aa
--- /dev/null
+++ b/userbot/modules/calendar.py
@@ -0,0 +1,40 @@
+"""Malayalam Calendar plugin for @UniBorg
+SYNTAX: .calendar YYYY-MM-DD"""
+import asyncio
+import json
+from datetime import datetime
+
+import requests
+from telethon import events
+from uniborg.util import admin_cmd
+
+
+@borg.on(admin_cmd(pattern="calendar (.*)"))
+async def _(event):
+ if event.fwd_from:
+ return
+ start = datetime.now()
+ input_str = event.pattern_match.group(1)
+ input_sgra = input_str.split("-")
+ if len(input_sgra) == 3:
+ yyyy = input_sgra[0]
+ mm = input_sgra[1]
+ dd = input_sgra[2]
+ required_url = "https://calendar.kollavarsham.org/api/years/{}/months/{}/days/{}?lang={}".format(
+ yyyy, mm, dd, "en")
+ headers = {"Accept": "application/json"}
+ response_content = requests.get(required_url, headers=headers).json()
+ a = ""
+ if "error" not in response_content:
+ current_date_detail_arraays = response_content["months"][0][
+ "days"][0]
+ a = json.dumps(current_date_detail_arraays,
+ sort_keys=True,
+ indent=4)
+ else:
+ a = response_content["error"]
+ await event.edit(str(a))
+ else:
+ await event.edit("SYNTAX: .calendar YYYY-MM-DD")
+ end = datetime.now()
+ ms = (end - start).seconds
\ No newline at end of file
diff --git a/userbot/modules/call.py b/userbot/modules/call.py
new file mode 100644
index 00000000..fdd097ea
--- /dev/null
+++ b/userbot/modules/call.py
@@ -0,0 +1,54 @@
+"""Emoji
+Available Commands:
+.emoji shrug
+.emoji apple
+.emoji :/
+.emoji -_-"""
+import asyncio
+
+from telethon import events
+
+
+@borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True))
+async def _(event):
+
+ if event.fwd_from:
+
+ return
+
+ animation_interval = 3
+
+ animation_ttl = range(0, 18)
+
+ input_str = event.pattern_match.group(1)
+
+ if input_str == "call":
+
+ await event.edit(input_str)
+
+ animation_chars = [
+ "`Connecting To Telegram Headquarters...`",
+ "`Call Connected.`",
+ "`Telegram: Hello This is Telegram HQ. Who is this?`",
+ "`Me: Yo this is` @TeleBotHelp admin ,`Please Connect me to my lil bro,Pavel Durov`",
+ "`User Authorised.`",
+ "`Calling Pavel Durov` `At +916969696969`",
+ "`Private Call Connected...`",
+ "`Me: Hello Sir, Please Ban This Telegram Account.`",
+ "`Pavel: May I Know Who Is This?`",
+ "`Me: Yo Brah, I Am` @Dark_Princ3 ",
+ "`Pavel: OMG!!! Long time no see, Wassup Brother...\nI'll Make Sure That Guy Account Will Get Blocked Within 24Hrs.`",
+ "`Me: Thanks, See You Later Brah.`",
+ "`Pavel: Please Don't Thank Brah, Telegram Is Our's. Just Gimme A Call When You Become Free.`",
+ "`Me: Is There Any Issue/Emergency???`",
+ "`Pavel: Yes Sur, There Is A Bug In Telegram v69.6.9.\nI Am Not Able To Fix It. If Possible, Please Help Fix The Bug.`",
+ "`Me: Send Me The App On My Telegram Account, I Will Fix The Bug & Send You.`",
+ "`Pavel: Sure Sur \nTC Bye Bye :)`",
+ "`Private Call Disconnected.`",
+ ]
+
+ for i in animation_ttl:
+
+ await asyncio.sleep(animation_interval)
+
+ await event.edit(animation_chars[i % 18])
\ No newline at end of file
diff --git a/userbot/modules/chatinfo.py b/userbot/modules/chatinfo.py
index e2c1a1aa..495a84f5 100644
--- a/userbot/modules/chatinfo.py
+++ b/userbot/modules/chatinfo.py
@@ -1,301 +1,257 @@
-# Copyright (C) 2019 The Raphielscape Company LLC.
-#
-# Licensed under the Raphielscape Public License, Version 1.d (the "License");
-# you may not use this file except in compliance with the License.
-#
-# Credits to Hitalo-Sama and FTG Modules
-
-from datetime import datetime
-from math import sqrt
-
-from emoji import emojize
-from telethon.errors import (
- ChannelInvalidError,
- ChannelPrivateError,
- ChannelPublicGroupNaError,
-)
-from telethon.tl.functions.channels import GetFullChannelRequest, GetParticipantsRequest
-from telethon.tl.functions.messages import GetFullChatRequest, GetHistoryRequest
-from telethon.tl.types import ChannelParticipantsAdmins, MessageActionChannelMigrateFrom
-from telethon.utils import get_input_location
-
-from userbot import CMD_HELP
-from userbot.events import register
-
-
-@register(pattern=".chatinfo(?: |$)(.*)", outgoing=True)
-async def info(event):
- await event.edit("`Analysing the chat...`")
- chat = await get_chatinfo(event)
- caption = await fetch_info(chat, event)
- try:
- await event.edit(caption, parse_mode="html")
- except Exception as e:
- print("Exception:", e)
- await event.edit("`An unexpected error has occurred.`")
- return
-
-
-async def get_chatinfo(event):
- chat = event.pattern_match.group(1)
- chat_info = None
- if chat:
- try:
- chat = int(chat)
- except ValueError:
- pass
- if not chat:
- if event.reply_to_msg_id:
- replied_msg = await event.get_reply_message()
- if replied_msg.fwd_from and replied_msg.fwd_from.channel_id is not None:
- chat = replied_msg.fwd_from.channel_id
- else:
- chat = event.chat_id
- try:
- chat_info = await event.client(GetFullChatRequest(chat))
- except BaseException:
- try:
- chat_info = await event.client(GetFullChannelRequest(chat))
- except ChannelInvalidError:
- await event.edit("`Invalid channel/group`")
- return None
- except ChannelPrivateError:
- await event.edit(
- "`This is a private channel/group or I am banned from there`"
- )
- return None
- except ChannelPublicGroupNaError:
- await event.edit("`Channel or supergroup doesn't exist`")
- return None
- except (TypeError, ValueError) as err:
- await event.edit(str(err))
- return None
- return chat_info
-
-
-async def fetch_info(chat, event):
- # chat.chats is a list so we use get_entity() to avoid IndexError
- chat_obj_info = await event.client.get_entity(chat.full_chat.id)
- broadcast = (
- chat_obj_info.broadcast if hasattr(chat_obj_info, "broadcast") else False
- )
- chat_type = "Channel" if broadcast else "Group"
- chat_title = chat_obj_info.title
- warn_emoji = emojize(":warning:")
- try:
- msg_info = await event.client(
- GetHistoryRequest(
- peer=chat_obj_info.id,
- offset_id=0,
- offset_date=datetime(2010, 1, 1),
- add_offset=-1,
- limit=1,
- max_id=0,
- min_id=0,
- hash=0,
- )
- )
- except Exception as e:
- msg_info = None
- print("Exception:", e)
- # No chance for IndexError as it checks for msg_info.messages first
- first_msg_valid = (
- True
- if msg_info and msg_info.messages and msg_info.messages[0].id == 1
- else False
- )
- # Same for msg_info.users
- creator_valid = True if first_msg_valid and msg_info.users else False
- creator_id = msg_info.users[0].id if creator_valid else None
- creator_firstname = (
- msg_info.users[0].first_name
- if creator_valid and msg_info.users[0].first_name is not None
- else "Deleted Account"
- )
- creator_username = (
- msg_info.users[0].username
- if creator_valid and msg_info.users[0].username is not None
- else None
- )
- created = msg_info.messages[0].date if first_msg_valid else None
- former_title = (
- msg_info.messages[0].action.title
- if first_msg_valid
- and isinstance(msg_info.messages[0].action, MessageActionChannelMigrateFrom)
- and msg_info.messages[0].action.title != chat_title
- else None
- )
- try:
- dc_id, location = get_input_location(chat.full_chat.chat_photo)
- except Exception as e:
- dc_id = "Unknown"
- str(e)
-
- # this is some spaghetti I need to change
- description = chat.full_chat.about
- members = (
- chat.full_chat.participants_count
- if hasattr(chat.full_chat, "participants_count")
- else chat_obj_info.participants_count
- )
- admins = (
- chat.full_chat.admins_count if hasattr(chat.full_chat, "admins_count") else None
- )
- banned_users = (
- chat.full_chat.kicked_count if hasattr(chat.full_chat, "kicked_count") else None
- )
- restrcited_users = (
- chat.full_chat.banned_count if hasattr(chat.full_chat, "banned_count") else None
- )
- members_online = (
- chat.full_chat.online_count if hasattr(chat.full_chat, "online_count") else 0
- )
- group_stickers = (
- chat.full_chat.stickerset.title
- if hasattr(chat.full_chat, "stickerset") and chat.full_chat.stickerset
- else None
- )
- messages_viewable = msg_info.count if msg_info else None
- messages_sent = (
- chat.full_chat.read_inbox_max_id
- if hasattr(chat.full_chat, "read_inbox_max_id")
- else None
- )
- messages_sent_alt = (
- chat.full_chat.read_outbox_max_id
- if hasattr(chat.full_chat, "read_outbox_max_id")
- else None
- )
- exp_count = chat.full_chat.pts if hasattr(chat.full_chat, "pts") else None
- username = chat_obj_info.username if hasattr(chat_obj_info, "username") else None
- bots_list = chat.full_chat.bot_info # this is a list
- bots = 0
- supergroup = (
- "Yes"
- if hasattr(chat_obj_info, "megagroup") and chat_obj_info.megagroup
- else "No"
- )
- slowmode = (
- "Yes"
- if hasattr(chat_obj_info, "slowmode_enabled") and chat_obj_info.slowmode_enabled
- else "No"
- )
- slowmode_time = (
- chat.full_chat.slowmode_seconds
- if hasattr(chat_obj_info, "slowmode_enabled") and chat_obj_info.slowmode_enabled
- else None
- )
- restricted = (
- "Yes"
- if hasattr(chat_obj_info, "restricted") and chat_obj_info.restricted
- else "No"
- )
- verified = (
- "Yes"
- if hasattr(chat_obj_info, "verified") and chat_obj_info.verified
- else "No"
- )
- username = "@{}".format(username) if username else None
- creator_username = "@{}".format(creator_username) if creator_username else None
- # end of spaghetti block
-
- if admins is None:
- # use this alternative way if chat.full_chat.admins_count is None,
- # works even without being an admin
- try:
- participants_admins = await event.client(
- GetParticipantsRequest(
- channel=chat.full_chat.id,
- filter=ChannelParticipantsAdmins(),
- offset=0,
- limit=0,
- hash=0,
- )
- )
- admins = participants_admins.count if participants_admins else None
- except Exception as e:
- print("Exception:", e)
- if bots_list:
- for bot in bots_list:
- bots += 1
-
- caption = "CHAT INFO:\n"
- caption += f"ID: {chat_obj_info.id}
\n"
- if chat_title is not None:
- caption += f"{chat_type} name: {chat_title}\n"
- if former_title is not None: # Meant is the very first title
- caption += f"Former name: {former_title}\n"
- if username is not None:
- caption += f"{chat_type} type: Public\n"
- caption += f"Link: {username}\n"
- else:
- caption += f"{chat_type} type: Private\n"
- if creator_username is not None:
- caption += f"Creator: {creator_username}\n"
- elif creator_valid:
- caption += (
- f'Creator: {creator_firstname}\n'
- )
- if created is not None:
- caption += f"Created: {created.date().strftime('%b %d, %Y')} - {created.time()}
\n"
- else:
- caption += f"Created: {chat_obj_info.date.date().strftime('%b %d, %Y')} - {chat_obj_info.date.time()}
{warn_emoji}\n"
- caption += f"Data Centre ID: {dc_id}\n"
- if exp_count is not None:
- chat_level = int((1 + sqrt(1 + 7 * exp_count / 14)) / 2)
- caption += f"{chat_type} level: {chat_level}
\n"
- if messages_viewable is not None:
- caption += f"Viewable messages: {messages_viewable}
\n"
- if messages_sent:
- caption += f"Messages sent: {messages_sent}
\n"
- elif messages_sent_alt:
- caption += f"Messages sent: {messages_sent_alt}
{warn_emoji}\n"
- if members is not None:
- caption += f"Members: {members}
\n"
- if admins is not None:
- caption += f"Administrators: {admins}
\n"
- if bots_list:
- caption += f"Bots: {bots}
\n"
- if members_online:
- caption += f"Currently online: {members_online}
\n"
- if restrcited_users is not None:
- caption += f"Restricted users: {restrcited_users}
\n"
- if banned_users is not None:
- caption += f"Banned users: {banned_users}
\n"
- if group_stickers is not None:
- caption += f'{chat_type} stickers: {group_stickers}\n'
- caption += "\n"
- if not broadcast:
- caption += f"Slow mode: {slowmode}"
- if (
- hasattr(chat_obj_info, "slowmode_enabled")
- and chat_obj_info.slowmode_enabled
- ):
- caption += f", {slowmode_time}s
\n\n"
- else:
- caption += "\n\n"
- if not broadcast:
- caption += f"Supergroup: {supergroup}\n\n"
- if hasattr(chat_obj_info, "restricted"):
- caption += f"Restricted: {restricted}\n"
- if chat_obj_info.restricted:
- caption += f"> Platform: {chat_obj_info.restriction_reason[0].platform}\n"
- caption += f"> Reason: {chat_obj_info.restriction_reason[0].reason}\n"
- caption += f"> Text: {chat_obj_info.restriction_reason[0].text}\n\n"
- else:
- caption += "\n"
- if hasattr(chat_obj_info, "scam") and chat_obj_info.scam:
- caption += "Scam: Yes\n\n"
- if hasattr(chat_obj_info, "verified"):
- caption += f"Verified by Telegram: {verified}\n\n"
- if description:
- caption += f"Description: \n{description}
\n"
- return caption
-
-
-CMD_HELP.update(
- {
- "chatinfo": ".chatinfo [optional: ]\
- \nUsage: Gets info of a chat. Some info might be limited due to missing permissions."
- }
-)
+# Copyright (C) 2019 The Raphielscape Company LLC.
+#
+# Licensed under the Raphielscape Public License, Version 1.d (the "License");
+# you may not use this file except in compliance with the License.
+#
+# Credits to Hitalo-Sama and FTG Modules
+from datetime import datetime
+from math import sqrt
+
+from emoji import emojize
+from telethon.errors import ChannelInvalidError
+from telethon.errors import ChannelPrivateError
+from telethon.errors import ChannelPublicGroupNaError
+from telethon.tl.functions.channels import GetFullChannelRequest
+from telethon.tl.functions.channels import GetParticipantsRequest
+from telethon.tl.functions.messages import GetFullChatRequest
+from telethon.tl.functions.messages import GetHistoryRequest
+from telethon.tl.types import ChannelParticipantsAdmins
+from telethon.tl.types import MessageActionChannelMigrateFrom
+from telethon.utils import get_input_location
+
+from userbot import CMD_HELP
+from userbot.events import register
+
+
+@register(pattern=".chatinfo(?: |$)(.*)", outgoing=True)
+async def info(event):
+ await event.edit("`Analysing the chat...`")
+ chat = await get_chatinfo(event)
+ caption = await fetch_info(chat, event)
+ try:
+ await event.edit(caption, parse_mode="html")
+ except Exception as e:
+ print("Exception:", e)
+ await event.edit("`An unexpected error has occurred.`")
+ return
+
+
+async def get_chatinfo(event):
+ chat = event.pattern_match.group(1)
+ chat_info = None
+ if chat:
+ try:
+ chat = int(chat)
+ except ValueError:
+ pass
+ if not chat:
+ if event.reply_to_msg_id:
+ replied_msg = await event.get_reply_message()
+ if replied_msg.fwd_from and replied_msg.fwd_from.channel_id is not None:
+ chat = replied_msg.fwd_from.channel_id
+ else:
+ chat = event.chat_id
+ try:
+ chat_info = await event.client(GetFullChatRequest(chat))
+ except BaseException:
+ try:
+ chat_info = await event.client(GetFullChannelRequest(chat))
+ except ChannelInvalidError:
+ await event.edit("`Invalid channel/group`")
+ return None
+ except ChannelPrivateError:
+ await event.edit(
+ "`This is a private channel/group or I am banned from there`")
+ return None
+ except ChannelPublicGroupNaError:
+ await event.edit("`Channel or supergroup doesn't exist`")
+ return None
+ except (TypeError, ValueError) as err:
+ await event.edit(str(err))
+ return None
+ return chat_info
+
+
+async def fetch_info(chat, event):
+ # chat.chats is a list so we use get_entity() to avoid IndexError
+ chat_obj_info = await event.client.get_entity(chat.full_chat.id)
+ broadcast = (chat_obj_info.broadcast
+ if hasattr(chat_obj_info, "broadcast") else False)
+ chat_type = "Channel" if broadcast else "Group"
+ chat_title = chat_obj_info.title
+ warn_emoji = emojize(":warning:")
+ try:
+ msg_info = await event.client(
+ GetHistoryRequest(
+ peer=chat_obj_info.id,
+ offset_id=0,
+ offset_date=datetime(2010, 1, 1),
+ add_offset=-1,
+ limit=1,
+ max_id=0,
+ min_id=0,
+ hash=0,
+ ))
+ except Exception as e:
+ msg_info = None
+ print("Exception:", e)
+ # No chance for IndexError as it checks for msg_info.messages first
+ first_msg_valid = (True if msg_info and msg_info.messages
+ and msg_info.messages[0].id == 1 else False)
+ # Same for msg_info.users
+ creator_valid = True if first_msg_valid and msg_info.users else False
+ creator_id = msg_info.users[0].id if creator_valid else None
+ creator_firstname = (msg_info.users[0].first_name if creator_valid
+ and msg_info.users[0].first_name is not None else
+ "Deleted Account")
+ creator_username = (msg_info.users[0].username if creator_valid
+ and msg_info.users[0].username is not None else None)
+ created = msg_info.messages[0].date if first_msg_valid else None
+ former_title = (
+ msg_info.messages[0].action.title if first_msg_valid and isinstance(
+ msg_info.messages[0].action, MessageActionChannelMigrateFrom)
+ and msg_info.messages[0].action.title != chat_title else None)
+ try:
+ dc_id, location = get_input_location(chat.full_chat.chat_photo)
+ except Exception as e:
+ dc_id = "Unknown"
+ str(e)
+
+ # this is some spaghetti I need to change
+ description = chat.full_chat.about
+ members = (chat.full_chat.participants_count if hasattr(
+ chat.full_chat, "participants_count") else
+ chat_obj_info.participants_count)
+ admins = (chat.full_chat.admins_count
+ if hasattr(chat.full_chat, "admins_count") else None)
+ banned_users = (chat.full_chat.kicked_count if hasattr(
+ chat.full_chat, "kicked_count") else None)
+ restrcited_users = (chat.full_chat.banned_count if hasattr(
+ chat.full_chat, "banned_count") else None)
+ members_online = (chat.full_chat.online_count if hasattr(
+ chat.full_chat, "online_count") else 0)
+ group_stickers = (chat.full_chat.stickerset.title
+ if hasattr(chat.full_chat, "stickerset")
+ and chat.full_chat.stickerset else None)
+ messages_viewable = msg_info.count if msg_info else None
+ messages_sent = (chat.full_chat.read_inbox_max_id if hasattr(
+ chat.full_chat, "read_inbox_max_id") else None)
+ messages_sent_alt = (chat.full_chat.read_outbox_max_id if hasattr(
+ chat.full_chat, "read_outbox_max_id") else None)
+ exp_count = chat.full_chat.pts if hasattr(chat.full_chat, "pts") else None
+ username = chat_obj_info.username if hasattr(chat_obj_info,
+ "username") else None
+ bots_list = chat.full_chat.bot_info # this is a list
+ bots = 0
+ supergroup = ("Yes" if hasattr(chat_obj_info, "megagroup")
+ and chat_obj_info.megagroup else "No")
+ slowmode = ("Yes" if hasattr(chat_obj_info, "slowmode_enabled")
+ and chat_obj_info.slowmode_enabled else "No")
+ slowmode_time = (chat.full_chat.slowmode_seconds
+ if hasattr(chat_obj_info, "slowmode_enabled")
+ and chat_obj_info.slowmode_enabled else None)
+ restricted = ("Yes" if hasattr(chat_obj_info, "restricted")
+ and chat_obj_info.restricted else "No")
+ verified = ("Yes" if hasattr(chat_obj_info, "verified")
+ and chat_obj_info.verified else "No")
+ username = "@{}".format(username) if username else None
+ creator_username = "@{}".format(
+ creator_username) if creator_username else None
+ # end of spaghetti block
+
+ if admins is None:
+ # use this alternative way if chat.full_chat.admins_count is None,
+ # works even without being an admin
+ try:
+ participants_admins = await event.client(
+ GetParticipantsRequest(
+ channel=chat.full_chat.id,
+ filter=ChannelParticipantsAdmins(),
+ offset=0,
+ limit=0,
+ hash=0,
+ ))
+ admins = participants_admins.count if participants_admins else None
+ except Exception as e:
+ print("Exception:", e)
+ if bots_list:
+ for bot in bots_list:
+ bots += 1
+
+ caption = "CHAT INFO:\n"
+ caption += f"ID: {chat_obj_info.id}
\n"
+ if chat_title is not None:
+ caption += f"{chat_type} name: {chat_title}\n"
+ if former_title is not None: # Meant is the very first title
+ caption += f"Former name: {former_title}\n"
+ if username is not None:
+ caption += f"{chat_type} type: Public\n"
+ caption += f"Link: {username}\n"
+ else:
+ caption += f"{chat_type} type: Private\n"
+ if creator_username is not None:
+ caption += f"Creator: {creator_username}\n"
+ elif creator_valid:
+ caption += (
+ f'Creator: {creator_firstname}\n'
+ )
+ if created is not None:
+ caption += f"Created: {created.date().strftime('%b %d, %Y')} - {created.time()}
\n"
+ else:
+ caption += f"Created: {chat_obj_info.date.date().strftime('%b %d, %Y')} - {chat_obj_info.date.time()}
{warn_emoji}\n"
+ caption += f"Data Centre ID: {dc_id}\n"
+ if exp_count is not None:
+ chat_level = int((1 + sqrt(1 + 7 * exp_count / 14)) / 2)
+ caption += f"{chat_type} level: {chat_level}
\n"
+ if messages_viewable is not None:
+ caption += f"Viewable messages: {messages_viewable}
\n"
+ if messages_sent:
+ caption += f"Messages sent: {messages_sent}
\n"
+ elif messages_sent_alt:
+ caption += f"Messages sent: {messages_sent_alt}
{warn_emoji}\n"
+ if members is not None:
+ caption += f"Members: {members}
\n"
+ if admins is not None:
+ caption += f"Administrators: {admins}
\n"
+ if bots_list:
+ caption += f"Bots: {bots}
\n"
+ if members_online:
+ caption += f"Currently online: {members_online}
\n"
+ if restrcited_users is not None:
+ caption += f"Restricted users: {restrcited_users}
\n"
+ if banned_users is not None:
+ caption += f"Banned users: {banned_users}
\n"
+ if group_stickers is not None:
+ caption += f'{chat_type} stickers: {group_stickers}\n'
+ caption += "\n"
+ if not broadcast:
+ caption += f"Slow mode: {slowmode}"
+ if (hasattr(chat_obj_info, "slowmode_enabled")
+ and chat_obj_info.slowmode_enabled):
+ caption += f", {slowmode_time}s
\n\n"
+ else:
+ caption += "\n\n"
+ if not broadcast:
+ caption += f"Supergroup: {supergroup}\n\n"
+ if hasattr(chat_obj_info, "restricted"):
+ caption += f"Restricted: {restricted}\n"
+ if chat_obj_info.restricted:
+ caption += f"> Platform: {chat_obj_info.restriction_reason[0].platform}\n"
+ caption += f"> Reason: {chat_obj_info.restriction_reason[0].reason}\n"
+ caption += f"> Text: {chat_obj_info.restriction_reason[0].text}\n\n"
+ else:
+ caption += "\n"
+ if hasattr(chat_obj_info, "scam") and chat_obj_info.scam:
+ caption += "Scam: Yes\n\n"
+ if hasattr(chat_obj_info, "verified"):
+ caption += f"Verified by Telegram: {verified}\n\n"
+ if description:
+ caption += f"Description: \n{description}
\n"
+ return caption
+
+
+CMD_HELP.update({
+ "chatinfo":
+ ".chatinfo [optional: ]\
+ \nUsage: Gets info of a chat. Some info might be limited due to missing permissions."
+})
\ No newline at end of file
diff --git a/userbot/modules/clock_name.py b/userbot/modules/clock_name.py
new file mode 100644
index 00000000..feaecbd7
--- /dev/null
+++ b/userbot/modules/clock_name.py
@@ -0,0 +1,40 @@
+"""COMMAND : .cname"""
+import asyncio
+import time
+
+from telethon.errors import FloodWaitError
+from telethon.tl import functions
+
+from userbot import ALIVE_NAME
+from userbot import CMD_HELP
+from userbot.utils import admin_cmd
+
+DEL_TIME_OUT = 60
+
+DEFAULTUSER = (str(ALIVE_NAME)
+ if ALIVE_NAME else "Set ALIVE_NAME in config vars in Heroku")
+
+
+@borg.on(admin_cmd(pattern="cname")) # pylint:disable=E0602
+async def _(event):
+ if event.fwd_from:
+ return
+ while True:
+ DMY = time.strftime("%d.%m.%y")
+ HM = time.strftime("%H:%M")
+ name = f"{HM}🔥{DEFAULTUSER}🔥{DMY}"
+ logger.info(name)
+ try:
+ await borg(
+ functions.account.UpdateProfileRequest( # pylint:disable=E0602
+ last_name=name))
+ except FloodWaitError as ex:
+ logger.warning(str(e))
+ await asyncio.sleep(ex.seconds)
+ # else:
+ # logger.info(r.stringify())
+ # await borg.send_message( # pylint:disable=E0602
+ # Config.PRIVATE_GROUP_BOT_API_ID, # pylint:disable=E0602
+ # "Changed Profile Picture"
+ # )
+ await asyncio.sleep(DEL_TIME_OUT)
\ No newline at end of file
diff --git a/userbot/modules/ctext.py b/userbot/modules/ctext.py
new file mode 100644
index 00000000..5000d2d3
--- /dev/null
+++ b/userbot/modules/ctext.py
@@ -0,0 +1,27 @@
+import asyncio
+import os
+import sys
+
+from telethon import events
+
+from userbot import utils
+
+
+@borg.on(utils.admin_cmd(pattern="ctext ?(.*)"))
+async def payf(event):
+ paytext = event.pattern_match.group(1)
+ pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format(
+ paytext * 8,
+ paytext * 8,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 2,
+ paytext * 8,
+ paytext * 8,
+ )
+ await event.edit(pay)
\ No newline at end of file
diff --git a/userbot/modules/ctg.py b/userbot/modules/ctg.py
new file mode 100644
index 00000000..0463d0e5
--- /dev/null
+++ b/userbot/modules/ctg.py
@@ -0,0 +1,36 @@
+import datetime
+
+from telethon import events
+from telethon.errors.rpcerrorlist import YouBlockedUserError
+from telethon.tl.functions.account import UpdateNotifySettingsRequest
+from uniborg.util import admin_cmd
+
+
+@borg.on(admin_cmd(pattern="ctg ?(.*)"))
+async def _(event):
+ if event.fwd_from:
+ return
+ if not event.reply_to_msg_id:
+ await event.edit("```Reply to a Link.```")
+ return
+ reply_message = await event.get_reply_message()
+ if not reply_message.text:
+ await event.edit("```Reply to a Link```")
+ return
+ chat = "@chotamreaderbot"
+ sender = reply_message.sender
+ await event.edit("```Processing```")
+ async with event.client.conversation(chat) as conv:
+ try:
+ response = conv.wait_event(
+ events.NewMessage(incoming=True, from_users=272572121))
+ await event.client.forward_messages(chat, reply_message)
+ response = await response
+ except YouBlockedUserError:
+ await event.reply("`RIP Check Your Blacklist Boss`")
+ return
+ if response.text.startswith(""):
+ await event.edit("Am I Dumb Or Am I Dumb?")
+ else:
+ await event.delete()
+ await event.client.send_message(event.chat_id, response.message)
\ No newline at end of file
diff --git a/userbot/modules/dartndice.py b/userbot/modules/dartndice.py
new file mode 100644
index 00000000..c14bbc90
--- /dev/null
+++ b/userbot/modules/dartndice.py
@@ -0,0 +1,32 @@
+from telethon.tl.types import InputMediaDice
+
+from userbot.utils import admin_cmd
+
+# EMOJI CONSTANTS
+DART_E_MOJI = "🎯"
+DICE_E_MOJI = "🎲"
+BALL_E_MOJI = "🏀"
+# EMOJI CONSTANTS
+
+
+@borg.on(
+ admin_cmd(pattern=f"({DART_E_MOJI}|{DICE_E_MOJI}|{BALL_E_MOJI}) ?(.*)"))
+async def _(event):
+ if event.fwd_from:
+ return
+ reply_message = event
+ if event.reply_to_msg_id:
+ reply_message = await event.get_reply_message()
+ emoticon = event.pattern_match.group(1)
+ input_str = event.pattern_match.group(2)
+ await event.delete()
+ r = await reply_message.reply(file=InputMediaDice(emoticon=emoticon))
+ if input_str:
+ try:
+ required_number = int(input_str)
+ while not r.media.value == required_number:
+ await r.delete()
+ r = await reply_message.reply(file=InputMediaDice(
+ emoticon=emoticon))
+ except:
+ pass
\ No newline at end of file
diff --git a/userbot/modules/dice_dart_ball.py b/userbot/modules/dice_dart_ball.py
new file mode 100644
index 00000000..c14bbc90
--- /dev/null
+++ b/userbot/modules/dice_dart_ball.py
@@ -0,0 +1,32 @@
+from telethon.tl.types import InputMediaDice
+
+from userbot.utils import admin_cmd
+
+# EMOJI CONSTANTS
+DART_E_MOJI = "🎯"
+DICE_E_MOJI = "🎲"
+BALL_E_MOJI = "🏀"
+# EMOJI CONSTANTS
+
+
+@borg.on(
+ admin_cmd(pattern=f"({DART_E_MOJI}|{DICE_E_MOJI}|{BALL_E_MOJI}) ?(.*)"))
+async def _(event):
+ if event.fwd_from:
+ return
+ reply_message = event
+ if event.reply_to_msg_id:
+ reply_message = await event.get_reply_message()
+ emoticon = event.pattern_match.group(1)
+ input_str = event.pattern_match.group(2)
+ await event.delete()
+ r = await reply_message.reply(file=InputMediaDice(emoticon=emoticon))
+ if input_str:
+ try:
+ required_number = int(input_str)
+ while not r.media.value == required_number:
+ await r.delete()
+ r = await reply_message.reply(file=InputMediaDice(
+ emoticon=emoticon))
+ except:
+ pass
\ No newline at end of file
diff --git a/userbot/modules/dlinks.py b/userbot/modules/dlinks.py
new file mode 100644
index 00000000..138fe05f
--- /dev/null
+++ b/userbot/modules/dlinks.py
@@ -0,0 +1,337 @@
+# Copyright (C) 2019 The Raphielscape Company LLC.
+#
+# Licensed under the Raphielscape Public License, Version 1.d (the "License");
+# you may not use this file except in compliance with the License.
+# Re-written by @its_xditya for TeleBot
+""" Userbot module containing various sites direct links generators"""
+import json
+import re
+import urllib.parse
+from random import choice
+from subprocess import PIPE
+from subprocess import Popen
+
+import requests
+from bs4 import BeautifulSoup
+from humanize import naturalsize
+
+from userbot import CMD_HELP
+from userbot.events import register
+
+
+def subprocess_run(cmd):
+ reply = ""
+ subproc = Popen(
+ cmd,
+ stdout=PIPE,
+ stderr=PIPE,
+ shell=True,
+ universal_newlines=True,
+ executable="bash",
+ )
+ talk = subproc.communicate()
+ exitCode = subproc.returncode
+ if exitCode != 0:
+ reply += ("```An error was detected while running the subprocess:\n"
+ f"exit code: {exitCode}\n"
+ f"stdout: {talk[0]}\n"
+ f"stderr: {talk[1]}```")
+ return reply
+ return talk
+
+
+@register(outgoing=True, pattern=r"^\.direct(?: |$)([\s\S]*)")
+async def direct_link_generator(request):
+ """ direct links generator """
+ await request.edit("`Processing...`")
+ textx = await request.get_reply_message()
+ message = request.pattern_match.group(1)
+ if message:
+ pass
+ elif textx:
+ message = textx.text
+ else:
+ await request.edit("`Usage: .direct `")
+ return
+ reply = ""
+ links = re.findall(r"\bhttps?://.*\.\S+", message)
+ if not links:
+ reply = "`No links found!`"
+ await request.edit(reply)
+ for link in links:
+ if "drive.google.com" in link:
+ reply += gdrive(link)
+ elif "zippyshare.com" in link:
+ reply += zippy_share(link)
+ elif "yadi.sk" in link:
+ reply += yandex_disk(link)
+ elif "cloud.mail.ru" in link:
+ reply += cm_ru(link)
+ elif "mediafire.com" in link:
+ reply += mediafire(link)
+ elif "sourceforge.net" in link:
+ reply += sourceforge(link)
+ elif "osdn.net" in link:
+ reply += osdn(link)
+ elif "androidfilehost.com" in link:
+ reply += androidfilehost(link)
+ else:
+ reply += re.findall(r"\bhttps?://(.*?[^/]+)",
+ link)[0] + "is not supported"
+ await request.edit(reply)
+
+
+def gdrive(url: str) -> str:
+ """ GDrive direct links generator """
+ drive = "https://drive.google.com"
+ try:
+ link = re.findall(r"\bhttps?://drive\.google\.com\S+", url)[0]
+ except IndexError:
+ reply = "`No Google drive links found`\n"
+ return reply
+ file_id = ""
+ reply = ""
+ if link.find("view") != -1:
+ file_id = link.split("/")[-2]
+ elif link.find("open?id=") != -1:
+ file_id = link.split("open?id=")[1].strip()
+ elif link.find("uc?id=") != -1:
+ file_id = link.split("uc?id=")[1].strip()
+ url = f"{drive}/uc?export=download&id={file_id}"
+ download = requests.get(url, stream=True, allow_redirects=False)
+ cookies = download.cookies
+ try:
+ # In case of small file size, Google downloads directly
+ dl_url = download.headers["location"]
+ if "accounts.google.com" in dl_url: # non-public file
+ reply += "`Link is not public!`\n"
+ return reply
+ name = "Direct Download Link"
+ except KeyError:
+ # In case of download warning page
+ page = BeautifulSoup(download.content, "lxml")
+ export = drive + page.find("a", {"id": "uc-download-link"}).get("href")
+ name = page.find("span", {"class": "uc-name-size"}).text
+ response = requests.get(export,
+ stream=True,
+ allow_redirects=False,
+ cookies=cookies)
+ dl_url = response.headers["location"]
+ if "accounts.google.com" in dl_url:
+ reply += "Link is not public!"
+ return reply
+ reply += f"[{name}]({dl_url})\n"
+ return reply
+
+
+def zippy_share(url: str) -> str:
+ """ZippyShare direct links generator
+ Based on https://github.com/LameLemon/ziggy"""
+ reply = ""
+ dl_url = ""
+ try:
+ link = re.findall(r"\bhttps?://.*zippyshare\.com\S+", url)[0]
+ except IndexError:
+ reply = "`No ZippyShare links found`\n"
+ return reply
+ session = requests.Session()
+ base_url = re.search("http.+.com", link).group()
+ response = session.get(link)
+ page_soup = BeautifulSoup(response.content, "lxml")
+ scripts = page_soup.find_all("script", {"type": "text/javascript"})
+ for script in scripts:
+ if "getElementById('dlbutton')" in script.text:
+ url_raw = re.search(r"= (?P\".+\" \+ (?P