diff --git a/userbot/__init__.py b/userbot/__init__.py
index 705a2bae..67714318 100644
--- a/userbot/__init__.py
+++ b/userbot/__init__.py
@@ -576,7 +576,7 @@ async def on_plug_in_callback_query_handler(event):
current_page_number = int(looters)
buttons = paginate_help(current_page_number, dugmeler, "helpme")
text = f"**GeezProjects Inline Menu**\n\n🔸 **Owner** [{user.first_name}](tg://user?id={user.id})\n• **Jumlah** `{len(dugmeler)}` Module"
- await event.edit(
+ await edit_or_reply(
text,
file=logogeez,
buttons=buttons,
@@ -595,7 +595,7 @@ async def on_plug_in_callback_query_handler(event):
if event.query.user_id == uid or event.query.user_id in SUDO_USERS:
current_page_number = int(event.data_match.group(1).decode("UTF-8"))
buttons = paginate_help(current_page_number + 1, dugmeler, "helpme")
- await event.edit(buttons=buttons)
+ await edit_or_reply(buttons=buttons)
else:
reply_pop_up_alert = (
f"Kamu Tidak diizinkan, ini Userbot Milik {ALIVE_NAME}"
@@ -606,7 +606,7 @@ async def on_plug_in_callback_query_handler(event):
async def on_plug_in_callback_query_handler(event):
if event.query.user_id == uid or event.query.user_id in DEVS and SUDO_USERS:
openlagi = custom.Button.inline("• Re-Open Menu •", data="reopen")
- await event.edit(
+ await edit_or_reply(
"❌ **Help Mode Button Ditutup!** ❌", buttons=openlagi
)
else:
@@ -622,7 +622,7 @@ async def on_plug_in_callback_query_handler(event):
if event.query.user_id == uid or event.query.user_id in SUDO_USERS:
current_page_number = int(event.data_match.group(1).decode("UTF-8"))
buttons = paginate_help(current_page_number - 1, dugmeler, "helpme")
- await event.edit(buttons=buttons)
+ await edit_or_reply(buttons=buttons)
else:
reply_pop_up_alert = f"Kamu Tidak diizinkan, ini Userbot Milik {owner}"
await event.answer(reply_pop_up_alert, cache_time=0, alert=True)
diff --git a/userbot/modules/aeshtetic.py b/userbot/modules/aeshtetic.py
index 0f90de51..02834ce4 100644
--- a/userbot/modules/aeshtetic.py
+++ b/userbot/modules/aeshtetic.py
@@ -8,7 +8,7 @@
from telethon import events
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
PRINTABLE_ASCII = range(0x21, 0x7F)
@@ -24,13 +24,13 @@ def aesthetify(string):
yield chr(c)
-@bot.on(geez_cmd(outgoing=True, pattern="ae(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="ae(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
text = event.pattern_match.group(1)
text = "".join(aesthetify(text))
- await event.edit(text=text, parse_mode=None, link_preview=False)
+ await edit_or_reply(text=text, parse_mode=None, link_preview=False)
raise events.StopPropagation
diff --git a/userbot/modules/afk.py b/userbot/modules/afk.py
index 89ad0e4f..d629c9dd 100644
--- a/userbot/modules/afk.py
+++ b/userbot/modules/afk.py
@@ -23,8 +23,8 @@
afk_start = {}
-@bot.on(events.NewMessage(outgoing=True))
-@bot.on(events.MessageEdited(outgoing=True))
+@geez_cmd(events.NewMessage(outgoing=True))
+@geez_cmd(events.MessageEdited(outgoing=True))
async def set_not_afk(event):
global USER_AFK
global afk_time
@@ -72,7 +72,7 @@ async def set_not_afk(event):
await bash("rm -rf *.jpg")
-@bot.on(
+@geez_cmd(
events.NewMessage(incoming=True, func=lambda e: bool(e.mentioned or e.is_private))
)
async def on_afk(event):
@@ -125,7 +125,7 @@ async def on_afk(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern="afk(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="afk(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
diff --git a/userbot/modules/amongus.py b/userbot/modules/amongus.py
index 47d77196..59a8e768 100644
--- a/userbot/modules/amongus.py
+++ b/userbot/modules/amongus.py
@@ -13,11 +13,11 @@
from requests import get
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"imp (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"imp (.*)"))
async def f_load(message):
clrs = {
"red": 1,
diff --git a/userbot/modules/android.py b/userbot/modules/android.py
index 12ac0902..556656da 100644
--- a/userbot/modules/android.py
+++ b/userbot/modules/android.py
@@ -16,7 +16,7 @@
from requests import get
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
+from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY
from userbot.events import geez_cmd
from userbot.utils import chrome, human_to_bytes, humanbytes, md5, time_formatter
@@ -27,7 +27,7 @@
)
-@bot.on(geez_cmd(outgoing=True, pattern="magisk$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="magisk$"))
async def magisk(request):
"""magisk latest releases"""
magisk_dict = {
@@ -51,7 +51,7 @@ async def magisk(request):
await request.edit(releases)
-@bot.on(geez_cmd(outgoing=True, pattern=r"device(?: |$)(\S*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"device(?: |$)(\S*)"))
async def device_info(request):
"""get android device basic info from its codename"""
textx = await request.get_reply_message()
@@ -81,7 +81,7 @@ async def device_info(request):
await request.edit(reply)
-@bot.on(geez_cmd(outgoing=True, pattern=r"codename(?: |)([\S]*)(?: |)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"codename(?: |)([\S]*)(?: |)([\s\S]*)"))
async def codename_info(request):
"""search for android codename"""
textx = await request.get_reply_message()
@@ -118,7 +118,7 @@ async def codename_info(request):
await request.edit(reply)
-@bot.on(geez_cmd(outgoing=True, pattern="pixeldl(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="pixeldl(?: |$)(.*)"))
async def download_api(dl):
await dl.edit("`Collecting information...`")
URL = dl.pattern_match.group(1)
@@ -222,7 +222,7 @@ async def download_api(dl):
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"specs(?: |)([\S]*)(?: |)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"specs(?: |)([\S]*)(?: |)([\s\S]*)"))
async def devices_specifications(request):
"""Mobile devices specifications"""
textx = await request.get_reply_message()
@@ -281,7 +281,7 @@ async def devices_specifications(request):
await request.edit(reply)
-@bot.on(geez_cmd(outgoing=True, pattern=r"twrp(?: |$)(\S*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"twrp(?: |$)(\S*)"))
async def twrp(request):
"""get android device twrp"""
textx = await request.get_reply_message()
diff --git a/userbot/modules/anilist.py b/userbot/modules/anilist.py
index b25c7d79..05f05aff 100644
--- a/userbot/modules/anilist.py
+++ b/userbot/modules/anilist.py
@@ -196,7 +196,7 @@ async def formatJSON(outData):
url = "https://graphql.anilist.co"
-@bot.on(geez_cmd(outgoing=True, pattern=r"anichar ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"anichar ?(.*)"))
async def anilist(event):
search = event.pattern_match.group(1)
reply_to_id = event.message.id
@@ -221,12 +221,12 @@ async def anilist(event):
event.chat_id, image, caption=msg, parse_mode="md", reply_to=reply_to_id
)
else:
- await event.edit(msg)
+ await edit_or_reply(msg)
else:
- await event.edit("Sorry, No such results")
+ await edit_or_reply("Sorry, No such results")
-@bot.on(geez_cmd(outgoing=True, pattern=r"airing ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"airing ?(.*)"))
async def anilist(event):
search = event.pattern_match.group(1)
variables = {"search": search}
@@ -240,10 +240,10 @@ async def anilist(event):
ms_g += f"\n**Episode**: `{response['nextAiringEpisode']['episode']}`\n**Airing In**: `{airing_time_final}`"
else:
ms_g += f"\n**Episode**:{response['episodes']}\n**Status**: `N/A`"
- await event.edit(ms_g)
+ await edit_or_reply(ms_g)
-@bot.on(geez_cmd(outgoing=True, pattern=r"animanga ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"animanga ?(.*)"))
async def anilist(event):
search = event.pattern_match.group(1)
reply_to_id = event.message.id
@@ -299,15 +299,15 @@ async def anilist(event):
await event.delete()
except BaseException:
ms_g += f" [〽️]({image})"
- await event.edit(ms_g)
+ await edit_or_reply(ms_g)
else:
- await event.edit(ms_g)
+ await edit_or_reply(ms_g)
-@bot.on(geez_cmd(outgoing=True, pattern=r"anilist ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"anilist ?(.*)"))
async def anilist(event):
input_str = event.pattern_match.group(1)
- event = await event.edit("Searching...")
+ event = await edit_or_reply("Searching...")
result = await callAPI(input_str)
msg = await formatJSON(result)
- await event.edit(msg, link_preview=True)
+ await edit_or_reply(msg, link_preview=True)
diff --git a/userbot/modules/animals.py b/userbot/modules/animals.py
index fa7147bc..5242c603 100644
--- a/userbot/modules/animals.py
+++ b/userbot/modules/animals.py
@@ -20,27 +20,27 @@
import requests
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern="shibe$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="shibe$"))
async def shibe(event):
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
response = requests.get("https://shibe.online/api/shibes").json()
if not response:
- await event.edit("**Tidak bisa menemukan Anjing.**")
+ await edit_or_reply("**Tidak bisa menemukan Anjing.**")
return
await event.client.send_message(entity=event.chat_id, file=response[0])
await event.delete()
-@bot.on(geez_cmd(outgoing=True, pattern="cat$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="cat$"))
async def cats(event):
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
response = requests.get("https://shibe.online/api/cats").json()
if not response:
- await event.edit("**Tidak bisa menemukan kucing.**")
+ await edit_or_reply("**Tidak bisa menemukan kucing.**")
return
await event.client.send_message(entity=event.chat_id, file=response[0])
await event.delete()
diff --git a/userbot/modules/animation.py b/userbot/modules/animation.py
index 04047d39..a87c8e90 100644
--- a/userbot/modules/animation.py
+++ b/userbot/modules/animation.py
@@ -2,11 +2,11 @@
from time import sleep
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -17,7 +17,7 @@ async def _(event):
if input_str == "bulan":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"🌗",
@@ -62,10 +62,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 32])
+ await edit_or_reply(animation_chars[i % 32])
-@bot.on(geez_cmd(outgoing=True, pattern=r"sayang$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"sayang$"))
async def _(e):
await e.edit("I LOVEE YOUUU 💕")
await e.edit("💝💘💓💗")
@@ -93,7 +93,7 @@ async def _(e):
await e.edit("SAYANG KAMU💞")
-@bot.on(geez_cmd(outgoing=True, pattern=r"dino(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"dino(?: |$)(.*)"))
async def _(typew):
await typew.edit("`DIN DINNN.....`")
sleep(1)
@@ -150,7 +150,7 @@ async def _(typew):
await typew.edit("`-TAMAT-`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"gabut$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gabut$"))
async def _(e):
await e.edit("`PERNAAHHHHH KAHHH KAUUU MENGIRA`")
await e.edit("`SEPEEERTIIIII APAAAA BENTUKKKKKKK CINTAAAA`")
@@ -406,7 +406,7 @@ async def _(e):
await e.edit("`GABUT`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"terkadang(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"terkadang(?: |$)(.*)"))
async def _(typew):
await typew.edit("`Terkadang`")
sleep(1)
@@ -424,12 +424,12 @@ async def _(typew):
# Create by myself @localheart
-@bot.on(geez_cmd(outgoing=True, pattern=r"mf$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"mf$"))
async def _(e):
await e.edit("`mf g dl` **ミ(ノ;_ _)ノ=3** ")
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -440,7 +440,7 @@ async def _(event):
if input_str == "cinta":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting Ke Server Cinta`",
@@ -464,10 +464,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(outgoing=True, pattern=r"gombal(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gombal(?: |$)(.*)"))
async def _(typew):
sleep(1)
await typew.edit("`Hai, I LOVE YOU 💞`")
@@ -494,7 +494,7 @@ async def _(typew):
# Create by myself @localheart
-@bot.on(geez_cmd(outgoing=True, pattern=r"helikopter(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"helikopter(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"▬▬▬.◙.▬▬▬ \n"
@@ -516,14 +516,14 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"tembak(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"tembak(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"_/﹋\\_\n" "(҂`_´)\n" "<,︻╦╤─ ҉\n" r"_/﹋\_" "\n**Mau Jadi Pacarku Gak?!**"
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"bundir(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bundir(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"`Dadah Semuanya...` \n |"
@@ -543,7 +543,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"awk(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"awk(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"────██──────▀▀▀██\n"
@@ -554,7 +554,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"ular(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"ular(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"░░░░▓\n"
@@ -645,7 +645,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"y(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"y(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"‡‡‡‡‡‡‡‡‡‡‡‡▄▄▄▄\n"
@@ -664,7 +664,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"tank(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"tank(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"█۞███████]▄▄▄▄▄▄▄▄▄▄▃ \n"
@@ -674,7 +674,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"babi(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"babi(?: |$)(.*)"))
async def typewriter(typew):
await typew.edit(
"┈┈┏━╮╭━┓┈╭━━━━╮\n"
@@ -688,7 +688,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"ajg(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"ajg(?: |$)(.*)"))
async def _(typew):
await typew.edit(
"╥━━━━━━━━╭━━╮━━┳\n"
@@ -700,7 +700,7 @@ async def _(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"bernyanyi(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bernyanyi(?: |$)(.*)"))
async def _(typew):
await typew.edit("**Ganteng Doang Gak Bernyanyi (ง˙o˙)ว**")
sleep(2)
@@ -735,7 +735,7 @@ async def _(typew):
await typew.edit("**♪┗ ( ・o・) ┓♪┏ (・o・) ┛♪**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"hua$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"hua$"))
async def _(e):
await e.edit("أ‿أ")
await e.edit("╥﹏╥")
@@ -769,7 +769,7 @@ async def _(e):
await e.edit("༼ ༎ຶ ෴ ༎ຶ༽")
-@bot.on(geez_cmd(outgoing=True, pattern=r"huh(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"huh(?: |$)(.*)"))
async def _(typew):
await typew.edit("`\n(\\_/)`" "`\n(●_●)`" "`\n />❤️ *Ini Buat Kamu`")
sleep(3)
@@ -778,7 +778,7 @@ async def _(typew):
await typew.edit("`\n(\\_/)`" "`\n(●_●)`" "`\n💔<\\ *Terimakasih`")
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -789,7 +789,7 @@ async def _(event):
if input_str == "ceritacinta":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Cerita ❤️ Cinta` ",
@@ -816,10 +816,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 103])
+ await edit_or_reply(animation_chars[i % 103])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -830,7 +830,7 @@ async def _(event):
if input_str == "canda":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀\n ⠀⣴⠿⠏⠀⠀⠀⠀⠀ ⢳⡀⠀⡏⠀⠀⠀ ⠀⢷\n⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀⠀ ⠀ ⡇\n⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿ ⣸ Kamu ⡇\n ⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀ ⣿ ⢹⠀ ⡇\n ⠙⢿⣯⠄⠀⠀⠀__⠀⠀⡿ ⠀⡇⠀⠀⠀⠀ ⡼\n⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀ ⠘⠤⣄⣠⠞⠀\n⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀\n⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀\n⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀ ⠀⣄⢸⠀⠀⠀⠀⠀⠀`",
@@ -849,10 +849,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(outgoing=True, pattern=r"santet(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"santet(?: |$)(.*)"))
async def _(typew):
await typew.edit("`Mengaktifkan Perintah Santet Online....`")
sleep(2)
@@ -1164,7 +1164,7 @@ async def _(typew):
await typew.edit("`Target Berhasil Tersantet Online 🥴`")
-@bot.on(geez_cmd(outgoing=True, pattern=".nah(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=".nah(?: |$)(.*)"))
async def _(typew):
await typew.edit("`\n(\\_/)`" "`\n(●_●)`" "`\n />💖 *Ini Buat Kamu`")
sleep(2)
@@ -1174,7 +1174,7 @@ async def _(typew):
# Alpinnnn Gans
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1185,7 +1185,7 @@ async def _(event):
if input_str == "owner":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬛⬛⬛⬛⬛⬛\n⬛⬜⬜⬜⬜⬛\n⬛⬜⬛⬛⬜⬛\n⬛⬜⬛⬛⬜⬛\n⬛⬜⬜⬜⬜⬛\n⬛⬜⬛⬜⬛⬛\n⬛⬜⬛⬛⬜⬛\n⬛⬛⬛⬛⬛⬛",
@@ -1204,7 +1204,7 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 6])
+ await edit_or_reply(animation_chars[i % 6])
CMD_HELP.update(
diff --git a/userbot/modules/anime.py b/userbot/modules/anime.py
index e6f6e2a8..696bb1c1 100644
--- a/userbot/modules/anime.py
+++ b/userbot/modules/anime.py
@@ -26,7 +26,7 @@
from telethon.utils import is_image, is_video
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
jikan = Jikan()
@@ -235,17 +235,17 @@ async def formatJSON(outData):
return msg
-@bot.on(geez_cmd(outgoing=True, pattern=r"anilist ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"anilist ?(.*)"))
async def anilist(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
result = await callAPI(input_str)
msg = await formatJSON(result)
- await event.edit(msg, link_preview=True)
+ await edit_or_reply(msg, link_preview=True)
-@bot.on(geez_cmd(outgoing=True, pattern=r"anime ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"anime ?(.*)"))
async def search_anime(message):
search_query = message.pattern_match.group(1)
await message.get_reply_message()
@@ -266,7 +266,7 @@ async def search_anime(message):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"manga ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"manga ?(.*)"))
async def search_manga(message):
search_query = message.pattern_match.group(1)
await message.get_reply_message()
@@ -281,7 +281,7 @@ async def search_manga(message):
)
-@bot.on(geez_cmd(outgoing=True, pattern="a(kaizoku|kayo) ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="a(kaizoku|kayo) ?(.*)"))
async def site_search(event):
message = await event.get_reply_message()
search_query = event.pattern_match.group(2)
@@ -291,7 +291,7 @@ async def site_search(event):
elif message:
search_query = message.text
else:
- await event.edit("`Uuf Bro.. Gib something to Search`")
+ await edit_or_reply("`Uuf Bro.. Gib something to Search`")
return
if site == "kaizoku":
@@ -306,10 +306,10 @@ async def site_search(event):
post_link = entry.a["href"]
post_name = html.escape(entry.text.strip())
result += f"• {post_name}\n"
- await event.edit(result, parse_mode="HTML")
+ await edit_or_reply(result, parse_mode="HTML")
else:
result = f"No result found for {html.escape(search_query)} on AnimeKaizoku"
- await event.edit(result, parse_mode="HTML")
+ await edit_or_reply(result, parse_mode="HTML")
elif site == "kayo":
search_url = f"https://animekayo.com/?s={search_query}"
@@ -327,10 +327,10 @@ async def site_search(event):
post_link = entry.a["href"]
post_name = html.escape(entry.text.strip())
result += f"• {post_name}\n"
- await event.edit(result, parse_mode="HTML")
+ await edit_or_reply(result, parse_mode="HTML")
-@bot.on(geez_cmd(outgoing=True, pattern=r"char ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"char ?(.*)"))
async def character(event):
message = await event.get_reply_message()
search_query = event.pattern_match.group(1)
@@ -339,14 +339,14 @@ async def character(event):
elif message:
search_query = message.text
else:
- await event.edit("Format: `.char `")
+ await edit_or_reply("Format: `.char `")
return
- await event.edit("`Searching Character...`")
+ await edit_or_reply("`Searching Character...`")
try:
search_result = jikan.search("character", search_query)
except APIException:
- await event.edit("`Character not found.`")
+ await edit_or_reply("`Character not found.`")
return
first_mal_id = search_result["results"][0]["mal_id"]
character = jikan.character(first_mal_id)
@@ -380,7 +380,7 @@ async def character(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern="upcoming$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="upcoming$"))
async def upcoming(message):
rep = "Upcoming anime\n"
later = jikan.season_later()
@@ -394,7 +394,7 @@ async def upcoming(message):
await message.edit(rep, parse_mode="html")
-@bot.on(geez_cmd(outgoing=True, pattern="whatanime$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="whatanime$"))
async def whatanime(e):
media = e.media
if not media:
diff --git a/userbot/modules/anti_spambot.py b/userbot/modules/anti_spambot.py
index 885292fe..73589723 100644
--- a/userbot/modules/anti_spambot.py
+++ b/userbot/modules/anti_spambot.py
@@ -14,7 +14,7 @@
from userbot import ANTI_SPAMBOT, ANTI_SPAMBOT_SHOUT, BOTLOG_CHATID, CMD_HELP, bot
-@bot.on(ChatAction)
+@geez_cmd(ChatAction)
async def ANTI_SPAMBOTS(welcm):
"""Ban a recently joined user if it matches the spammer checking algorithm."""
try:
diff --git a/userbot/modules/antiflood.py b/userbot/modules/antiflood.py
index 5b6d60fe..def928ae 100644
--- a/userbot/modules/antiflood.py
+++ b/userbot/modules/antiflood.py
@@ -5,7 +5,7 @@
import userbot.modules.sql_helper.antiflood_sql as sql
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd, register
from userbot.utils.tools import is_admin
@@ -60,7 +60,7 @@ async def _(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"setflood(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"setflood(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -68,13 +68,13 @@ async def _(event):
try:
sql.set_flood(event.chat_id, input_str)
sql.__load_flood_settings()
- await event.edit(
+ await edit_or_reply(
"**Antiflood diperbarui menjadi** `{}` **dalam obrolan saat ini**".format(
input_str
)
)
except Exception as e: # pylint:disable=C0103,W0703
- await event.edit(str(e))
+ await edit_or_reply(str(e))
CMD_HELP.update(
diff --git a/userbot/modules/appmisc.py b/userbot/modules/appmisc.py
index 088f957e..3af151a6 100644
--- a/userbot/modules/appmisc.py
+++ b/userbot/modules/appmisc.py
@@ -93,7 +93,7 @@
client = bot
-@bot.on(geez_cmd(outgoing=True, pattern=r"app(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"app(?: |$)(.*)"))
async def apk(e):
try:
app_name = e.pattern_match.group(1)
@@ -157,7 +157,7 @@ async def apk(e):
await e.edit("Exception Occured:- " + str(err))
-@bot.on(geez_cmd(outgoing=True, pattern=r"calc(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"calc(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -176,24 +176,24 @@ async def _(event):
final_term2 = int(term2)
# actual calculations go here
if input == "help":
- await event.edit(
+ await edit_or_reply(
"Syntax .calc \nFor eg .calc 02*02 or 99*99 (the zeros are important) (two terms and two digits max)"
)
elif operator == "*":
- await event.edit("Solution -->\n" + exp + "\n" + str(final_term1 * final_term2))
+ await edit_or_reply("Solution -->\n" + exp + "\n" + str(final_term1 * final_term2))
elif operator == "-":
- await event.edit("Solution -->\n" + exp + "\n" + str(final_term1 - final_term2))
+ await edit_or_reply("Solution -->\n" + exp + "\n" + str(final_term1 - final_term2))
elif operator == "+":
- await event.edit("Solution -->\n" + exp + "\n" + str(final_term1 + final_term2))
+ await edit_or_reply("Solution -->\n" + exp + "\n" + str(final_term1 + final_term2))
elif operator == "/":
- await event.edit("Solution -->\n" + exp + "\n" + str(final_term1 / final_term2))
+ await edit_or_reply("Solution -->\n" + exp + "\n" + str(final_term1 / final_term2))
elif operator == "%":
- await event.edit("Solution -->\n" + exp + "\n" + str(final_term1 % final_term2))
+ await edit_or_reply("Solution -->\n" + exp + "\n" + str(final_term1 % final_term2))
else:
- await event.edit("use .calc help")
+ await edit_or_reply("use .calc help")
-@bot.on(geez_cmd(outgoing=True, pattern=r"xcd(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"xcd(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -233,12 +233,12 @@ async def _(event):
Year: {}""".format(
img, input_str, xkcd_link, safe_title, alt, day, month, year
)
- await event.edit(output_str, link_preview=True)
+ await edit_or_reply(output_str, link_preview=True)
else:
- await event.edit("xkcd n.{} not found!".format(xkcd_id))
+ await edit_or_reply("xkcd n.{} not found!".format(xkcd_id))
-@bot.on(geez_cmd(outgoing=True, pattern=r"remove(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"remove(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -248,7 +248,7 @@ async def _(event):
if input_str:
chat = await event.get_chat()
if not (chat.admin_rights or chat.creator):
- await event.edit("`Anda Bukan Admin Disini!`")
+ await edit_or_reply("`Anda Bukan Admin Disini!`")
return False
p = 0
b = 0
@@ -262,7 +262,7 @@ async def _(event):
o = 0
q = 0
r = 0
- await event.edit("`Mencari Daftar Peserta....`")
+ await edit_or_reply("`Mencari Daftar Peserta....`")
async for i in bot.iter_participants(event.chat_id):
p += 1
#
@@ -274,7 +274,7 @@ async def _(event):
if "y" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -285,7 +285,7 @@ async def _(event):
if "m" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -296,7 +296,7 @@ async def _(event):
if "w" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -307,7 +307,7 @@ async def _(event):
if "o" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -318,7 +318,7 @@ async def _(event):
if "q" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -329,7 +329,7 @@ async def _(event):
if "r" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -340,7 +340,7 @@ async def _(event):
if "b" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -351,7 +351,7 @@ async def _(event):
if "d" in input_str:
status, e = await ban_user(event.chat_id, i, rights)
if not status:
- await event.edit(
+ await edit_or_reply(
"**Saya memerlukan hak admin untuk melakukan tindakan ini!**"
)
e.append(str(e))
@@ -370,9 +370,9 @@ async def _(event):
UserStatusRecently: {}
Bots: {}
None: {}"""
- await event.edit(required_string.format(c, p, d, y, m, w, o, q, r, b, n))
+ await edit_or_reply(required_string.format(c, p, d, y, m, w, o, q, r, b, n))
await asyncio.sleep(5)
- await event.edit(
+ await edit_or_reply(
"""Total= {} users
Number Of Deleted Accounts= {}
Status: Empty= {}
@@ -396,12 +396,12 @@ async def ban_user(chat_id, i, rights):
return False, str(exc)
-@bot.on(geez_cmd(outgoing=True, pattern=r"rnupload(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rnupload(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
thumb = thumb_image_path if os.path.exists(thumb_image_path) else None
- await event.edit("`Rename & Upload in processing ....`")
+ await edit_or_reply("`Rename & Upload in processing ....`")
input_str = event.pattern_match.group(1)
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
@@ -431,18 +431,18 @@ async def _(event):
end_two = datetime.now()
os.remove(downloaded_file_name)
ms_two = (end_two - end).seconds
- await event.edit(
+ await edit_or_reply(
"**Downloaded in** `{}` **seconds. Uploaded in** `{}` **seconds**".format(
ms_one, ms_two
)
)
else:
- await event.edit("File Not Found {}".format(input_str))
+ await edit_or_reply("File Not Found {}".format(input_str))
else:
- await event.edit("Syntax // .rnupload filename.extension ")
+ await edit_or_reply("Syntax // .rnupload filename.extension ")
-@bot.on(geez_cmd(outgoing=True, pattern=r"grab(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"grab(?: |$)(.*)"))
async def potocmd(event):
"""Gets the profile photos of replied users, channels or chats"""
id = "".join(event.raw_text.split(maxsplit=2)[1:])
@@ -462,32 +462,32 @@ async def potocmd(event):
try:
id = int(id)
if id <= 0:
- await event.edit("**Nomer ID Yang Anda Masukkan Tidak Valid**")
+ await edit_or_reply("**Nomer ID Yang Anda Masukkan Tidak Valid**")
return
except BaseException:
- await event.edit("**Lmao**")
+ await edit_or_reply("**Lmao**")
return
if int(id) <= (len(photos)):
send_photos = await event.client.download_media(photos[id - 1])
await bot.send_file(event.chat_id, send_photos)
else:
- await event.edit("**Tidak Dapat Menemukan Foto Pengguna Ini**")
+ await edit_or_reply("**Tidak Dapat Menemukan Foto Pengguna Ini**")
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"res(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"res(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
if not event.reply_to_msg_id:
- await event.edit("**Mohon Balas Ke Link.**")
+ await edit_or_reply("**Mohon Balas Ke Link.**")
return
reply_message = await event.get_reply_message()
if not reply_message.text:
- await event.edit("**Mohon Balas Ke Link.**")
+ await edit_or_reply("**Mohon Balas Ke Link.**")
return
chat = "@CheckRestrictionsBot"
- await event.edit("```Memproses....```")
+ await edit_or_reply("```Memproses....```")
async with event.client.conversation(chat) as conv:
try:
response = conv.wait_event(
@@ -500,7 +500,7 @@ async def _(event):
await event.client.forward_messages(chat, reply_message)
response = await response
if response.text.startswith(""):
- await event.edit("**Terjadi Error**")
+ await edit_or_reply("**Terjadi Error**")
else:
await event.delete()
await event.client.send_message(event.chat_id, response.message)
@@ -574,12 +574,12 @@ def get_provider(url):
return url
-@bot.on(geez_cmd(outgoing=True, pattern=r"watch(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"watch(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
query = event.pattern_match.group(1)
- await event.edit("Finding Sites...")
+ await edit_or_reply("Finding Sites...")
streams = get_stream_data(query)
title = streams["title"]
thumb_link = streams["movie_thumb"]
@@ -629,7 +629,7 @@ async def _(event):
# Modified by :- @kirito6969,@deleteduser420
-@bot.on(geez_cmd(outgoing=True, pattern=r"weeb(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"weeb(?: |$)(.*)"))
async def weebify(event):
args = event.pattern_match.group(1)
@@ -637,14 +637,14 @@ async def weebify(event):
get = await event.get_reply_message()
args = get.text
if not args:
- await event.edit("**Teks Apa Yang Harus Saya Weebify Kan?**")
+ await edit_or_reply("**Teks Apa Yang Harus Saya Weebify Kan?**")
return
string = " ".join(args).lower()
for normiecharacter in string:
if normiecharacter in normiefont:
weebycharacter = weebyfont[normiefont.index(normiecharacter)]
string = string.replace(normiecharacter, weebycharacter)
- await event.edit(string)
+ await edit_or_reply(string)
boldfont = [
@@ -677,7 +677,7 @@ async def weebify(event):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"bold(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bold(?: |$)(.*)"))
async def thicc(bolded):
args = bolded.pattern_match.group(1)
@@ -725,7 +725,7 @@ async def thicc(bolded):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"medibold(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"medibold(?: |$)(.*)"))
async def mediv(medievalx):
args = medievalx.pattern_match.group(1)
@@ -773,7 +773,7 @@ async def mediv(medievalx):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"doublestruck(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"doublestruck(?: |$)(.*)"))
async def doublex(doublestrucktx):
args = doublestrucktx.pattern_match.group(1)
@@ -821,7 +821,7 @@ async def doublex(doublestrucktx):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"curbold(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"curbold(?: |$)(.*)"))
async def cursive2(cursivebolded):
args = cursivebolded.pattern_match.group(1)
@@ -869,7 +869,7 @@ async def cursive2(cursivebolded):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"medi(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"medi(?: |$)(.*)"))
async def medival22(medivallite):
args = medivallite.pattern_match.group(1)
@@ -917,7 +917,7 @@ async def medival22(medivallite):
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"cur(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"cur(?: |$)(.*)"))
async def xcursive(cursivelite):
args = cursivelite.pattern_match.group(1)
diff --git a/userbot/modules/arts.py b/userbot/modules/arts.py
index 1bdff43a..325588fc 100644
--- a/userbot/modules/arts.py
+++ b/userbot/modules/arts.py
@@ -4,11 +4,11 @@
# Support @GeezSupport & @GeezProjects
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"frog(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"frog(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -30,7 +30,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"dfrog(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"dfrog(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -52,7 +52,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"strump(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"strump(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -74,7 +74,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"scina(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"scina(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -97,7 +97,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"wlcm(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"wlcm(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -114,7 +114,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"gta(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gta(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
@@ -132,7 +132,7 @@ async def typewriter(typew):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"sthink(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"sthink(?: |$)(.*)"))
async def typewriter(typew):
typew.pattern_match.group(1)
await typew.edit(
diff --git a/userbot/modules/asupan.py b/userbot/modules/asupan.py
index b94c396c..16bf9f17 100644
--- a/userbot/modules/asupan.py
+++ b/userbot/modules/asupan.py
@@ -15,7 +15,7 @@ async def _(event):
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
- await event.edit("**Tidak bisa menemukan video asupan.**")
+ await edit_or_reply("**Tidak bisa menemukan video asupan.**")
@geez_cmd(pattern="wibu$")
@@ -25,7 +25,7 @@ async def _(event):
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
- await event.edit("**Tidak bisa menemukan video wibu.**")
+ await edit_or_reply("**Tidak bisa menemukan video wibu.**")
@geez_cmd(pattern="chika$")
@@ -35,7 +35,7 @@ async def _(event):
await event.client.send_file(event.chat_id, response["url"])
await event.delete()
except Exception:
- await event.edit("**Tidak bisa menemukan video chikakiku.**")
+ await edit_or_reply("**Tidak bisa menemukan video chikakiku.**")
CMD_HELP.update(
diff --git a/userbot/modules/blacklist.py b/userbot/modules/blacklist.py
index b6a03c11..56591a81 100644
--- a/userbot/modules/blacklist.py
+++ b/userbot/modules/blacklist.py
@@ -11,11 +11,11 @@
import userbot.modules.sql_helper.blacklist_sql as sql
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(incoming=True))
+@geez_cmd(geez_cmd(incoming=True))
async def on_new_message(event):
# TODO: exempt admins from locks
name = event.raw_text
@@ -35,7 +35,7 @@ async def on_new_message(event):
break
-@bot.on(geez_cmd(outgoing=True, pattern=r"addbl(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"addbl(?: |$)(.*)"))
async def on_add_black_list(addbl):
text = addbl.pattern_match.group(1)
to_blacklist = list(
@@ -49,7 +49,7 @@ async def on_add_black_list(addbl):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"listbl(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"listbl(?: |$)(.*)"))
async def on_view_blacklist(listbl):
all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
OUT_STR = "Blacklists in the Current Chat:\n"
@@ -74,7 +74,7 @@ async def on_view_blacklist(listbl):
await listbl.edit(OUT_STR)
-@bot.on(geez_cmd(outgoing=True, pattern=r"rmbl(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rmbl(?: |$)(.*)"))
async def on_delete_blacklist(rmbl):
text = rmbl.pattern_match.group(1)
to_unblacklist = list(
diff --git a/userbot/modules/botcontrol.py b/userbot/modules/botcontrol.py
index c2f952a3..3ca81089 100644
--- a/userbot/modules/botcontrol.py
+++ b/userbot/modules/botcontrol.py
@@ -56,7 +56,7 @@ async def setit(event, name, value):
try:
heroku_var[name] = value
except BaseException:
- return await event.edit("**Maaf Gagal Menyimpan Karena ERROR**")
+ return await edit_or_reply("**Maaf Gagal Menyimpan Karena ERROR**")
def get_back_button(name):
@@ -171,7 +171,7 @@ async def botsettings(event):
@callback(data=re.compile(b"apiset"))
async def apiset(event):
- await event.edit(
+ await edit_or_reply(
"**Silahkan Pilih VAR yang ingin anda Setting**",
buttons=[
[
@@ -193,7 +193,7 @@ async def apiset(event):
@callback(data=re.compile(b"alivemenu"))
async def alivemenu(event):
- await event.edit(
+ await edit_or_reply(
"**Silahkan Pilih VAR yang ingin anda Setting**",
buttons=[
[
@@ -215,7 +215,7 @@ async def alivemenu(event):
@callback(data=re.compile(b"inlinemenu"))
async def inlinemenu(event):
- await event.edit(
+ await edit_or_reply(
"**Silahkan Pilih VAR yang ingin anda Setting**",
buttons=[
[
@@ -229,7 +229,7 @@ async def inlinemenu(event):
@callback(data=re.compile(b"hndlrmenu"))
async def hndlrmenu(event):
- await event.edit(
+ await edit_or_reply(
"**Silahkan Pilih VAR yang ingin anda Setting**",
buttons=[
[
diff --git a/userbot/modules/broadcast.py b/userbot/modules/broadcast.py
index 85c11e96..50a6b47b 100644
--- a/userbot/modules/broadcast.py
+++ b/userbot/modules/broadcast.py
@@ -6,35 +6,35 @@
from userbot import BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, LOGS, bot
+from userbot import CMD_HELP, LOGS
from userbot.events import geez_cmd
from userbot.modules.sql_helper import broadcast_sql as sql
from userbot.utils import parse_pre
-@bot.on(geez_cmd(outgoing=True, pattern=r"sendto ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"sendto ?(.*)"))
async def catbroadcast_send(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"**Ke kategori mana saya harus mengirim pesan ini?**", parse_mode=parse_pre
)
reply = await event.get_reply_message()
if not reply:
- return await event.edit(
+ return await edit_or_reply(
"**apa yang harus saya kirim ke kategori ini?**", parse_mode=parse_pre
)
keyword = catinput_str.lower()
no_of_chats = sql.num_broadcastlist_chat(keyword)
if no_of_chats == 0:
- return await event.edit(
+ return await edit_or_reply(
f"**Tidak ada kategori dengan nama** `{keyword}` **Check** `.bclistall`",
parse_mode=parse_pre,
)
chats = sql.get_chat_broadcastlist(keyword)
- catevent = await event.edit(
+ catevent = await edit_or_reply(
"**mengirim pesan ini ke semua grup dalam kategori**",
parse_mode=parse_pre,
)
@@ -58,29 +58,29 @@ async def catbroadcast_send(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"fwdto ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"fwdto ?(.*)"))
async def catbroadcast_send(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"**Ke kategori mana saya harus mengirim pesan ini?**", parse_mode=parse_pre
)
reply = await event.get_reply_message()
if not reply:
- return await event.edit(
+ return await edit_or_reply(
"**apa yang harus saya kirim ke kategori ini?**", parse_mode=parse_pre
)
keyword = catinput_str.lower()
no_of_chats = sql.num_broadcastlist_chat(keyword)
if no_of_chats == 0:
- return await event.edit(
+ return await edit_or_reply(
f"**Tidak ada kategori dengan nama** `{keyword}` **Check** '.bclistall'",
parse_mode=parse_pre,
)
chats = sql.get_chat_broadcastlist(keyword)
- catevent = await event.edit(
+ catevent = await edit_or_reply(
"**mengirim pesan ini ke semua grup dalam kategori**",
parse_mode=parse_pre,
)
@@ -104,24 +104,24 @@ async def catbroadcast_send(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"addto ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"addto ?(.*)"))
async def catbroadcast_add(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"Di kategori mana saya harus menambahkan obrolan ini?", parse_mode=parse_pre
)
keyword = catinput_str.lower()
check = sql.is_in_broadcastlist(keyword, event.chat_id)
if check:
- return await event.edit(
+ return await edit_or_reply(
f"Obrolan ini sudah ada dalam kategori ini {keyword}",
parse_mode=parse_pre,
)
sql.add_to_broadcastlist(keyword, event.chat_id)
- await event.edit(
+ await edit_or_reply(
f"Obrolan ini Sekarang ditambahkan ke kategori {keyword}", parse_mode=parse_pre
)
chat = await event.get_chat()
@@ -140,23 +140,23 @@ async def catbroadcast_add(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"rmfrom ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rmfrom ?(.*)"))
async def catbroadcast_remove(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"Dari kategori mana saya harus menghapus obrolan ini", parse_mode=parse_pre
)
keyword = catinput_str.lower()
check = sql.is_in_broadcastlist(keyword, event.chat_id)
if not check:
- return await event.edit(
+ return await edit_or_reply(
f"Obrolan ini tidak ada dalam kategori {keyword}", parse_mode=parse_pre
)
sql.rm_from_broadcastlist(keyword, event.chat_id)
- await event.edit(
+ await edit_or_reply(
f"Obrolan ini Sekarang dihapus dari kategori {keyword}",
parse_mode=parse_pre,
)
@@ -176,25 +176,25 @@ async def catbroadcast_remove(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"bclist ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bclist ?(.*)"))
async def catbroadcast_list(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"Obrolan kategori mana yang harus saya daftarkan?\nCheck `.bclistall`",
parse_mode=parse_pre,
)
keyword = catinput_str.lower()
no_of_chats = sql.num_broadcastlist_chat(keyword)
if no_of_chats == 0:
- return await event.edit(
+ return await edit_or_reply(
f"Tidak ada kategori dengan nama {keyword}. Check `.bclistall`",
parse_mode=parse_pre,
)
chats = sql.get_chat_broadcastlist(keyword)
- catevent = await event.edit(
+ catevent = await edit_or_reply(
f"Fetching info of the category {keyword}", parse_mode=parse_pre
)
resultlist = f"**kategori `{keyword}` memiliki `{no_of_chats}` obrolan dan ini tercantum di bawah ini :**\n\n"
@@ -216,12 +216,12 @@ async def catbroadcast_list(event):
await catevent.edit(finaloutput)
-@bot.on(geez_cmd(outgoing=True, pattern=r"bclistall ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bclistall ?(.*)"))
async def catbroadcast_list(event):
if event.fwd_from:
return
if sql.num_broadcastlist_chats() == 0:
- return await event.edit(
+ return await edit_or_reply(
"Anda belum membuat setidaknya satu kategori, periksa info untuk bantuan lebih lanjut",
parse_mode=parse_pre,
)
@@ -232,18 +232,18 @@ async def catbroadcast_list(event):
await event.efit(resultext)
-@bot.on(geez_cmd(outgoing=True, pattern=r"frmfrom ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"frmfrom ?(.*)"))
async def catbroadcast_remove(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
if not catinput_str:
- return await event.edit(
+ return await edit_or_reply(
"Dari kategori mana saya harus menghapus obrolan ini", parse_mode=parse_pre
)
args = catinput_str.split(" ")
if len(args) != 2:
- return await event.edit(
+ return await edit_or_reply(
"Gunakan sintaks yang tepat seperti yang ditunjukkan .frmfrom category_name groupid",
parse_mode=parse_pre,
)
@@ -255,7 +255,7 @@ async def catbroadcast_remove(event):
groupid = int(args[1])
keyword = args[0].lower()
except ValueError:
- return await event.edit(
+ return await edit_or_reply(
event,
"Gunakan sintaks yang tepat seperti yang ditunjukkan .frmfrom category_name groupid",
parse_mode=parse_pre,
@@ -263,12 +263,12 @@ async def catbroadcast_remove(event):
keyword = keyword.lower()
check = sql.is_in_broadcastlist(keyword, int(groupid))
if not check:
- return await event.edit(
+ return await edit_or_reply(
f"Obrolan ini {groupid} tidak termasuk dalam kategori {keyword}",
parse_mode=parse_pre,
)
sql.rm_from_broadcastlist(keyword, groupid)
- await event.edit(
+ await edit_or_reply(
event,
f"Obrolan ini {groupid} sekarang dihapus dari kategori {keyword}",
parse_mode=parse_pre,
@@ -289,25 +289,25 @@ async def catbroadcast_remove(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"delc ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"delc ?(.*)"))
async def catbroadcast_delete(event):
if event.fwd_from:
return
catinput_str = event.pattern_match.group(1)
check1 = sql.num_broadcastlist_chat(catinput_str)
if check1 < 1:
- return await event.edit(
+ return await edit_or_reply(
f"Apakah Anda yakin ada kategori? {catinput_str}",
parse_mode=parse_pre,
)
try:
sql.del_keyword_broadcastlist(catinput_str)
- await event.edit(
+ await edit_or_reply(
f"Berhasil menghapus kategori {catinput_str}",
parse_mode=parse_pre,
)
except Exception as e:
- await event.edit(
+ await edit_or_reply(
str(e),
parse_mode=parse_pre,
)
diff --git a/userbot/modules/chatbot.py b/userbot/modules/chatbot.py
index 842d2c54..95534a80 100644
--- a/userbot/modules/chatbot.py
+++ b/userbot/modules/chatbot.py
@@ -7,7 +7,7 @@
from telethon.tl.types import User
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, LOGS, bot
+from userbot import CMD_HELP, LOGS
from userbot.modules.sql_helper.tede_chatbot_sql import is_tede, rem_tede, set_tede
from userbot.utils import edit_or_reply, geez_cmd
@@ -50,7 +50,7 @@ async def on_apa_off(event):
await chat_bot_toggle(event)
-@bot.on(
+@geez_cmd(
events.NewMessage(
incoming=True,
func=lambda e: (e.mentioned),
diff --git a/userbot/modules/clone.py b/userbot/modules/clone.py
index fcf87b3c..bcac01f4 100644
--- a/userbot/modules/clone.py
+++ b/userbot/modules/clone.py
@@ -17,40 +17,40 @@
STORAGE.userObj = False
-@bot.on(geez_cmd(outgoing=True, pattern=r"clone ?(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"clone ?(.*)"))
async def impostor(event):
inputArgs = event.pattern_match.group(1)
if "restore" in inputArgs:
- await event.edit("**Kembali ke identitas asli...**")
+ await edit_or_reply("**Kembali ke identitas asli...**")
if not STORAGE.userObj:
- return await event.edit(
+ return await edit_or_reply(
"**Anda harus mengclone orang dulu sebelum kembali!**"
)
await updateProfile(STORAGE.userObj, restore=True)
- return await event.edit("**Berhasil Mengembalikan Akun Anda dari clone**")
+ return await edit_or_reply("**Berhasil Mengembalikan Akun Anda dari clone**")
if inputArgs:
try:
user = await event.client.get_entity(inputArgs)
except BaseException:
- return await event.edit("**Username/ID tidak valid.**")
+ return await edit_or_reply("**Username/ID tidak valid.**")
userObj = await event.client(GetFullUserRequest(user))
elif event.reply_to_msg_id:
replyMessage = await event.get_reply_message()
if replyMessage.sender_id is None:
- return await event.edit("**Tidak dapat menyamar sebagai admin anonim 🥺**")
+ return await edit_or_reply("**Tidak dapat menyamar sebagai admin anonim 🥺**")
userObj = await event.client(GetFullUserRequest(replyMessage.sender_id))
else:
- return await event.edit("**Ketik** `.help impostor` **bila butuh bantuan.**")
+ return await edit_or_reply("**Ketik** `.help impostor` **bila butuh bantuan.**")
if not STORAGE.userObj:
STORAGE.userObj = await event.client(GetFullUserRequest(event.sender_id))
LOGS.info(STORAGE.userObj)
- await event.edit("**Mencuri identitas orang ini...**")
+ await edit_or_reply("**Mencuri identitas orang ini...**")
await updateProfile(userObj)
- await event.edit("**Aku adalah kamu dan kamu adalah aku. asekk 🥴**")
+ await edit_or_reply("**Aku adalah kamu dan kamu adalah aku. asekk 🥴**")
async def updateProfile(userObj, restore=False):
diff --git a/userbot/modules/core.py b/userbot/modules/core.py
index 34fc5eb2..f4a7727e 100644
--- a/userbot/modules/core.py
+++ b/userbot/modules/core.py
@@ -7,18 +7,18 @@
import os
from pathlib import Path
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
from userbot.utils import edit_or_reply, load_module, remove_plugin, reply_id
-@bot.on(geez_cmd(outgoing=True, pattern="install$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="install$"))
async def _(event):
if event.fwd_from:
return
if event.reply_to_msg_id:
try:
- await event.edit("`Installing Modules...`")
+ await edit_or_reply("`Installing Modules...`")
downloaded_file_name = (
await event.client.download_media( # pylint:disable=E0602
await event.get_reply_message(),
@@ -29,20 +29,20 @@ async def _(event):
path1 = Path(downloaded_file_name)
shortname = path1.stem
load_module(shortname.replace(".py", ""))
- await event.edit(
+ await edit_or_reply(
"**Plugin** `{}` **Berhasil di install**".format(
os.path.basename(downloaded_file_name)
)
)
else:
os.remove(downloaded_file_name)
- await event.edit("**Error!** Plugin ini sudah terinstall di userbot.")
+ await edit_or_reply("**Error!** Plugin ini sudah terinstall di userbot.")
except Exception as e:
- await event.edit(str(e))
+ await edit_or_reply(str(e))
os.remove(downloaded_file_name)
-@bot.on(geez_cmd(outgoing=True, pattern=r"psend ([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"psend ([\s\S]*)"))
async def send(event):
reply_to_id = await reply_id(event)
input_str = event.pattern_match.group(1)
@@ -62,7 +62,7 @@ async def send(event):
await edit_or_reply(event, "**ERROR: Modules Tidak ditemukan**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"uninstall (?P\w+)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"uninstall (?P\w+)"))
async def uninstall(event):
if event.fwd_from:
return
@@ -71,9 +71,9 @@ async def uninstall(event):
try:
remove_plugin(shortname)
os.remove(dir_path)
- await event.edit(f"**Berhasil Menghapus Modules** `{shortname}`")
+ await edit_or_reply(f"**Berhasil Menghapus Modules** `{shortname}`")
except OSError as e:
- await event.edit("**ERROR:** `%s` : %s" % (dir_path, e.strerror))
+ await edit_or_reply("**ERROR:** `%s` : %s" % (dir_path, e.strerror))
CMD_HELP.update(
diff --git a/userbot/modules/covid.py b/userbot/modules/covid.py
index 18f12a67..54306188 100644
--- a/userbot/modules/covid.py
+++ b/userbot/modules/covid.py
@@ -6,13 +6,13 @@
from covid import Covid
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"covid (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"covid (.*)"))
async def corona(event):
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
country = event.pattern_match.group(1)
covid = Covid(source="worldometers")
country_data = covid.get_status_by_country_name(country)
@@ -29,12 +29,12 @@ async def corona(event):
else:
output_text = "No information yet about this country!"
- await event.edit(f"**Corona Virus Info in {country}:**\n\n{output_text}")
+ await edit_or_reply(f"**Corona Virus Info in {country}:**\n\n{output_text}")
-@bot.on(geez_cmd(outgoing=True, pattern="covid$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern="covid$"))
async def corona(event):
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
country = "World"
covid = Covid(source="worldometers")
country_data = covid.get_status_by_country_name(country)
@@ -51,7 +51,7 @@ async def corona(event):
else:
output_text = "No information yet about this country!"
- await event.edit(f"**Corona Virus Info in {country}:**\n\n{output_text}")
+ await edit_or_reply(f"**Corona Virus Info in {country}:**\n\n{output_text}")
CMD_HELP.update(
diff --git a/userbot/modules/create.py b/userbot/modules/create.py
index 14ef8b5d..b4019dc8 100644
--- a/userbot/modules/create.py
+++ b/userbot/modules/create.py
@@ -8,11 +8,11 @@
from telethon.tl import functions
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"buat (gb|g|c)(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"buat (gb|g|c)(?: |$)(.*)"))
async def telegraphs(grop):
"""For .create command, Creating New Group & Channel"""
if grop.text[0].isalpha() or grop.text[0] in ("/", "#", "@", "!"):
diff --git a/userbot/modules/createstickers.py b/userbot/modules/createstickers.py
index f16a437f..9fe59086 100644
--- a/userbot/modules/createstickers.py
+++ b/userbot/modules/createstickers.py
@@ -11,11 +11,10 @@
from PIL import Image, ImageDraw, ImageFont
from telethon.tl.types import InputMessagesFilterDocument
-from userbot import bot
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"cs(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"cs(?: |$)(.*)"))
async def sticklet(event):
R = random.randint(0, 256)
G = random.randint(0, 256)
diff --git a/userbot/modules/deepfry.py b/userbot/modules/deepfry.py
index 998924c8..bec2a5ea 100644
--- a/userbot/modules/deepfry.py
+++ b/userbot/modules/deepfry.py
@@ -37,12 +37,12 @@
from PIL import Image, ImageEnhance, ImageOps
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
from userbot.utils import check_media
-@bot.on(geez_cmd(outgoing=True, pattern=r"deepfry(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"deepfry(?: |$)(.*)"))
async def deepfryer(event):
try:
frycount = int(event.pattern_match.group(1))
@@ -56,20 +56,20 @@ async def deepfryer(event):
data = await check_media(reply_message)
if isinstance(data, bool):
- await event.edit("`I can't deep fry that!`")
+ await edit_or_reply("`I can't deep fry that!`")
return
else:
- await event.edit("`Reply to an image or sticker to deep fry it!`")
+ await edit_or_reply("`Reply to an image or sticker to deep fry it!`")
return
# download last photo (highres) as byte array
- await event.edit("`Downloading media…`")
+ await edit_or_reply("`Downloading media…`")
image = io.BytesIO()
await event.client.download_media(data, image)
image = Image.open(image)
# fry the image
- await event.edit("`Deep frying media…`")
+ await edit_or_reply("`Deep frying media…`")
for _ in range(frycount):
image = await deepfry(image)
diff --git a/userbot/modules/direct_links.py b/userbot/modules/direct_links.py
index f52d320b..d0554cf9 100644
--- a/userbot/modules/direct_links.py
+++ b/userbot/modules/direct_links.py
@@ -16,12 +16,12 @@
from humanize import naturalsize
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, LOGS, bot
+from userbot import CMD_HELP, LOGS
from userbot.events import geez_cmd
from userbot.utils import edit_delete, edit_or_reply
-@bot.on(geez_cmd(outgoing=True, pattern=r"direct(?: |$)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"direct(?: |$)([\s\S]*)"))
async def direct_link_generator(event):
textx = await event.get_reply_message()
message = event.pattern_match.group(1)
diff --git a/userbot/modules/emojigames.py b/userbot/modules/emojigames.py
index dc8a9320..c8f10800 100644
--- a/userbot/modules/emojigames.py
+++ b/userbot/modules/emojigames.py
@@ -8,11 +8,11 @@
from telethon.tl.types import InputMediaDice
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"dice(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"dice(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -29,7 +29,7 @@ async def _(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"dart(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"dart(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -46,7 +46,7 @@ async def _(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"basket(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"basket(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -63,7 +63,7 @@ async def _(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"bowling(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bowling(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -80,7 +80,7 @@ async def _(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"ball(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"ball(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
@@ -97,7 +97,7 @@ async def _(event):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"jackpot(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"jackpot(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
diff --git a/userbot/modules/evaluators.py b/userbot/modules/evaluators.py
index 07021834..e6754812 100644
--- a/userbot/modules/evaluators.py
+++ b/userbot/modules/evaluators.py
@@ -19,24 +19,24 @@
p, pp = print, pprint
-@bot.on(geez_cmd(outgoing=True, pattern=r"eval(?:\s|$)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"eval(?:\s|$)([\s\S]*)"))
async def _(event):
expression = event.pattern_match.group(1)
if not expression:
- return await event.edit("**Berikan Code untuk di eksekusi.**")
+ return await edit_or_reply("**Berikan Code untuk di eksekusi.**")
if expression in ("userbot.session", "config.env"):
- return await event.edit("**Itu operasi yang berbahaya! Tidak diperbolehkan!**")
+ return await edit_or_reply("**Itu operasi yang berbahaya! Tidak diperbolehkan!**")
cmd = "".join(event.message.message.split(maxsplit=1)[1:])
if not cmd:
- return event.edit("**Apa yang harus saya jalankan?**")
+ return edit_or_reply("**Apa yang harus saya jalankan?**")
cmd = (
cmd.replace("sendmessage", "send_message")
.replace("sendfile", "send_file")
.replace("editmessage", "edit_message")
)
- xx = await event.edit("`Processing...`")
+ xx = await edit_or_reply("`Processing...`")
if event.reply_to_msg_id:
reply_to_id = event.reply_to_msg_id
old_stderr = sys.stderr
@@ -94,17 +94,17 @@ async def aexec(code, event):
await xx.edit(final_output)
-@bot.on(geez_cmd(outgoing=True, pattern=r"exec(?: |$|\n)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"exec(?: |$|\n)([\s\S]*)"))
async def run(event):
"""For .exec command, which executes the dynamically created program"""
code = event.pattern_match.group(1)
if not code:
- return await event.edit("**Read** `.help exec` **for an example.**")
+ return await edit_or_reply("**Read** `.help exec` **for an example.**")
if code in ("userbot.session", "config.env"):
- return await event.edit("`Itu operasi yang berbahaya! Tidak diperbolehkan!`")
+ return await edit_or_reply("`Itu operasi yang berbahaya! Tidak diperbolehkan!`")
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
if len(code.splitlines()) <= 5:
codepre = code
else:
@@ -141,21 +141,21 @@ async def run(event):
caption="**Output terlalu besar, dikirim sebagai file**",
)
return remove("output.txt")
- await event.edit(f"**Query:**\n`{codepre}`\n\n**Result:**\n`{stdout}`")
+ await edit_or_reply(f"**Query:**\n`{codepre}`\n\n**Result:**\n`{stdout}`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"term(?: |$|\n)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"term(?: |$|\n)([\s\S]*)"))
async def terminal_runner(event):
"""For .term command, runs bash commands and scripts on your server."""
command = event.pattern_match.group(1)
if not command:
- return await event.edit("`Give a command or use .help term for an example.`")
+ return await edit_or_reply("`Give a command or use .help term for an example.`")
if command in ("userbot.session", "config.env"):
- return await event.edit("`Itu operasi yang berbahaya! Tidak diperbolehkan!`")
+ return await edit_or_reply("`Itu operasi yang berbahaya! Tidak diperbolehkan!`")
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
process = await asyncio.create_subprocess_shell(
command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT
)
@@ -180,10 +180,10 @@ async def terminal_runner(event):
)
return remove("output.txt")
- await event.edit(f"**Command:**\n`{command}`\n\n**Result:**\n`{result}`")
+ await edit_or_reply(f"**Command:**\n`{command}`\n\n**Result:**\n`{result}`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"json$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"json$"))
async def _(event):
if event.fwd_from:
return
@@ -209,7 +209,7 @@ async def _(event):
)
await event.delete()
else:
- await event.edit("`{}`".format(the_real_message))
+ await edit_or_reply("`{}`".format(the_real_message))
CMD_HELP.update(
diff --git a/userbot/modules/fban.py b/userbot/modules/fban.py
index f850051d..0434f882 100644
--- a/userbot/modules/fban.py
+++ b/userbot/modules/fban.py
@@ -17,13 +17,13 @@
unfban_replies = ["New un-FedBan", "I'll give", "Un-FedBan"]
-@bot.on(geez_cmd(outgoing=True, pattern=r"(d)?fban(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"(d)?fban(?: |$)(.*)"))
async def fban(event):
"""Bans a user from connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import get_flist
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
match = event.pattern_match.group(2)
@@ -46,17 +46,17 @@ async def fban(event):
pass
if event.sender_id == fban_id:
- return await event.edit(
+ return await edit_or_reply(
"**Error: Tindakan ini telah dicegah oleh protokol keamanan diri GeezProjects.**"
)
fed_list = get_flist()
if len(fed_list) == 0:
- return await event.edit("**Anda belum terhubung ke federasi mana pun!**")
+ return await edit_or_reply("**Anda belum terhubung ke federasi mana pun!**")
user_link = f"[{fban_id}](tg://user?id={fban_id})"
- await event.edit(f"**Fbanning** {user_link}...")
+ await edit_or_reply(f"**Fbanning** {user_link}...")
failed = []
total = 0
@@ -85,18 +85,18 @@ async def fban(event):
else:
status = f"Success! Fbanned in {total} feds."
- await event.edit(
+ await edit_or_reply(
f"**Fbanned **{user_link}!\n**Reason:** {reason}\n**Status:** {status}"
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"unfban(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"unfban(?: |$)(.*)"))
async def unfban(event):
"""Unbans a user from connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import get_flist
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
match = event.pattern_match.group(1)
if event.is_reply:
@@ -113,15 +113,15 @@ async def unfban(event):
pass
if event.sender_id == unfban_id:
- return await event.edit("**Tunggu, itu illegal**")
+ return await edit_or_reply("**Tunggu, itu illegal**")
fed_list = get_flist()
if len(fed_list) == 0:
- return await event.edit("**Anda belum terhubung ke federasi mana pun!**")
+ return await edit_or_reply("**Anda belum terhubung ke federasi mana pun!**")
user_link = f"[{unfban_id}](tg://user?id={unfban_id})"
- await event.edit(f"**Un-fbanning **{user_link}**...**")
+ await edit_or_reply(f"**Un-fbanning **{user_link}**...**")
failed = []
total = 0
@@ -151,73 +151,73 @@ async def unfban(event):
status = f"Success! Un-fbanned in {total} feds."
reason = reason or "Not specified."
- await event.edit(
+ await edit_or_reply(
f"**Un-fbanned** {user_link}!\n**Reason:** {reason}\n**Status:** {status}"
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"addf(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"addf(?: |$)(.*)"))
async def addf(event):
"""Adds current chat to connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import add_flist
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
fed_name = event.pattern_match.group(1)
if not fed_name:
- return await event.edit("**Berikan nama untuk terhubung ke grup ini!**")
+ return await edit_or_reply("**Berikan nama untuk terhubung ke grup ini!**")
try:
add_flist(event.chat_id, fed_name)
except IntegrityError:
- return await event.edit("**Grup ini sudah terhubung ke daftar federasi.**")
+ return await edit_or_reply("**Grup ini sudah terhubung ke daftar federasi.**")
- await event.edit("**Menambahkan grup ini ke daftar federasi!**")
+ await edit_or_reply("**Menambahkan grup ini ke daftar federasi!**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"delf$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"delf$"))
async def delf(event):
"""Removes current chat from connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import del_flist
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
del_flist(event.chat_id)
- await event.edit("**Menghapus grup ini dari daftar federasi!**")
+ await edit_or_reply("**Menghapus grup ini dari daftar federasi!**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"listf$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"listf$"))
async def listf(event):
"""List all connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import get_flist
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
fed_list = get_flist()
if len(fed_list) == 0:
- return await event.edit("**Anda belum terhubung ke federasi mana pun!**")
+ return await edit_or_reply("**Anda belum terhubung ke federasi mana pun!**")
msg = "**Connected federations:**\n\n"
for i in fed_list:
msg += f"• {i.fed_name}\n"
- await event.edit(msg)
+ await edit_or_reply(msg)
-@bot.on(geez_cmd(outgoing=True, pattern=r"clearf$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"clearf$"))
async def clearf(event):
"""Removes all chats from connected federations."""
try:
from userbot.modules.sql_helper.fban_sql import del_flist_all
except IntegrityError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
del_flist_all()
- await event.edit("**Disconnected dari semua federasi yang terhubung!**")
+ await edit_or_reply("**Disconnected dari semua federasi yang terhubung!**")
CMD_HELP.update(
diff --git a/userbot/modules/figlet.py b/userbot/modules/figlet.py
index 8662637b..44c290ea 100644
--- a/userbot/modules/figlet.py
+++ b/userbot/modules/figlet.py
@@ -11,12 +11,12 @@
import pyfiglet
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
from userbot.utils import deEmojify
-@bot.on(geez_cmd(outgoing=True, pattern=r"figlet (\w+) (.+)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"figlet (\w+) (.+)"))
async def figlet(event):
if event.fwd_from:
return
@@ -40,7 +40,7 @@ async def figlet(event):
try:
font = style_list[style]
except KeyError:
- return await event.edit(
+ return await edit_or_reply(
"**Style yang dipilih tidak valid, ketik** `.help figlet` **bila butuh bantuan**"
)
result = pyfiglet.figlet_format(deEmojify(text), font=font)
diff --git a/userbot/modules/filemanager.py b/userbot/modules/filemanager.py
index f725d3b3..e6c8b05d 100644
--- a/userbot/modules/filemanager.py
+++ b/userbot/modules/filemanager.py
@@ -16,21 +16,21 @@
from rarfile import BadRarFile, RarFile, is_rarfile
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
+from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY
from userbot.events import geez_cmd
from userbot.utils import humanbytes
MAX_MESSAGE_SIZE_LIMIT = 4095
-@bot.on(geez_cmd(outgoing=True, pattern=r"ls(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"ls(?: |$)(.*)"))
async def lst(event):
if event.fwd_from:
return
cat = event.pattern_match.group(1)
path = cat or os.getcwd()
if not exists(path):
- await event.edit(
+ await edit_or_reply(
f"Tidak ada direktori atau file dengan nama `{cat}` coba check lagi!"
)
return
@@ -120,40 +120,40 @@ async def lst(event):
)
await event.delete()
else:
- await event.edit(msg)
+ await edit_or_reply(msg)
-@bot.on(geez_cmd(outgoing=True, pattern=r"rm(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rm(?: |$)(.*)"))
async def rmove(event):
"""Removing Directory/File"""
cat = event.pattern_match.group(1)
if not cat:
- await event.edit("`Lokasi file tidak ada!`")
+ await edit_or_reply("`Lokasi file tidak ada!`")
return
if not exists(cat):
- await event.edit("`Lokasi file tidak ada!`")
+ await edit_or_reply("`Lokasi file tidak ada!`")
return
if isfile(cat):
os.remove(cat)
else:
rmtree(cat)
- await event.edit(f"Dihapus `{cat}`")
+ await edit_or_reply(f"Dihapus `{cat}`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"rn ([^|]+)\|([^|]+)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rn ([^|]+)\|([^|]+)"))
async def rname(event):
"""Renaming Directory/File"""
cat = str(event.pattern_match.group(1)).strip()
new_name = str(event.pattern_match.group(2)).strip()
if not exists(cat):
- await event.edit(f"file path : {cat} tidak ada!")
+ await edit_or_reply(f"file path : {cat} tidak ada!")
return
new_path = join(dirname(cat), new_name)
shutil.move(cat, new_path)
- await event.edit(f"Diganti nama dari `{cat}` ke `{new_path}`")
+ await edit_or_reply(f"Diganti nama dari `{cat}` ke `{new_path}`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"zip (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"zip (.*)"))
async def zip_file(event):
if event.fwd_from:
return
@@ -167,7 +167,7 @@ async def zip_file(event):
path = path.strip()
zip_name = zip_name.strip()
if exists(path):
- await event.edit("`Zipping...`")
+ await edit_or_reply("`Zipping...`")
start_time = datetime.now()
if isdir(path):
dir_path = path.split("/")[-1]
@@ -185,7 +185,7 @@ async def zip_file(event):
arc_path = join(dir_path, relpath(files_path, path))
zip_obj.write(files_path, arc_path)
end_time = (datetime.now() - start_time).seconds
- await event.edit(
+ await edit_or_reply(
f"Zipped `{path}` ke `{zip_path}` dalam `{end_time}` detik."
)
elif isfile(path):
@@ -197,12 +197,12 @@ async def zip_file(event):
zip_path += ".zip"
with ZipFile(zip_path, "w", ZIP_DEFLATED) as zip_obj:
zip_obj.write(path, file_name)
- await event.edit(f"Zipped `{path}` ke `{zip_path}`")
+ await edit_or_reply(f"Zipped `{path}` ke `{zip_path}`")
else:
- await event.edit("`404: Not Found`")
+ await edit_or_reply("`404: Not Found`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"unzip (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"unzip (.*)"))
async def unzip_file(event):
if event.fwd_from:
return
@@ -213,7 +213,7 @@ async def unzip_file(event):
output_path = TEMP_DOWNLOAD_DIRECTORY + re.split("(.zip|.rar|.tar)", file_name)[0]
if exists(input_str):
start_time = datetime.now()
- await event.edit("`Unzipping...`")
+ await edit_or_reply("`Unzipping...`")
if is_zipfile(input_str):
zip_type = ZipFile
elif is_rarfile(input_str):
@@ -221,24 +221,24 @@ async def unzip_file(event):
elif is_tarfile(input_str):
zip_type = TarFile
else:
- return await event.edit(
+ return await edit_or_reply(
"`Jenis file tidak didukung!`\n`Hanya Bisa ZIP, RAR dan TAR`"
)
try:
with zip_type(input_str, "r") as zip_obj:
zip_obj.extractall(output_path)
except BadRarFile:
- return await event.edit("**Error:** `File RAR Rusak`")
+ return await edit_or_reply("**Error:** `File RAR Rusak`")
except BadZipFile:
- return await event.edit("**Error:** `File ZIP Rusak`")
+ return await edit_or_reply("**Error:** `File ZIP Rusak`")
except BaseException as err:
- return await event.edit(f"**Error:** `{err}`")
+ return await edit_or_reply(f"**Error:** `{err}`")
end_time = (datetime.now() - start_time).seconds
- await event.edit(
+ await edit_or_reply(
f"Unzipped `{input_str}` ke `{output_path}` dalam `{end_time}` detik."
)
else:
- await event.edit("`404: Not Found`")
+ await edit_or_reply("`404: Not Found`")
CMD_HELP.update(
diff --git a/userbot/modules/filter.py b/userbot/modules/filter.py
index 9ec719fd..64c6d748 100644
--- a/userbot/modules/filter.py
+++ b/userbot/modules/filter.py
@@ -10,7 +10,7 @@
from userbot import BLACKLIST_CHAT, BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd, register
@@ -43,7 +43,7 @@ async def filter_incoming_handler(handler):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"filter (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"filter (.*)"))
async def add_new_filter(new_handler):
"""For .filter command, allows adding new filters in a chat"""
if new_handler.chat_id in BLACKLIST_CHAT:
@@ -92,7 +92,7 @@ async def add_new_filter(new_handler):
await new_handler.edit(success.format(keyword, "Disini"))
-@bot.on(geez_cmd(outgoing=True, pattern=r"stop (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"stop (.*)"))
async def remove_a_filter(r_handler):
"""For .stop command, allows you to remove a filter from a chat."""
try:
@@ -108,14 +108,14 @@ async def remove_a_filter(r_handler):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"delfilterbot (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"delfilterbot (.*)"))
async def kick_marie_filter(event):
""" For .bersihkanbotfilter command, allows you to kick all \
Marie(or her clones) filters from a chat. """
bot_type = event.pattern_match.group(1).lower()
if bot_type not in ["marie", "rose"]:
- return await event.edit("**Bot Itu Belum Didukung!**")
- await event.edit("```Saya Akan Menghapus Semua Filter!```")
+ return await edit_or_reply("**Bot Itu Belum Didukung!**")
+ await edit_or_reply("```Saya Akan Menghapus Semua Filter!```")
await sleep(3)
resp = await event.get_reply_message()
filters = resp.text.split("-")[1:]
@@ -133,20 +133,20 @@ async def kick_marie_filter(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"filters$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"filters$"))
async def filters_active(event):
"""For .filters command, lists all of the active filters in a chat."""
try:
from userbot.modules.sql_helper.filter_sql import get_filters
except AttributeError:
- return await event.edit("**Running on Non-SQL mode!**")
+ return await edit_or_reply("**Running on Non-SQL mode!**")
transact = "**Tidak Ada Filter Apapun Disini.**"
filters = get_filters(event.chat_id)
for filt in filters:
if transact == "**Tidak Ada Filter Apapun Disini.**":
transact = "**✥ Daftar Filter Yang Aktif Disini:**\n"
transact += " ✣ `{}`\n".format(filt.keyword)
- await event.edit(transact)
+ await edit_or_reply(transact)
CMD_HELP.update(
diff --git a/userbot/modules/fun.py b/userbot/modules/fun.py
index 191fd609..7519dc8b 100644
--- a/userbot/modules/fun.py
+++ b/userbot/modules/fun.py
@@ -15,7 +15,7 @@
from userbot.utils import bash, progress
-@bot.on(geez_cmd(outgoing=True, pattern=r"honka(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"honka(?: |$)(.*)"))
async def frg(animu):
text = animu.pattern_match.group(1)
if not text:
@@ -37,12 +37,12 @@ async def frg(animu):
await animu.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"rgif(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rgif(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
reply = await event.get_reply_message()
- await event.edit("`Checking...`")
+ await edit_or_reply("`Checking...`")
download = await bot.download_media(reply.media)
img = cv2.VideoCapture(download)
ret, frame = img.read()
@@ -50,12 +50,12 @@ async def _(event):
danish = PIL.Image.open("danish.png")
dark, python = danish.size
cobra = f"""ffmpeg -f lavfi -i color=c=00ff00:s={dark}x{python}:d=10 -loop 1 -i danish.png -filter_complex "[1]rotate=angle=PI*t:fillcolor=none:ow='hypot(iw,ih)':oh=ow[fg];[0][fg]overlay=x=(W-w)/2:y=(H-h)/2:shortest=1:format=auto,format=yuv420p" -movflags +faststart danish.mp4 -y"""
- await event.edit("```Processing ...```")
+ await edit_or_reply("```Processing ...```")
process = await asyncio.create_subprocess_shell(
cobra, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate()
- await event.edit("```Uploading...```")
+ await edit_or_reply("```Uploading...```")
c_time = time.time()
await event.client.send_file(
event.chat_id,
diff --git a/userbot/modules/funmemes.py b/userbot/modules/funmemes.py
index e79937c8..f1c33386 100644
--- a/userbot/modules/funmemes.py
+++ b/userbot/modules/funmemes.py
@@ -7,7 +7,7 @@
from telethon.errors.rpcerrorlist import MessageIdInvalidError
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot, owner
+from userbot import CMD_HELP, owner
from userbot.events import geez_cmd
# ================= CONSTANT =================
@@ -15,7 +15,7 @@
# ============================================
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -26,7 +26,7 @@ async def _(event):
if input_str == "eye":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"👁👁\n 👄 =====> Hey, How are you?",
@@ -49,44 +49,44 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 103])
+ await edit_or_reply(animation_chars[i % 103])
-@bot.on(geez_cmd(outgoing=True, pattern=r"earth(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"earth(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
deq = deque(list("🌏🌍🌎🌎🌍🌏🌍🌎"))
for _ in range(48):
await asyncio.sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
-@bot.on(geez_cmd(pattern=r"bombs", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"bombs", outgoing=True))
async def _(event):
if event.fwd_from:
return
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
await asyncio.sleep(0.5)
- await event.edit("💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
+ await edit_or_reply("💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n▪️▪️▪️▪️ \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💣💣💣💣 \n")
await asyncio.sleep(1)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💥💥💥💥 \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💥💥💥💥 \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💥💥💥💥 \n💥💥💥💥 \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n💥💥💥💥 \n💥💥💥💥 \n")
await asyncio.sleep(0.5)
- await event.edit("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n😵😵😵😵 \n")
+ await edit_or_reply("▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n▪️▪️▪️▪️ \n😵😵😵😵 \n")
await asyncio.sleep(0.5)
- await event.edit("RIP PLOX...")
+ await edit_or_reply("RIP PLOX...")
await asyncio.sleep(2)
await event.delete()
@@ -94,7 +94,7 @@ async def _(event):
"""Available Commands: .gift"""
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -105,7 +105,7 @@ async def _(event):
if input_str == "gift":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜\n⬜⬜⬜[🎁](https://github.com/sahyam2019/OpenUserBot)⬜",
@@ -135,10 +135,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 17])
+ await edit_or_reply(animation_chars[i % 17])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -149,7 +149,7 @@ async def _(event):
if input_str == "police":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"🔴🔴🔴⬜⬜⬜🔵🔵🔵\n🔴🔴🔴⬜⬜⬜🔵🔵🔵\n🔴🔴🔴⬜⬜⬜🔵🔵🔵",
@@ -174,10 +174,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 12])
+ await edit_or_reply(animation_chars[i % 12])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -188,7 +188,7 @@ async def _(event):
if input_str == "kill":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"Fiiiiire",
@@ -209,10 +209,10 @@ async def _(event):
for i in animation_ttl:
- await event.edit(animation_chars[i % 103])
+ await edit_or_reply(animation_chars[i % 103])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -223,7 +223,7 @@ async def _(event):
if input_str == "Macos":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Hackintosh...`",
@@ -247,10 +247,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -261,7 +261,7 @@ async def _(event):
if input_str == "Windows":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Windows 10...`",
@@ -285,10 +285,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -299,7 +299,7 @@ async def _(event):
if input_str == "Linux":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Linux...`",
@@ -323,10 +323,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -337,7 +337,7 @@ async def _(event):
if input_str == "Stock":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Symbian OS...`",
@@ -361,10 +361,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -375,7 +375,7 @@ async def _(event):
if input_str == "os":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Scanning OS...`",
@@ -395,10 +395,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 7])
+ await edit_or_reply(animation_chars[i % 7])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -409,7 +409,7 @@ async def _(event):
if input_str == "isro":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛",
@@ -446,30 +446,30 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 24])
+ await edit_or_reply(animation_chars[i % 24])
-@bot.on(geez_cmd(outgoing=True, pattern=r"gangstar(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gangstar(?: |$)(.*)"))
async def _(event):
if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"):
- await event.edit("EVERyBOdy")
+ await edit_or_reply("EVERyBOdy")
await asyncio.sleep(0.3)
- await event.edit("wAs")
+ await edit_or_reply("wAs")
await asyncio.sleep(0.2)
- await event.edit("GanGeSTar")
+ await edit_or_reply("GanGeSTar")
await asyncio.sleep(0.5)
- await event.edit("UNtIL ")
+ await edit_or_reply("UNtIL ")
await asyncio.sleep(0.2)
- await event.edit("I")
+ await edit_or_reply("I")
await asyncio.sleep(0.3)
- await event.edit("ArRivEd")
+ await edit_or_reply("ArRivEd")
await asyncio.sleep(0.3)
- await event.edit("😎😎😎")
+ await edit_or_reply("😎😎😎")
await asyncio.sleep(0.3)
- await event.edit("EVERyBOdy wAs GanGeSTar UNtIL I ArRivEd 😎😎😎")
+ await edit_or_reply("EVERyBOdy wAs GanGeSTar UNtIL I ArRivEd 😎😎😎")
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -480,7 +480,7 @@ async def _(event):
if input_str == "hack":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Hacked Private Server...`",
@@ -504,10 +504,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -518,7 +518,7 @@ async def _(event):
if input_str == "hypno":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜",
@@ -546,10 +546,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 15])
+ await edit_or_reply(animation_chars[i % 15])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -560,7 +560,7 @@ async def _(event):
if input_str == "whatsapp":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"Looking for WhatsApp databases in targeted person...",
@@ -588,16 +588,16 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 15])
+ await edit_or_reply(animation_chars[i % 15])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
if input_str == "solar":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`◼️◼️◼️◼️◼️\n◼️◼️◼️◼️☀\n◼️◼️🌎◼️◼️\n🌕◼️◼️◼️◼️\n◼️◼️◼️◼️◼️`",
"`◼️◼️◼️◼️◼️\n🌕◼️◼️◼️◼️\n◼️◼️🌎◼️◼️\n◼️◼️◼️◼️☀\n◼️◼️◼️◼️◼️`",
@@ -749,10 +749,10 @@ async def _(event):
animation_ttl = range(549755813888)
for i in animation_ttl:
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 549755813888])
+ await edit_or_reply(animation_chars[i % 549755813888])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -763,7 +763,7 @@ async def _(event):
if input_str == "quickheal":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Downloading File..`",
@@ -787,10 +787,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -801,7 +801,7 @@ async def _(event):
if input_str == "sqh":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Downloading File..`",
@@ -825,10 +825,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -839,7 +839,7 @@ async def _(event):
if input_str == "vquickheal":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Downloading File..`",
@@ -863,33 +863,33 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(outgoing=True, pattern=r"plane(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"plane(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
- await event.edit("✈-------------")
- await event.edit("-✈------------")
- await event.edit("--✈-----------")
- await event.edit("---✈----------")
- await event.edit("----✈---------")
- await event.edit("-----✈--------")
- await event.edit("------✈-------")
- await event.edit("-------✈------")
- await event.edit("--------✈-----")
- await event.edit("---------✈----")
- await event.edit("----------✈---")
- await event.edit("-----------✈--")
- await event.edit("------------✈-")
- await event.edit("-------------✈")
+ await edit_or_reply("✈-------------")
+ await edit_or_reply("-✈------------")
+ await edit_or_reply("--✈-----------")
+ await edit_or_reply("---✈----------")
+ await edit_or_reply("----✈---------")
+ await edit_or_reply("-----✈--------")
+ await edit_or_reply("------✈-------")
+ await edit_or_reply("-------✈------")
+ await edit_or_reply("--------✈-----")
+ await edit_or_reply("---------✈----")
+ await edit_or_reply("----------✈---")
+ await edit_or_reply("-----------✈--")
+ await edit_or_reply("------------✈-")
+ await edit_or_reply("-------------✈")
await asyncio.sleep(3)
await event.delete()
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -900,7 +900,7 @@ async def _(event):
if input_str == "jio":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Jio Network...`",
@@ -932,10 +932,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 19])
+ await edit_or_reply(animation_chars[i % 19])
-@bot.on(geez_cmd(outgoing=True, pattern=r"dump(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"dump(?: |$)(.*)"))
async def _(message):
try:
obj = message.pattern_match.group(1)
@@ -971,7 +971,7 @@ async def _(message):
return
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -982,7 +982,7 @@ async def _(event):
if input_str == "fadmin":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"**Promoting User As Admin...**",
@@ -1015,10 +1015,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 20])
+ await edit_or_reply(animation_chars[i % 20])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1029,7 +1029,7 @@ async def _(event):
if input_str == "fleave":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬛⬛⬛\n⬛⬛⬛\n⬛⬛⬛",
@@ -1057,10 +1057,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 17])
+ await edit_or_reply(animation_chars[i % 17])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1071,7 +1071,7 @@ async def _(event):
if input_str == "snake":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"◼️◼️◼️◼️◼️\n◼️◼️◼️◼️◼️\n◼️◼️◼️◼️◼️\n◼️◼️◼️◼️◼️\n◼️◼️◼️◼️◼️",
@@ -1111,16 +1111,16 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 27])
+ await edit_or_reply(animation_chars[i % 27])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
if input_str == "think":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"THINKING",
"THI&K#N₹",
@@ -1165,16 +1165,16 @@ async def _(event):
for i in animation_ttl:
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 72])
+ await edit_or_reply(animation_chars[i % 72])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
if input_str == "wtf":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"What",
"What The",
@@ -1188,10 +1188,10 @@ async def _(event):
for i in animation_ttl:
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 5])
+ await edit_or_reply(animation_chars[i % 5])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1202,7 +1202,7 @@ async def _(event):
if input_str == "music":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬤⬤⬤ 81% ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀`✖️`\n\n⠀⠀⠀⠀⠀[cee jay Music Player](tg://user?id=689811472)\n\n⠀⠀⠀⠀**Now Playing:Kamasutra BGM**\n\n**00:00** ▱▱▱▱▱▱▱▱▱▱ **00:10**\n\n⠀⠀⠀⠀⠀`🔂` `⏮️` `⏪️` `▶️` `⏩️` `⏭️`\n\n**⠀Next Song:** __I Am Sexy And I Know It.__\n\n⠀⠀⠀⠀**⠀Device: Nokia 1100**",
@@ -1226,10 +1226,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1240,7 +1240,7 @@ async def _(event):
if input_str == "call":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"`Connecting To Telegram Headquarters...`",
@@ -1271,10 +1271,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 18])
+ await edit_or_reply(animation_chars[i % 18])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1285,7 +1285,7 @@ async def _(event):
if input_str == "human":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"⬛⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛⬛\n⬛⬛⬛⬛⬛⬛⬛\n⬜⬜⬜⬜⬜⬜⬜\n⬜⬜⬜⬜⬜⬜⬜\n🔲🔲🔲🔲🔲🔲🔲",
@@ -1314,10 +1314,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 16])
+ await edit_or_reply(animation_chars[i % 16])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1328,7 +1328,7 @@ async def _(event):
if input_str == "load":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["▮", "▯", "▬", "▭", ""]
@@ -1340,10 +1340,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 4])
+ await edit_or_reply(animation_chars[i % 4])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1354,7 +1354,7 @@ async def _(event):
if input_str == "square":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["◧", "◨", "◧", "◨", ""]
@@ -1366,10 +1366,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 4])
+ await edit_or_reply(animation_chars[i % 4])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1380,7 +1380,7 @@ async def _(event):
if input_str == "up":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["╹", "╻", "╹", "╻", ""]
@@ -1392,10 +1392,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 4])
+ await edit_or_reply(animation_chars[i % 4])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1406,7 +1406,7 @@ async def _(event):
if input_str == "round":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["⚫", "⬤", "●", "∘", ""]
@@ -1418,10 +1418,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 4])
+ await edit_or_reply(animation_chars[i % 4])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1432,7 +1432,7 @@ async def _(event):
if input_str == "heart":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["🖤", "❤️", "🖤", "❤️", ""]
@@ -1444,10 +1444,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 4])
+ await edit_or_reply(animation_chars[i % 4])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1458,7 +1458,7 @@ async def _(event):
if input_str == "anim":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"😁",
@@ -1480,10 +1480,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 11])
+ await edit_or_reply(animation_chars[i % 11])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1494,7 +1494,7 @@ async def _(event):
if input_str == "fnl":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"😁🏿",
@@ -1513,10 +1513,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 6])
+ await edit_or_reply(animation_chars[i % 6])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1527,7 +1527,7 @@ async def _(event):
if input_str == "monkey":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = ["🐵", "🙉", "🙈", "🙊", "🖕🐵🖕", "**OPPA MONEKEYY Style....**"]
@@ -1539,10 +1539,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 6])
+ await edit_or_reply(animation_chars[i % 6])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1553,7 +1553,7 @@ async def _(event):
if input_str == "hand":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"👈",
@@ -1579,10 +1579,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 14])
+ await edit_or_reply(animation_chars[i % 14])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1593,7 +1593,7 @@ async def _(event):
if input_str == "cnt":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"🔟",
@@ -1618,10 +1618,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 13])
+ await edit_or_reply(animation_chars[i % 13])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1632,7 +1632,7 @@ async def _(event):
if input_str == "wupload":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"Uploading File From Telegram To Whatsapp...",
@@ -1660,10 +1660,10 @@ async def _(event):
await asyncio.sleep(animation_interval)
- await event.edit(animation_chars[i % 15])
+ await edit_or_reply(animation_chars[i % 15])
-@bot.on(geez_cmd(pattern=r"(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
@@ -1674,7 +1674,7 @@ async def _(event):
if input_str == "admeme":
- await event.edit(input_str)
+ await edit_or_reply(input_str)
animation_chars = [
"@aaaaaaaaaaaaadddddddddddddmmmmmmmmmmmmmiiiiiiiiiiiiinnnnnnnnnnnnn",
@@ -1696,17 +1696,17 @@ async def _(event):
for i in animation_ttl:
- await event.edit(animation_chars[i % 103])
+ await edit_or_reply(animation_chars[i % 103])
-@bot.on(geez_cmd(outgoing=True, pattern=r"kiss(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"kiss(?: |$)(.*)"))
async def _(event):
if event.fwd_from:
return
deq = deque(list("😗😙😚😚😘"))
for _ in range(48):
await asyncio.sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
diff --git a/userbot/modules/gban.py b/userbot/modules/gban.py
index 5991fd68..cf17eddd 100644
--- a/userbot/modules/gban.py
+++ b/userbot/modules/gban.py
@@ -3,14 +3,14 @@
from telethon.events import ChatAction
-from userbot import DEVS, bot, owner
+from userbot import DEVS, owner
from userbot.events import register
from userbot.utils import geez_cmd, get_user_from_event
# Ported For Lord-Userbot by liualvinas/Alvin
-@bot.on(ChatAction)
+@geez_cmd(ChatAction)
async def handler(tele):
if not tele.user_joined and not tele.user_added:
return
diff --git a/userbot/modules/getmusic.py b/userbot/modules/getmusic.py
index 85941739..57a0b46d 100644
--- a/userbot/modules/getmusic.py
+++ b/userbot/modules/getmusic.py
@@ -167,7 +167,7 @@ async def _(event):
if event.pattern_match.group(1) == "now":
playing = User(LASTFM_USERNAME, lastfm).get_now_playing()
if playing is None:
- return await event.edit(
+ return await edit_or_reply(
"`Error: Tidak ada data scrobbling yang ditemukan.`"
)
artist = playing.get_artist()
@@ -178,10 +178,10 @@ async def _(event):
track = str(artist) + " - " + str(song)
chat = "@SpotifyMusicDownloaderBot"
try:
- await event.edit("`Getting Your Music...`")
+ await edit_or_reply("`Getting Your Music...`")
async with bot.conversation(chat) as conv:
await asyncio.sleep(2)
- await event.edit("`Downloading...`")
+ await edit_or_reply("`Downloading...`")
try:
response = conv.wait_event(
events.NewMessage(incoming=True, from_users=752979930)
@@ -202,7 +202,7 @@ async def _(event):
await event.client.delete_messages(conv.chat_id, [msg.id, r.id, respond.id])
await event.delete()
except TimeoutError:
- return await event.edit(
+ return await edit_or_reply(
"`Error: `@SpotifyMusicDownloaderBot` tidak merespons atau Lagu tidak ditemukan!.`"
)
@@ -214,7 +214,7 @@ async def _(event):
if event.pattern_match.group(1) == "now":
playing = User(LASTFM_USERNAME, lastfm).get_now_playing()
if playing is None:
- return await event.edit(
+ return await edit_or_reply(
"`Error: Tidak ada scrobble saat ini yang ditemukan.`"
)
artist = playing.get_artist()
@@ -225,11 +225,11 @@ async def _(event):
track = str(artist) + " - " + str(song)
chat = "@WooMaiBot"
link = f"/netease {track}"
- await event.edit("`Searching...`")
+ await edit_or_reply("`Searching...`")
try:
async with bot.conversation(chat) as conv:
await asyncio.sleep(2)
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
try:
msg = await conv.send_message(link)
response = await conv.get_response()
@@ -238,7 +238,7 @@ async def _(event):
except YouBlockedUserError:
await event.reply("`Please unblock @WooMaiBot and try again`")
return
- await event.edit("`Sending Your Music...`")
+ await edit_or_reply("`Sending Your Music...`")
await asyncio.sleep(3)
await bot.send_file(event.chat_id, respond)
await event.client.delete_messages(
@@ -246,7 +246,7 @@ async def _(event):
)
await event.delete()
except TimeoutError:
- return await event.edit(
+ return await edit_or_reply(
"`Error: `@WooMaiBot` tidak merespons atau Lagu tidak ditemukan!.`"
)
@@ -257,9 +257,9 @@ async def _(event):
return
d_link = event.pattern_match.group(1)
if ".com" not in d_link:
- await event.edit("`Masukkan link yang valid untuk mendownload`")
+ await edit_or_reply("`Masukkan link yang valid untuk mendownload`")
else:
- await event.edit("`Processing...`")
+ await edit_or_reply("`Processing...`")
chat = "@MusicsHunterBot"
try:
async with bot.conversation(chat) as conv:
@@ -271,7 +271,7 @@ async def _(event):
song = await conv.get_response()
await bot.send_read_acknowledge(conv.chat_id)
except YouBlockedUserError:
- await event.edit("`Unblock `@MusicsHunterBot` and retry`")
+ await edit_or_reply("`Unblock `@MusicsHunterBot` and retry`")
return
await bot.send_file(event.chat_id, song, caption=details.text)
await event.client.delete_messages(
@@ -279,7 +279,7 @@ async def _(event):
)
await event.delete()
except TimeoutError:
- return await event.edit(
+ return await edit_or_reply(
"`Error: `@MusicsHunterBot` tidak merespons atau Lagu tidak ditemukan!.`"
)
@@ -303,13 +303,13 @@ async def _(event):
ARL_TOKEN = DEEZER_ARL_TOKEN
if ARL_TOKEN is None:
- await event.edit(strings["invalid_arl_token"])
+ await edit_or_reply(strings["invalid_arl_token"])
return
try:
loader = deezloader.Login(ARL_TOKEN)
except Exception as er:
- await event.edit(str(er))
+ await edit_or_reply(str(er))
return
temp_dl_path = os.path.join(TEMP_DOWNLOAD_DIRECTORY, str(time.time()))
@@ -319,7 +319,7 @@ async def _(event):
required_link = event.pattern_match.group(1)
required_qty = event.pattern_match.group(2)
- await event.edit(strings["processing"])
+ await edit_or_reply(strings["processing"])
if "spotify" in required_link:
if "track" in required_link:
@@ -331,7 +331,7 @@ async def _(event):
recursive_download=True,
not_interface=True,
)
- await event.edit(strings["uploading"])
+ await edit_or_reply(strings["uploading"])
await upload_track(required_track, event)
shutil.rmtree(temp_dl_path)
await event.delete()
@@ -346,7 +346,7 @@ async def _(event):
not_interface=True,
zips=False,
)
- await event.edit(strings["uploading"])
+ await edit_or_reply(strings["uploading"])
for required_track in reqd_albums:
await upload_track(required_track, event)
shutil.rmtree(temp_dl_path)
@@ -362,7 +362,7 @@ async def _(event):
recursive_download=True,
not_interface=True,
)
- await event.edit(strings["uploading"])
+ await edit_or_reply(strings["uploading"])
await upload_track(required_track, event)
shutil.rmtree(temp_dl_path)
await event.delete()
@@ -377,14 +377,14 @@ async def _(event):
not_interface=True,
zips=False,
)
- await event.edit(strings["uploading"])
+ await edit_or_reply(strings["uploading"])
for required_track in reqd_albums:
await upload_track(required_track, event)
shutil.rmtree(temp_dl_path)
await event.delete()
else:
- await event.edit(strings["wrong_cmd_syntax"])
+ await edit_or_reply(strings["wrong_cmd_syntax"])
async def upload_track(track_location, message):
diff --git a/userbot/modules/gitcommit.py b/userbot/modules/gitcommit.py
index fd24e60d..f2ddd182 100644
--- a/userbot/modules/gitcommit.py
+++ b/userbot/modules/gitcommit.py
@@ -14,20 +14,20 @@
# from uniborg.util import admin_cmd, humanbytes, progress, time_formatter
# from userbot.events import humanbytes, progress, time_formatter
from userbot import CMD_HELP, GIT_REPO_NAME, GITHUB_ACCESS_TOKEN, bot
-from userbot.events import geez_cmd
+from userbot.utils import edit_or_reply, geez_cmd
GIT_TEMP_DIR = "./userbot/temp/"
-@bot.on(geez_cmd(outgoing=True, pattern=r"gcommit(?: |$)(.*)"))
+@geez_cmd(pattern="gcommit$")
async def download(event):
if event.fwd_from:
return
if GITHUB_ACCESS_TOKEN is None:
- await event.edit("`Please ADD Proper Access Token from github.com`")
+ await edit_or_reply("`Please ADD Proper Access Token from github.com`")
return
if GIT_REPO_NAME is None:
- await event.edit("`Please ADD Proper Github Repo Name of your userbot`")
+ await edit_or_reply("`Please ADD Proper Github Repo Name of your userbot`")
return
mone = await event.reply("Processing ...")
if not os.path.isdir(GIT_TEMP_DIR):
diff --git a/userbot/modules/github.py b/userbot/modules/github.py
index 833685f8..c9dc3d17 100644
--- a/userbot/modules/github.py
+++ b/userbot/modules/github.py
@@ -12,14 +12,14 @@
from pySmartDL import SmartDL
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
-from userbot.utils import edit_delete, edit_or_reply, reply_id
+from userbot import CMD_HELP
+
+from userbot.utils import edit_delete, edit_or_reply, reply_id, geez_cmd
ppath = os.path.join(os.getcwd(), "temp", "githubuser.jpg")
-@bot.on(geez_cmd(outgoing=True, pattern=r"github( -l(\d+))? ([\s\S]*)"))
+@geez_cmd(pattern="github( -l(\d+))? ([\s\S]*)")
async def _(event):
"Get info about an GitHub User"
reply_to = await reply_id(event)
diff --git a/userbot/modules/glitcher.py b/userbot/modules/glitcher.py
index d3234412..e2614fe0 100644
--- a/userbot/modules/glitcher.py
+++ b/userbot/modules/glitcher.py
@@ -14,30 +14,30 @@
from telethon import functions, types
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
-from userbot.events import geez_cmd
+from userbot.utils import edit_or_reply, geez_cmd
from userbot.utils import check_media, progress
Glitched = TEMP_DOWNLOAD_DIRECTORY + "glitch.gif"
-@bot.on(geez_cmd(outgoing=True, pattern=r"glitch(?: |$)(.*)"))
+@geez_cmd(pattern="glitch$")
async def glitch(event):
if not event.reply_to_msg_id:
- await event.edit("`Aku Mau Glitch Sebuah Hantu!`")
+ await edit_or_reply("`Aku Mau Glitch Sebuah Hantu!`")
return
reply_message = await event.get_reply_message()
if not reply_message.media:
- await event.edit("`Bales Ke Gambar/Sticker`")
+ await edit_or_reply("`Bales Ke Gambar/Sticker`")
return
await bot.download_file(reply_message.media)
- await event.edit("`Sedang Mendownload Media....`")
+ await edit_or_reply("`Sedang Mendownload Media....`")
if event.is_reply:
data = await check_media(reply_message)
if isinstance(data, bool):
- await event.edit("`File Tidak Di Dukung...`")
+ await edit_or_reply("`File Tidak Di Dukung...`")
return
else:
- await event.edit("`Balas Ke Media....`")
+ await edit_or_reply("`Balas Ke Media....`")
return
try:
@@ -46,7 +46,7 @@ async def glitch(event):
raise ValueError
except ValueError:
value = 2
- await event.edit("```Melakukan Glitch Pada Media Ini```")
+ await edit_or_reply("```Melakukan Glitch Pada Media Ini```")
await asyncio.sleep(2)
file_name = "glitch.png"
to_download_directory = TEMP_DOWNLOAD_DIRECTORY
@@ -69,7 +69,7 @@ async def glitch(event):
duration=DURATION,
loop=LOOP,
)
- await event.edit("`Sedang Mengunggah Media Yang Telah Di Glitch`")
+ await edit_or_reply("`Sedang Mengunggah Media Yang Telah Di Glitch`")
c_time = time.time()
nosave = await event.client.send_file(
event.chat_id,
diff --git a/userbot/modules/globalban.py b/userbot/modules/globalban.py
index 0c8a1887..3f4be3a5 100644
--- a/userbot/modules/globalban.py
+++ b/userbot/modules/globalban.py
@@ -10,7 +10,7 @@
import userbot.modules.sql_helper.gban_sql as gban_sql
from userbot import BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, DEVS, bot
+from userbot import CMD_HELP, DEVS
from userbot.events import register
from userbot.utils import edit_or_reply, geez_cmd, get_user_from_event
@@ -167,7 +167,7 @@ async def gablist(event):
await edit_or_reply(event, GBANNED_LIST)
-@bot.on(events.ChatAction)
+@geez_cmd(events.ChatAction)
async def _(event):
if event.user_joined or event.added_by:
user = await event.get_user()
diff --git a/userbot/modules/gps.py b/userbot/modules/gps.py
index 63f3090e..35c9930d 100644
--- a/userbot/modules/gps.py
+++ b/userbot/modules/gps.py
@@ -3,11 +3,11 @@
from telethon.tl import types
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP
+from userbot.utils import edit_or_reply, geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"gps(?: |$)(.*)"))
+@geez_cmd(pattern="gps$")
async def gps(event):
if event.fwd_from:
return
@@ -17,9 +17,9 @@ async def gps(event):
input_str = event.pattern_match.group(1)
if not input_str:
- return await event.edit("`Berikan Tempat Yang Dicari...`")
+ return await edit_or_reply("`Berikan Tempat Yang Dicari...`")
- await event.edit("`Menemukan Lokasi Ini Di Server Map....`")
+ await edit_or_reply("`Menemukan Lokasi Ini Di Server Map....`")
geolocator = Nominatim(user_agent="Geez")
geoloc = geolocator.geocode(input_str)
@@ -32,7 +32,7 @@ async def gps(event):
)
await event.delete()
else:
- await event.edit("`Maaf Saya Tidak Dapat Menemukannya`")
+ await edit_or_reply("`Maaf Saya Tidak Dapat Menemukannya`")
CMD_HELP.update(
diff --git a/userbot/modules/hash.py b/userbot/modules/hash.py
index a3d997d0..7a9ac1a2 100644
--- a/userbot/modules/hash.py
+++ b/userbot/modules/hash.py
@@ -10,11 +10,11 @@
import pybase64
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP
+from userbot.utils import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"hash (.*)"))
+@geez_cmd(pattern="hash$")
async def gethash(hash_q):
"""For .hash command, find the md5, sha1, sha256, sha512 of the string."""
hashtxt_ = hash_q.pattern_match.group(1)
@@ -56,7 +56,7 @@ async def gethash(hash_q):
await hash_q.reply(ans)
-@bot.on(geez_cmd(outgoing=True, pattern=r"base64 (en|de) (.*)"))
+@geez_cmd(pattern="base64$")
async def endecrypt(query):
"""For .base64 command, find the base64 encoding of the given string."""
if query.pattern_match.group(1) == "en":
diff --git a/userbot/modules/imgmemes.py b/userbot/modules/imgmemes.py
index 7a2a55de..18aa7b80 100644
--- a/userbot/modules/imgmemes.py
+++ b/userbot/modules/imgmemes.py
@@ -12,7 +12,7 @@
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
-from userbot.events import geez_cmd
+from userbot.utils import edit_or_reply, geez_cmd
from userbot.utils import bash, deEmojify
@@ -176,7 +176,7 @@ async def purge():
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"trump(?: |$)(.*)"))
+@geez_cmd(pattern="trump$")
async def trump(event):
text = event.pattern_match.group(1)
text = re.sub("&", "", text)
@@ -187,9 +187,9 @@ async def trump(event):
if event.is_reply and not reply_to_id.media:
text = reply_to_id.message
else:
- await event.edit("`Send you text to trump so he can tweet.`")
+ await edit_or_reply("`Send you text to trump so he can tweet.`")
return
- await event.edit("`Requesting trump to tweet...`")
+ await edit_or_reply("`Requesting trump to tweet...`")
text = deEmojify(text)
img = await trumptweet(text)
await event.client.send_file(event.chat_id, img, reply_to=reply_to_id)
@@ -197,7 +197,7 @@ async def trump(event):
await purge()
-@bot.on(geez_cmd(pattern=r"modi(?: |$)(.*)", outgoing=True))
+@geez_cmd(pattern="modi$")
async def nekobot(event):
text = event.pattern_match.group(1)
reply_to_id = event.message
@@ -207,9 +207,9 @@ async def nekobot(event):
if event.is_reply and not reply_to_id.media:
text = reply_to_id.message
else:
- await event.edit("Send you text to modi so he can tweet.")
+ await edit_or_reply("Send you text to modi so he can tweet.")
return
- await event.edit("Requesting modi to tweet...")
+ await edit_or_reply("Requesting modi to tweet...")
text = deEmojify(text)
file = await moditweet(text)
await event.client.send_file(event.chat_id, file, reply_to=reply_to_id)
@@ -217,7 +217,7 @@ async def nekobot(event):
await purge()
-@bot.on(geez_cmd(outgoing=True, pattern=r"cmm(?: |$)(.*)"))
+@geez_cmd(pattern="cmm$")
async def cmm(event):
text = event.pattern_match.group(1)
text = re.sub("&", "", text)
@@ -228,9 +228,9 @@ async def cmm(event):
if event.is_reply and not reply_to_id.media:
text = reply_to_id.message
else:
- await event.edit("`Give text for to write on banner!`")
+ await edit_or_reply("`Give text for to write on banner!`")
return
- await event.edit("`Your banner is under creation wait a sec...`")
+ await edit_or_reply("`Your banner is under creation wait a sec...`")
text = deEmojify(text)
img = await changemymind(text)
await event.client.send_file(event.chat_id, img, reply_to=reply_to_id)
@@ -238,7 +238,7 @@ async def cmm(event):
await purge()
-@bot.on(geez_cmd(outgoing=True, pattern=r"kanna(?: |$)(.*)"))
+@geez_cmd(pattern="kanna$")
async def kanna(event):
text = event.pattern_match.group(1)
text = re.sub("&", "", text)
@@ -249,9 +249,9 @@ async def kanna(event):
if event.is_reply and not reply_to_id.media:
text = reply_to_id.message
else:
- await event.edit("`What should kanna write give text!`")
+ await edit_or_reply("`What should kanna write give text!`")
return
- await event.edit("`Kanna is writing your text...`")
+ await edit_or_reply("`Kanna is writing your text...`")
text = deEmojify(text)
img = await kannagen(text)
await event.client.send_file(event.chat_id, img, reply_to=reply_to_id)
@@ -259,7 +259,7 @@ async def kanna(event):
await purge()
-@bot.on(geez_cmd(outgoing=True, pattern=r"\.tweet(?: |$)(.*)"))
+@geez_cmd(pattern="tweet$")
async def tweet(event):
text = event.pattern_match.group(1)
text = re.sub("&", "", text)
@@ -271,16 +271,16 @@ async def tweet(event):
if not reply_to_id.media:
text = reply_to_id.message
else:
- await event.edit("`What should i tweet? Give your username and tweet!`")
+ await edit_or_reply("`What should i tweet? Give your username and tweet!`")
return
else:
- await event.edit("What should i tweet? Give your username and tweet!`")
+ await edit_or_reply("What should i tweet? Give your username and tweet!`")
return
if "." in text:
username, text = text.split(".", 1)
else:
- await event.edit("`What should i tweet? Give your username and tweet!`")
- await event.edit(f"`Requesting {username} to tweet...`")
+ await edit_or_reply("`What should i tweet? Give your username and tweet!`")
+ await edit_or_reply(f"`Requesting {username} to tweet...`")
text = deEmojify(text)
img = await tweets(text, username)
await event.client.send_file(event.chat_id, img, reply_to=reply_to_id)
@@ -288,18 +288,18 @@ async def tweet(event):
await purge()
-@bot.on(geez_cmd(pattern=r"threat(?: |$)(.*)", outgoing=True))
+@geez_cmd(pattern="threat$")
async def nekobot(event):
replied = await event.get_reply_message()
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
if not replied:
- await event.edit("reply to a supported media file")
+ await edit_or_reply("reply to a supported media file")
return
if replied.media:
- await event.edit("passing to telegraph...")
+ await edit_or_reply("passing to telegraph...")
else:
- await event.edit("reply to a supported media file")
+ await edit_or_reply("reply to a supported media file")
return
download_location = await bot.download_media(replied, TEMP_DOWNLOAD_DIRECTORY)
if download_location.endswith((".webp")):
@@ -307,21 +307,21 @@ async def nekobot(event):
size = os.stat(download_location).st_size
if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
if size > 5242880:
- await event.edit(
+ await edit_or_reply(
"the replied file size is not supported it must me below 5 mb"
)
os.remove(download_location)
return
- await event.edit("generating image..")
+ await edit_or_reply("generating image..")
else:
- await event.edit("the replied file is not supported")
+ await edit_or_reply("the replied file is not supported")
os.remove(download_location)
return
try:
response = upload_file(download_location)
os.remove(download_location)
except exceptions.TelegraphException as exc:
- await event.edit("ERROR: " + str(exc))
+ await edit_or_reply("ERROR: " + str(exc))
os.remove(download_location)
return
file = f"https://telegra.ph{response[0]}"
@@ -330,18 +330,18 @@ async def nekobot(event):
await bot.send_file(event.chat_id, file, reply_to=replied)
-@bot.on(geez_cmd(pattern=r"trash(?: |$)(.*)", outgoing=True))
+@geez_cmd(pattern="trash$")
async def nekobot(event):
replied = await event.get_reply_message()
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
if not replied:
- await event.edit("reply to a supported media file")
+ await edit_or_reply("reply to a supported media file")
return
if replied.media:
- await event.edit("passing to telegraph...")
+ await edit_or_reply("passing to telegraph...")
else:
- await event.edit("reply to a supported media file")
+ await edit_or_reply("reply to a supported media file")
return
download_location = await bot.download_media(replied, TEMP_DOWNLOAD_DIRECTORY)
if download_location.endswith((".webp")):
@@ -349,21 +349,21 @@ async def nekobot(event):
size = os.stat(download_location).st_size
if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
if size > 5242880:
- await event.edit(
+ await edit_or_reply(
"the replied file size is not supported it must me below 5 mb"
)
os.remove(download_location)
return
- await event.edit("generating image..")
+ await edit_or_reply("generating image..")
else:
- await event.edit("the replied file is not supported")
+ await edit_or_reply("the replied file is not supported")
os.remove(download_location)
return
try:
response = upload_file(download_location)
os.remove(download_location)
except exceptions.TelegraphException as exc:
- await event.edit("ERROR: " + str(exc))
+ await edit_or_reply("ERROR: " + str(exc))
os.remove(download_location)
return
file = f"https://telegra.ph{response[0]}"
@@ -372,7 +372,7 @@ async def nekobot(event):
await bot.send_file(event.chat_id, file, reply_to=replied)
-@bot.on(geez_cmd(pattern=r"trap(?: |$)(.*)", outgoing=True))
+@geez_cmd(pattern="trap$")
async def nekobot(e):
input_str = e.pattern_match.group(1)
input_str = deEmojify(input_str)
@@ -424,20 +424,20 @@ async def nekobot(e):
# Ported by @AshSTR
-@bot.on(geez_cmd(outgoing=True, pattern=r"fgs ((.*) ; (.*))"))
+@geez_cmd(pattern="fgs$")
async def FakeGoogleSearch(event):
"""Get a user-customised google search meme!"""
input_str = event.pattern_match.group(1)
if input_str is None:
- await event.edit("No input found!", del_in=5)
+ await edit_or_reply("No input found!", del_in=5)
return
if ";" in input_str:
search, result = input_str.split(";", 1)
else:
- await event.edit("Invalid Input! Check help for more info!", del_in=5)
+ await edit_or_reply("Invalid Input! Check help for more info!", del_in=5)
return
- await event.edit("Connecting to `https://www.google.com/` ...")
+ await edit_or_reply("Connecting to `https://www.google.com/` ...")
await asyncio.sleep(2)
img = "https://i.imgur.com/wNFr5X2.jpg"
r = download(img)
@@ -459,10 +459,10 @@ async def FakeGoogleSearch(event):
os.remove("downloads/test.jpg")
-@bot.on(geez_cmd(outgoing=True, pattern=r"ph(?: |$)(.*)"))
+@geez_cmd(pattern="ph$")
async def phcomment(event):
try:
- await event.edit("`Processing..`")
+ await edit_or_reply("`Processing..`")
text = event.pattern_match.group(1)
reply = await event.get_reply_message()
if reply:
@@ -479,7 +479,7 @@ async def phcomment(event):
else:
name = user.first_name
else:
- return await event.edit("`Give text..`")
+ return await edit_or_reply("`Give text..`")
try:
photo = await event.client.download_profile_photo(
user.id,
@@ -491,7 +491,7 @@ async def phcomment(event):
uplded = "https://telegra.ph/file/7d110cd944d54f72bcc84.jpg"
except BaseException as e:
await purge()
- return await event.edit(f"`Error: {e}`")
+ return await edit_or_reply(f"`Error: {e}`")
img = await phss(uplded, text, name)
try:
await event.client.send_file(
@@ -501,7 +501,7 @@ async def phcomment(event):
)
except BaseException:
await purge()
- return await event.edit("`Reply message has no text!`")
+ return await edit_or_reply("`Reply message has no text!`")
await event.delete()
await purge()
diff --git a/userbot/modules/justfun.py b/userbot/modules/justfun.py
index f198fd83..7266233f 100644
--- a/userbot/modules/justfun.py
+++ b/userbot/modules/justfun.py
@@ -6,7 +6,7 @@
from userbot.events import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"xogame(?: |$)(.*)"))
+@geez_cmd(pattern="xogame$")
async def _(event):
if event.fwd_from:
return
@@ -22,7 +22,7 @@ async def _(event):
# Alvin Gans
-@bot.on(geez_cmd(outgoing=True, pattern=r"wp(?: |$)(.*)"))
+@geez_cmd(pattern="wp$")
async def _(event):
if event.fwd_from:
return
@@ -38,7 +38,7 @@ async def _(event):
# Alvin Gans
-@bot.on(geez_cmd(outgoing=True, pattern=r"mod(?: |$)(.*)"))
+@geez_cmd(pattern="mod$")
async def _(event):
if event.fwd_from:
return
diff --git a/userbot/modules/log.py b/userbot/modules/log.py
index 910c217f..bfc52c5c 100644
--- a/userbot/modules/log.py
+++ b/userbot/modules/log.py
@@ -10,7 +10,7 @@
from userbot import BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, LOGS, SUDO_USERS, bot
+from userbot import CMD_HELP, LOGS, SUDO_USERS
from userbot.modules.sql_helper import no_log_pms_sql
from userbot.modules.sql_helper.globals import addgvar, gvarstatus
from userbot.modules.vcplugin import vcmention
@@ -28,7 +28,7 @@ def __init__(self):
LOG_CHATS_ = LOG_CHATS()
-@bot.on(events.ChatAction)
+@geez_cmd(events.ChatAction)
async def logaddjoin(event):
user = await event.get_user()
chat = await event.get_chat()
@@ -48,8 +48,8 @@ async def logaddjoin(event):
await event.client.send_message(BOTLOG_CHATID, text)
-@bot.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
-@bot.on(events.MessageEdited(incoming=True, func=lambda e: e.is_private))
+@geez_cmd(events.NewMessage(incoming=True, func=lambda e: e.is_private))
+@geez_cmd(events.MessageEdited(incoming=True, func=lambda e: e.is_private))
async def monito_p_m_s(event):
if BOTLOG_CHATID == -100:
return
@@ -84,8 +84,8 @@ async def monito_p_m_s(event):
LOGS.warn(str(e))
-@bot.on(events.NewMessage(incoming=True, func=lambda e: e.mentioned))
-@bot.on(events.MessageEdited(incoming=True, func=lambda e: e.mentioned))
+@geez_cmd(events.NewMessage(incoming=True, func=lambda e: e.mentioned))
+@geez_cmd(events.MessageEdited(incoming=True, func=lambda e: e.mentioned))
async def log_tagged_messages(event):
if BOTLOG_CHATID == -100:
return
diff --git a/userbot/modules/logo.py b/userbot/modules/logo.py
index 803d0aeb..bbdf989d 100644
--- a/userbot/modules/logo.py
+++ b/userbot/modules/logo.py
@@ -10,7 +10,7 @@
from userbot.utils import edit_delete, edit_or_reply, geez_cmd
-@geez_cmd(pattern=r"logo(?: |$)(.*)")
+@geez_cmd(pattern="logo$")
async def _(event):
if event.fwd_from:
return
diff --git a/userbot/modules/memes.py b/userbot/modules/memes.py
index 579aefe8..4d63c804 100644
--- a/userbot/modules/memes.py
+++ b/userbot/modules/memes.py
@@ -15,9 +15,9 @@
from cowpy import cow
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
-from userbot.utils import edit_delete, get_user_from_event
+from userbot import CMD_HELP
+
+from userbot.utils import edit_delete, get_user_from_event, geez_cmd
# ================= CONSTANT =================
METOOSTR = [
@@ -883,7 +883,7 @@
# ===========================================
-@bot.on(geez_cmd(outgoing=True, pattern=r"(\w+)say (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"(\w+)say (.*)"))
async def _(cowmsg):
"""For .cowsay module, userbot wrapper for cow which says things."""
arg = cowmsg.pattern_match.group(1).lower()
@@ -899,7 +899,7 @@ async def _(cowmsg):
await cowmsg.edit(f"`{cheese.milk(text).replace('`', '´')}`")
-@bot.on(geez_cmd(outgoing=True, pattern=r"coinflip (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"coinflip (.*)"))
async def _(event):
r = choice(["Kepala", "Ekor"])
input_str = event.pattern_match.group(1)
@@ -907,25 +907,25 @@ async def _(event):
input_str = input_str.lower()
if r == "Kepala":
if input_str == "Kepala":
- await event.edit("Koin Itu Mendarat Di: **Kepala**.\nKamu Benar.")
+ await edit_or_reply("Koin Itu Mendarat Di: **Kepala**.\nKamu Benar.")
elif input_str == "Ekor":
- await event.edit(
+ await edit_or_reply(
"Koin Itu Mendarat Di: **Kepala**.\nKamu Salah, Coba Lagi..."
)
else:
- await event.edit("Koin Itu Mendarat Di: **Kepala**.")
+ await edit_or_reply("Koin Itu Mendarat Di: **Kepala**.")
elif r == "Ekor":
if input_str == "Ekor":
- await event.edit("Koin Itu Mendarat Di: **Ekor**.\nKamu Benar.")
+ await edit_or_reply("Koin Itu Mendarat Di: **Ekor**.\nKamu Benar.")
elif input_str == "Kepala":
- await event.edit(
+ await edit_or_reply(
"Koin Itu Mendarat Di: **Ekor**.\nKamu Salah, Coba Lagi..."
)
else:
- await event.edit("Koin Itu Mendarat Di: **Ekor**.")
+ await edit_or_reply("Koin Itu Mendarat Di: **Ekor**.")
-@bot.on(geez_cmd(pattern=r"slap(?: |$)(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"slap(?: |$)(.*)", outgoing=True))
async def _(event):
"""slaps a user, or get slapped if not a reply."""
replied_user = await get_user_from_event(event)
@@ -936,10 +936,10 @@ async def _(event):
caption = await slap(replied_user, event)
try:
- await event.edit(caption)
+ await edit_or_reply(caption)
except BaseException:
- await event.edit(
+ await edit_or_reply(
"`Tidak bisa slap orang ini, perlu mengambil beberapa meteor dan batu!`"
)
@@ -978,7 +978,7 @@ async def slap(replied_user, event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"tt(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"tt(?: |$)(.*)"))
async def _(e):
await e.edit("`Mencari Gambar tt, Dosa ditanggung sendiri...`")
await sleep(3)
@@ -991,7 +991,7 @@ async def _(e):
await e.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"pantat(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"pantat(?: |$)(.*)"))
async def _(e):
await e.edit("`Mencari Gambar Pantat, Dosa ditanggung sendiri...`")
await sleep(3)
@@ -1004,7 +1004,7 @@ async def _(e):
await e.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"(yes|no|maybe|decide)$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"(yes|no|maybe|decide)$"))
async def _(event):
decision = event.pattern_match.group(1).lower()
message_id = event.reply_to_msg_id or None
@@ -1018,7 +1018,7 @@ async def _(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r";_;$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r";_;$"))
async def _(idk):
t = ";_;"
for _ in range(10):
@@ -1026,25 +1026,25 @@ async def _(idk):
await idk.edit(t)
-@bot.on(geez_cmd(outgoing=True, pattern=r"fp$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"fp$"))
async def _(palm):
"""Facepalm 🤦♂"""
await palm.edit("🤦♂")
-@bot.on(geez_cmd(outgoing=True, pattern=r"cry$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"cry$"))
async def _(e):
"""y u du dis, i cry everytime !!"""
await e.edit(choice(CRI))
-@bot.on(geez_cmd(outgoing=True, pattern=r"insult$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"insult$"))
async def _(e):
"""I make you cry !!"""
await e.edit(choice(INSULT_STRINGS))
-@bot.on(geez_cmd(outgoing=True, pattern=r"cp(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"cp(?: |$)(.*)"))
async def _(cp_e):
"""Copypasta the famous meme"""
textx = await cp_e.get_reply_message()
@@ -1076,7 +1076,7 @@ async def _(cp_e):
await cp_e.edit(reply_text)
-@bot.on(geez_cmd(outgoing=True, pattern=r"vapor(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"vapor(?: |$)(.*)"))
async def _(vpr):
"""Vaporize everything!"""
reply_text = []
@@ -1100,7 +1100,7 @@ async def _(vpr):
await vpr.edit("".join(reply_text))
-@bot.on(geez_cmd(outgoing=True, pattern=r"str(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"str(?: |$)(.*)"))
async def _(stret):
"""Stretch it."""
textx = await stret.get_reply_message()
@@ -1118,7 +1118,7 @@ async def _(stret):
await stret.edit(reply_text)
-@bot.on(geez_cmd(outgoing=True, pattern=r"zal(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"zal(?: |$)(.*)"))
async def _(zgfy):
"""Invoke the feeling of chaos."""
reply_text = []
@@ -1153,13 +1153,13 @@ async def _(zgfy):
await zgfy.edit("".join(reply_text))
-@bot.on(geez_cmd(outgoing=True, pattern=r"hi$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"hi$"))
async def _(hello):
"""Greet everyone!"""
await hello.edit(choice(HELLOSTR))
-@bot.on(geez_cmd(outgoing=True, pattern=r"owo(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"owo(?: |$)(.*)"))
async def _(owo):
"""UwU"""
textx = await owo.get_reply_message()
@@ -1181,37 +1181,37 @@ async def _(owo):
await owo.edit(reply_text)
-@bot.on(geez_cmd(outgoing=True, pattern=r"react$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"react$"))
async def _(react):
"""Make your userbot react to everything."""
await react.edit(choice(FACEREACTS))
-@bot.on(geez_cmd(outgoing=True, pattern=r"shg$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"shg$"))
async def _(shg):
r"""¯\_(ツ)_/¯"""
await shg.edit(choice(SHGS))
-@bot.on(geez_cmd(outgoing=True, pattern=r"chase$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"chase$"))
async def _(chase):
"""Lari bro lari, aku akan segera menangkapmu !!"""
await chase.edit(choice(CHASE_STR))
-@bot.on(geez_cmd(outgoing=True, pattern=r"run$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"run$"))
async def _(run):
"""Lari, lari, LARIII!"""
await run.edit(choice(RUNS_STR))
-@bot.on(geez_cmd(outgoing=True, pattern=r"metoo$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"metoo$"))
async def _(hahayes):
"""Haha yes"""
await hahayes.edit(choice(METOOSTR))
-@bot.on(geez_cmd(outgoing=True, pattern=r"oem$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"oem$"))
async def _(e):
t = "Oem"
for _ in range(16):
@@ -1219,7 +1219,7 @@ async def _(e):
await e.edit(t)
-@bot.on(geez_cmd(outgoing=True, pattern=r"Oem$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"Oem$"))
async def _(e):
t = "Oem"
for _ in range(16):
@@ -1227,12 +1227,12 @@ async def _(e):
await e.edit(t)
-@bot.on(geez_cmd(outgoing=True, pattern=r"10iq$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"10iq$"))
async def _(e):
await e.edit("♿")
-@bot.on(geez_cmd(outgoing=True, pattern=r"fuck$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"fuck$"))
async def _(e):
await e.edit(". /¯ )")
await e.edit(". /¯ )\n /¯ /")
@@ -1262,7 +1262,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"moon$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"moon$"))
async def _(moone):
deq = deque(list("🌗🌘🌑🌒🌓🌔🌕🌖"))
try:
@@ -1274,175 +1274,175 @@ async def _(moone):
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"bunga$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bunga$"))
async def _(event):
deq = deque(list("🌼🌻🌺🌹🌸🌷"))
try:
for _ in range(35):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"waktu$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"waktu$"))
async def _(event):
deq = deque(list("🎑🌄🌅🌇🌆🌃🌌"))
try:
for _ in range(100):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"buah$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"buah$"))
async def _(event):
deq = deque(list("🍉🍓🍇🍎🍍🍐🍌"))
try:
for _ in range(35):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"clock$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"clock$"))
async def _(event):
deq = deque(list("🕙🕘🕗🕖🕕🕔🕓🕒🕑🕐🕛"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"rain$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rain$"))
async def _(event):
deq = deque(list("☀️🌤⛅️🌥☁️🌧⛈"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"boxes$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"boxes$"))
async def _(event):
deq = deque(list("🟥🟧🟨🟩🟦🟪🟫⬛⬜"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"hmm$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"hmm$"))
async def _(event):
deq = deque(list("🤔🧐🤔🧐🤔🧐"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"haha$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"haha$"))
async def _(event):
deq = deque(list("😂🤣😂🤣😂🤣"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"operations$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"operations$"))
async def _(event):
deq = deque(list("!@#$%^&*()_+="))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"love$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"love$"))
async def _(event):
deq = deque(list("❤️🧡💛💚💙💜🖤💕💞💓💗💖💘💝"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"earth$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"earth$"))
async def _(event):
deq = deque(list("🌏🌍🌎🌎🌍🌏🌍🌎"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"hati$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"hati$"))
async def _(event):
deq = deque(list("🖤💜💙💚💛🧡❤️🤍"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=".monyet$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=".monyet$"))
async def _(event):
deq = deque(list("🙈🙉🙈🙉🙈🙉🙈🙉"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=".emo$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=".emo$"))
async def _(event):
deq = deque(list("🙂😁😄😃😂🤣😭🐵🙊🙉🙈"))
try:
for _ in range(32):
await sleep(0.1)
- await event.edit("".join(deq))
+ await edit_or_reply("".join(deq))
deq.rotate(1)
except BaseException:
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"mock(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"mock(?: |$)(.*)"))
async def _(mock):
"""Do it and find the real fun."""
reply_text = []
@@ -1465,7 +1465,7 @@ async def _(mock):
await mock.edit("".join(reply_text))
-@bot.on(geez_cmd(outgoing=True, pattern=r"weeb(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"weeb(?: |$)(.*)"))
async def _(e):
args = e.pattern_match.group(1)
if not args:
@@ -1482,7 +1482,7 @@ async def _(e):
await e.edit(string)
-@bot.on(geez_cmd(outgoing=True, pattern=r"clap(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"clap(?: |$)(.*)"))
async def _(memereview):
"""Praise people!"""
textx = await memereview.get_reply_message()
@@ -1499,7 +1499,7 @@ async def _(memereview):
await memereview.edit(reply_text)
-@bot.on(geez_cmd(outgoing=True, pattern=r"teksbiru$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"teksbiru$"))
async def _(bt_e):
"""Believe me, you will find this useful."""
if await bt_e.get_reply_message() and bt_e.is_group:
@@ -1509,7 +1509,7 @@ async def _(bt_e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"f (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"f (.*)"))
async def _(event):
paytext = event.pattern_match.group(1)
pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format(
@@ -1526,10 +1526,10 @@ async def _(event):
paytext * 2,
paytext * 2,
)
- await event.edit(pay)
+ await edit_or_reply(pay)
-@bot.on(geez_cmd(outgoing=True, pattern=r"lfy (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"lfy (.*)"))
async def _(lmgtfy_q):
textx = await lmgtfy_q.get_reply_message()
qry = lmgtfy_q.pattern_match.group(1)
@@ -1547,7 +1547,7 @@ async def _(lmgtfy_q):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"-_-$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"-_-$"))
async def _(sigh):
"""Ok..."""
okay = "-_-"
@@ -1556,7 +1556,7 @@ async def _(sigh):
await sigh.edit(okay)
-@bot.on(geez_cmd(outgoing=True, pattern=r"sayhi$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"sayhi$"))
async def _(e):
await e.edit(
"\n💰💰💰💰💰💰💰💰💰💰💰💰"
@@ -1571,7 +1571,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"scam(?:\s|$)([\s\S]*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"scam(?:\s|$)([\s\S]*)"))
async def _(event):
options = [
"typing",
@@ -1613,7 +1613,7 @@ async def _(event):
return
-@bot.on(geez_cmd(pattern=r"type(?: |$)(.*)", outgoing=True))
+@geez_cmd(geez_cmd(pattern=r"type(?: |$)(.*)", outgoing=True))
async def _(typew):
"""Just a small command to make your keyboard become a typewriter!"""
textx = await typew.get_reply_message()
@@ -1638,7 +1638,7 @@ async def _(typew):
await sleep(sleep_time)
-@bot.on(geez_cmd(outgoing=True, pattern=r"f (.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"f (.*)"))
async def _(event):
paytext = event.pattern_match.group(1)
pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format(
@@ -1655,10 +1655,10 @@ async def _(event):
paytext * 2,
paytext * 2,
)
- await event.edit(pay)
+ await edit_or_reply(pay)
-@bot.on(geez_cmd(outgoing=True, pattern=r"fail$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"fail$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1669,7 +1669,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"lol$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"lol$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1680,7 +1680,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"rock$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"rock$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1694,7 +1694,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"lool$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"lool$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1704,7 +1704,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"stfu$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"stfu$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1720,7 +1720,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"gtfo$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gtfo$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1736,7 +1736,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"nih$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"nih$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1750,7 +1750,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"fag$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"fag$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1764,25 +1764,25 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"tai$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"tai$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("\n{\\__/}" "\n(●_●)" "\n( >💩 Mau Tai Ku?")
-@bot.on(geez_cmd(outgoing=True, pattern=r"paw$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"paw$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("`(=ↀωↀ=)")
-@bot.on(geez_cmd(outgoing=True, pattern=r"tf$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"tf$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("(̿▀̿ ̿Ĺ̯̿̿▀̿ ̿)̄ ")
-@bot.on(geez_cmd(outgoing=True, pattern=r"gey$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gey$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1793,7 +1793,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"gay$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"gay$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1804,7 +1804,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"bot$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"bot$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1813,7 +1813,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"hey$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"hey$"))
async def hey(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1823,7 +1823,7 @@ async def hey(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"nou$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"nou$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit(
@@ -1834,7 +1834,7 @@ async def _(e):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"iwi(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"iwi(?: |$)(.*)"))
async def _(siwis):
"""IwI"""
textx = await siwis.get_reply_message()
@@ -1854,7 +1854,7 @@ async def _(siwis):
await siwis.edit(reply_text)
-@bot.on(geez_cmd(outgoing=True, pattern=r"koc$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"koc$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("8✊===D")
@@ -1889,7 +1889,7 @@ async def _(e):
await e.edit("😭😭😭😭")
-@bot.on(geez_cmd(outgoing=True, pattern=".gas$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=".gas$"))
async def _(e):
if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"):
await e.edit("___________________🚑")
@@ -1904,13 +1904,13 @@ async def _(e):
await e.edit(choice(FACEREACTS))
-@bot.on(geez_cmd(outgoing=True, pattern=r"shg$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"shg$"))
async def _(shg):
r"""¯\_(ツ)_/¯"""
await shg.edit(choice(SHGS))
-@bot.on(geez_cmd(outgoing=True, pattern=r"(?:penis|dick)\s?(.)?"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"(?:penis|dick)\s?(.)?"))
async def _(e):
emoji = e.pattern_match.group(1)
titid = GAMBAR_TITIT
@@ -1919,7 +1919,7 @@ async def _(e):
await e.edit(titid)
-@bot.on(geez_cmd(outgoing=True, pattern=r"(?:kontol)\s?(.)?"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"(?:kontol)\s?(.)?"))
async def _(e):
emoji = e.pattern_match.group(1)
kontl = GAMBAR_KONTL
@@ -1928,7 +1928,7 @@ async def _(e):
await e.edit(kontl)
-@bot.on(geez_cmd(outgoing=True, pattern=r"skull$"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"skull$"))
async def _(e):
emoji = e.pattern_match.group(1)
tengkorak = GAMBAR_TENGKORAK
diff --git a/userbot/modules/memify.py b/userbot/modules/memify.py
index 7a647f26..6218600f 100644
--- a/userbot/modules/memify.py
+++ b/userbot/modules/memify.py
@@ -10,22 +10,22 @@
from PIL import Image, ImageDraw, ImageFont
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY
+from userbot.utils import edit_or_reply, geez_cmd
from userbot.utils import runcmd, take_screen_shot
-@bot.on(geez_cmd(outgoing=True, pattern=r"mmf (.*)"))
+@geez_cmd(pattern="mmf$")
async def memify(event):
reply_msg = await event.get_reply_message()
input_str = event.pattern_match.group(1)
- await event.edit("**Sedang Memperoses...**")
+ await edit_or_reply("**Sedang Memperoses...**")
if not reply_msg:
- return await event.edit("**Balas ke pesan yang berisi media!**")
+ return await edit_or_reply("**Balas ke pesan yang berisi media!**")
if not reply_msg.media:
- return await event.edit("**Balas ke image/sticker/gif/video!**")
+ return await edit_or_reply("**Balas ke image/sticker/gif/video!**")
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
@@ -34,29 +34,29 @@ async def memify(event):
input_file = os.path.join(TEMP_DOWNLOAD_DIRECTORY, os.path.basename(input_file))
if input_file.endswith(".tgs"):
- await event.edit("**Mengekstrak Frame pertama...**")
+ await edit_or_reply("**Mengekstrak Frame pertama...**")
converted_file = os.path.join(TEMP_DOWNLOAD_DIRECTORY, "meme.webp")
cmd = f"lottie_convert.py --frame 0 {input_file} {converted_file}"
await runcmd(cmd)
os.remove(input_file)
if not os.path.lexists(converted_file):
- return await event.edit("**Tidak dapat menguraikan stiker animasi ini.**")
+ return await edit_or_reply("**Tidak dapat menguraikan stiker animasi ini.**")
input_file = converted_file
elif input_file.endswith(".mp4"):
- await event.edit("**Mengekstrak Frame pertama...**")
+ await edit_or_reply("**Mengekstrak Frame pertama...**")
converted_file = os.path.join(TEMP_DOWNLOAD_DIRECTORY, "meme.png")
await take_screen_shot(input_file, 0, converted_file)
os.remove(input_file)
if not os.path.lexists(converted_file):
- return await event.edit("**Tidak Dapat Mengurai Video ini.**")
+ return await edit_or_reply("**Tidak Dapat Mengurai Video ini.**")
input_file = converted_file
- await event.edit("**Menambahkan Teks...**")
+ await edit_or_reply("**Menambahkan Teks...**")
try:
final_image = await add_text_img(input_file, input_str)
except Exception as e:
- return await event.edit(f"**Terjadi kesalahan:**\n`{e}`")
+ return await edit_or_reply(f"**Terjadi kesalahan:**\n`{e}`")
await event.client.send_file(
entity=event.chat_id, file=final_image, reply_to=reply_msg
)
diff --git a/userbot/modules/mentions.py b/userbot/modules/mentions.py
index 1797a08d..c0464b54 100644
--- a/userbot/modules/mentions.py
+++ b/userbot/modules/mentions.py
@@ -46,7 +46,7 @@ async def mention(event):
rep = tag.format(rep)
newstr = re.sub(re.escape(match.group(0)), rep, newstr)
if newstr != event.text:
- await event.edit(newstr, parse_mode="html")
+ await edit_or_reply(newstr, parse_mode="html")
CMD_HELP.update(
diff --git a/userbot/modules/nekos_img.py b/userbot/modules/nekos_img.py
index a4942307..4f5963e2 100644
--- a/userbot/modules/nekos_img.py
+++ b/userbot/modules/nekos_img.py
@@ -6,8 +6,8 @@
import nekos
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP
+from userbot.utils import edit_or_reply, geez_cmd
arguments = [
"feet",
@@ -76,14 +76,14 @@
]
-@bot.on(geez_cmd(outgoing=True, pattern=r"nekos(?: |$)(.*)"))
+@geez_cmd(pattern="nekos$")
async def nekos_img(event):
args = event.pattern_match.group(1)
if not args or args not in arguments:
- return await event.edit(
+ return await edit_or_reply(
"ketik `.help nekos` untuk melihat argumen yang tersedia."
)
- await event.edit("`Fetching from nekos...`")
+ await edit_or_reply("`Fetching from nekos...`")
pic = nekos.img(args)
await event.client.send_file(
event.chat_id,
diff --git a/userbot/modules/nhentai.py b/userbot/modules/nhentai.py
index 34965ba4..345633fb 100644
--- a/userbot/modules/nhentai.py
+++ b/userbot/modules/nhentai.py
@@ -10,16 +10,16 @@
from natsort import natsorted
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
-from userbot.utils import post_to_telegraph
+from userbot import CMD_HELP
+from userbot.utils import post_to_telegraph
+from userbot.utils import edit_or_reply, geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"nhentai(?: |$)(.*)"))
+@geez_cmd(pattern="nhentai$")
async def _(event):
if event.fwd_from:
return
- await event.edit("`Searching for doujin...`")
+ await edit_or_reply("`Searching for doujin...`")
input_str = event.pattern_match.group(1)
code = input_str
if "nhentai" in input_str:
@@ -32,8 +32,8 @@ async def _(event):
doujin = Hentai(code)
except BaseException as n_e:
if "404" in str(n_e):
- return await event.edit(f"No doujin found for `{code}`")
- return await event.edit(f"**ERROR :** `{n_e}`")
+ return await edit_or_reply(f"No doujin found for `{code}`")
+ return await edit_or_reply(f"**ERROR :** `{n_e}`")
msg = ""
imgs = "".join(f"
" for url in doujin.image_urls)
imgs = f" {imgs}"
@@ -89,7 +89,7 @@ async def _(event):
msg += "\n" + " ".join(natsorted(categories))
msg += f"\n**Pages :**\n{doujin.num_pages}"
- await event.edit(msg, link_preview=True)
+ await edit_or_reply(msg, link_preview=True)
CMD_HELP.update(
diff --git a/userbot/modules/notes.py b/userbot/modules/notes.py
index b1337120..481e80f0 100644
--- a/userbot/modules/notes.py
+++ b/userbot/modules/notes.py
@@ -9,11 +9,11 @@
from userbot import BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd, register
+from userbot import CMD_HELP
+from userbot.events import register
+from userbot.utils import geez_cmd
-
-@bot.on(geez_cmd(outgoing=True, pattern=r"notes$"))
+@geez_cmd(pattern="notes$")
async def notes_active(svd):
"""For .notes command, list all of the notes saved in a chat."""
try:
@@ -29,7 +29,7 @@ async def notes_active(svd):
await svd.edit(message)
-@bot.on(geez_cmd(outgoing=True, pattern=r"clear (\w*)"))
+@geez_cmd(pattern="clear$)")
async def remove_notes(clr):
"""For .clear command, clear note with the given name."""
try:
@@ -44,7 +44,7 @@ async def remove_notes(clr):
return await clr.edit("**Berhasil Menghapus Catatan:** `{}`".format(notename))
-@bot.on(geez_cmd(outgoing=True, pattern=r"save (\w*)"))
+@geez_cmd(pattern="save$")
async def add_note(fltr):
"""For .save command, saves notes in a chat."""
try:
@@ -112,7 +112,7 @@ async def incom_note(getnt):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"rmbotnotes (.*)"))
+@geez_cmd(pattern="rmbotnotes$")
async def kick_marie_notes(kick):
""" For .rmbotnotes command, allows you to kick all \
Marie(or her clones) notes from a chat. """
diff --git a/userbot/modules/nsfwdetect.py b/userbot/modules/nsfwdetect.py
index a05215c6..22bdfb43 100644
--- a/userbot/modules/nsfwdetect.py
+++ b/userbot/modules/nsfwdetect.py
@@ -7,12 +7,12 @@
import requests
-from userbot import CMD_HELP, DEEP_AI, bot
-from userbot.events import geez_cmd
-from userbot.utils import edit_delete, edit_or_reply
+from userbot import CMD_HELP, DEEP_AI
+from userbot.utils import edit_delete, edit_or_reply, geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"detect$"))
+
+@geez_cmd(pattern="detect$")
async def detect(event):
if DEEP_AI is None:
return await edit_delete(
diff --git a/userbot/modules/offline.py b/userbot/modules/offline.py
index bd4f1bb0..1496d6d0 100644
--- a/userbot/modules/offline.py
+++ b/userbot/modules/offline.py
@@ -12,7 +12,8 @@
from telethon.tl.functions.account import UpdateProfileRequest
from userbot import AFKREASON, BOTLOG_CHATID, PM_AUTO_BAN, bot, owner
-from userbot.events import geez_cmd, register
+from userbot.events import register
+from userbot.utils import geez_cmd
# ========================= CONSTANTS ============================
AFKSTR = [
@@ -28,7 +29,7 @@
# =================================================================
-@bot.on(geez_cmd(outgoing=True, pattern=r"off(?: |$)(.*)"))
+@geez_cmd(pattern="off$")
async def set_afk(afk_e):
"""For .afk command, allows you to inform people that you are afk when they message you"""
string = afk_e.pattern_match.group(1)
diff --git a/userbot/modules/oi.py b/userbot/modules/oi.py
index e294355f..be388619 100644
--- a/userbot/modules/oi.py
+++ b/userbot/modules/oi.py
@@ -13,6 +13,8 @@ async def _(event):
await xx.edit("**Aku Sayang Kamu**")
sleep(1)
await xx.edit("**I LOVE YOU 💞**")
+ sleep(1)
+ await xx.edit("**PI BOONG**")
# Create by myself @localheart
diff --git a/userbot/modules/other.py b/userbot/modules/other.py
index e5e844da..35b890c7 100644
--- a/userbot/modules/other.py
+++ b/userbot/modules/other.py
@@ -138,7 +138,7 @@ async def _(event):
k = await event.get_reply_message()
if k:
a = await event.client.get_messages(event.chat_id, 0, from_user=k.sender_id)
- return await event.edit(
+ return await edit_or_reply(
f"**Total ada** `{a.total}` **Chat Yang dikirim Oleh** {u} **di Grup Chat ini**"
)
u = event.pattern_match.group(1)
diff --git a/userbot/modules/pics.py b/userbot/modules/pics.py
index e54f5cf9..c40fe2e0 100644
--- a/userbot/modules/pics.py
+++ b/userbot/modules/pics.py
@@ -16,11 +16,11 @@
from telethon.tl.functions.messages import SendMediaRequest
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP
+from userbot.utils import geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"pic(?: |$)(.*)"))
+@geez_cmd(pattern="pic(?: |$)(.*)")
async def on_file_to_photo(pics):
await pics.edit("`Processing...`")
await sleep(1.5)
diff --git a/userbot/modules/pmbot.py b/userbot/modules/pmbot.py
index 897a82af..13c6a010 100644
--- a/userbot/modules/pmbot.py
+++ b/userbot/modules/pmbot.py
@@ -295,7 +295,7 @@ async def setpmbot(event):
try:
import userbot.modules.sql_helper.globals as sql
except AttributeError:
- await event.edit("**Running on Non-SQL mode!**")
+ await edit_or_reply("**Running on Non-SQL mode!**")
return
xnxx = await edit_or_reply(event, "`Processing...`")
conf = event.pattern_match.group(1)
diff --git a/userbot/modules/pmpermit.py b/userbot/modules/pmpermit.py
index 6b5c54a6..16aa26e5 100644
--- a/userbot/modules/pmpermit.py
+++ b/userbot/modules/pmpermit.py
@@ -12,9 +12,9 @@
from userbot import BOTLOG_CHATID
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, COUNT_PM, LASTMSG, LOGS, PM_AUTO_BAN, PM_LIMIT, bot
+from userbot import CMD_HELP, COUNT_PM, LASTMSG, LOGS, PM_AUTO_BAN, PM_LIMIT
from userbot.events import geez_cmd, register
-from userbot.utils import edit_delete, edit_or_reply
+from userbot.utils import edit_delete, edit_or_reply, geez_cmd
DEF_UNAPPROVED_MSG = (
"╭┈──────────────────────\n"
@@ -159,7 +159,7 @@ async def auto_accept(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"notifoff$"))
+@geez_cmd(pattern="notifoff$")
async def notifoff(noff_event):
"""For .notifoff command, stop getting notifications from unapproved PMs."""
try:
@@ -172,7 +172,7 @@ async def notifoff(noff_event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"notifon$"))
+@geez_cmd(pattern="notifon$")
async def notifon(non_event):
"""For .notifoff command, get notifications from unapproved PMs."""
try:
@@ -185,7 +185,7 @@ async def notifon(non_event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"(?:setuju|ok)\s?(.)?"))
+@geez_cmd(pattern="(?:setuju|ok)\s?(.)?")
async def approvepm(apprvpm):
"""For .ok command, give someone the permissions to PM you."""
try:
@@ -248,7 +248,7 @@ async def approvepm(apprvpm):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"(?:tolak|nopm)\s?(.)?"))
+@geez_cmd(pattern="(?:tolak|nopm)\s?(.)?")
async def disapprovepm(disapprvpm):
try:
from userbot.modules.sql_helper.pm_permit_sql import dissprove
@@ -302,7 +302,7 @@ async def disapprovepm(disapprvpm):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"block$"))
+@geez_cmd(pattern="block$")
async def blockpm(block):
"""For .block command, block people from PMing you!"""
if block.reply_to_msg_id:
@@ -328,7 +328,7 @@ async def blockpm(block):
pass
-@bot.on(geez_cmd(outgoing=True, pattern=r"unblock$"))
+@geez_cmd(pattern="unblock$")
async def unblockpm(unblock):
"""For .unblock command, let people PMing you again!"""
if unblock.reply_to_msg_id:
@@ -338,7 +338,7 @@ async def unblockpm(unblock):
await unblock.edit("**Anda Sudah Tidak Diblokir Lagi.**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"(set|get|reset) pmpermit(?: |$)(\w*)"))
+@geez_cmd(pattern="(set|get|reset) pmpermit(?: |$)(\w*)")
async def add_pmsg(cust_msg):
"""Set your own Unapproved message"""
if not PM_AUTO_BAN:
diff --git a/userbot/modules/profile.py b/userbot/modules/profile.py
index 67a9b01a..ba1687dd 100644
--- a/userbot/modules/profile.py
+++ b/userbot/modules/profile.py
@@ -28,7 +28,7 @@
from telethon.utils import get_input_location
from userbot import CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, bot
-from userbot.events import geez_cmd
+from userbot.utils import edit_or_reply, geez_cmd
# ====================== CONSTANT ===============================
INVALID_MEDIA = "```Maaf Media Tidak Valid.```"
@@ -44,7 +44,7 @@
# ===============================================================
-@bot.on(geez_cmd(outgoing=True, pattern=r"reserved$"))
+@geez_cmd(pattern="reserved$")
async def mine(event):
"""For .reserved command, get a list of your reserved usernames."""
result = await bot(GetAdminedPublicChannelsRequest())
@@ -53,10 +53,10 @@ async def mine(event):
for channel_obj in result.chats
)
- await event.edit(output_str)
+ await edit_or_reply(output_str)
-@bot.on(geez_cmd(outgoing=True, pattern=r"name"))
+@geez_cmd(pattern="name")
async def update_name(name):
"""For .name command, change your name in Telegram."""
newname = name.text[6:]
@@ -72,7 +72,7 @@ async def update_name(name):
await name.edit(NAME_OK)
-@bot.on(geez_cmd(outgoing=True, pattern=r"setpfp$"))
+@geez_cmd(pattern="setpfp$")
async def set_profilepic(propic):
"""For .profilepic command, change your profile picture in Telegram."""
replymsg = await propic.get_reply_message()
@@ -100,7 +100,7 @@ async def set_profilepic(propic):
await propic.edit(INVALID_MEDIA)
-@bot.on(geez_cmd(outgoing=True, pattern=r"setbio (.*)"))
+@geez_cmd(pattern="setbio$")
async def set_biograph(setbio):
"""For .setbio command, set a new bio for your profile in Telegram."""
newbio = setbio.pattern_match.group(1)
@@ -108,7 +108,7 @@ async def set_biograph(setbio):
await setbio.edit(BIO_SUCCESS)
-@bot.on(geez_cmd(outgoing=True, pattern=r"username (.*)"))
+@geez_cmd(pattern="username$")
async def update_username(username):
"""For .username command, set a new username in Telegram."""
newusername = username.pattern_match.group(1)
@@ -119,7 +119,7 @@ async def update_username(username):
await username.edit(USERNAME_TAKEN)
-@bot.on(geez_cmd(outgoing=True, pattern=r"count$"))
+@geez_cmd(pattern="count$")
async def count(event):
"""For .count command, get profile stats."""
u = 0
@@ -128,7 +128,7 @@ async def count(event):
bc = 0
b = 0
result = ""
- await event.edit("`Sedang Dalam Proses....`")
+ await edit_or_reply("`Sedang Dalam Proses....`")
dialogs = await bot.get_dialogs(limit=None, ignore_migrated=True)
for d in dialogs:
currrent_entity = d.entity
@@ -153,10 +153,10 @@ async def count(event):
result += f"`Channel:`\t**{bc}**\n"
result += f"`Bot:`\t**{b}**"
- await event.edit(result)
+ await edit_or_reply(result)
-@bot.on(geez_cmd(outgoing=True, pattern=r"delpfp"))
+@geez_cmd(pattern="delpfp$")
async def remove_profilepic(delpfp):
"""For .delpfp command, delete your current profile picture in Telegram."""
group = delpfp.text[8:]
@@ -182,10 +182,10 @@ async def remove_profilepic(delpfp):
await delpfp.edit(f"`Berhasil Menghapus {len(input_photos)} Foto Profil.`")
-@bot.on(geez_cmd(pattern=r"info(?: |$)(.*)", outgoing=True))
+@geez_cmd(pattern="info$")
async def who(event):
- await event.edit("`Mengambil Informasi Data User ini...`")
+ await edit_or_reply("`Mengambil Informasi Data User ini...`")
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
@@ -195,7 +195,7 @@ async def who(event):
try:
photo, caption = await fetch_info(replied_user, event)
except AttributeError:
- event.edit("`Saya Tidak Mendapatkan Informasi Pengguna.`")
+ edit_or_reply("`Saya Tidak Mendapatkan Informasi Pengguna.`")
return
message_id_to_reply = event.message.reply_to_msg_id
@@ -219,7 +219,7 @@ async def who(event):
await event.delete()
except TypeError:
- await event.edit(caption, parse_mode="html")
+ await edit_or_reply(caption, parse_mode="html")
async def get_user(event):
@@ -248,7 +248,7 @@ async def get_user(event):
user_object = await event.client.get_entity(user)
replied_user = await event.client(GetFullUserRequest(user_object.id))
except (TypeError, ValueError) as err:
- await event.edit(str(err))
+ await edit_or_reply(str(err))
return None
return replied_user
diff --git a/userbot/modules/punten.py b/userbot/modules/punten.py
index 550e7ce5..fc8d0b15 100644
--- a/userbot/modules/punten.py
+++ b/userbot/modules/punten.py
@@ -1,25 +1,25 @@
from time import sleep
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot import CMD_HELP
+from userbot.utils import edit_or_reply, geez_cmd
-@bot.on(geez_cmd(outgoing=True, pattern=r"sadboy(?: |$)(.*)"))
+@geez_cmd(pattern="sadboy$")
async def _(event):
- await event.edit("`Pertama-tama kamu cantik`")
+ await edit_or_reply("`Pertama-tama kamu cantik`")
sleep(2)
- await event.edit("`Kedua kamu manis`")
+ await edit_or_reply("`Kedua kamu manis`")
sleep(1)
- await event.edit("`Dan yang terakhir adalah kamu bukan jodohku`")
+ await edit_or_reply("`Dan yang terakhir adalah kamu bukan jodohku`")
# Create by myself @localheart
-@bot.on(geez_cmd(outgoing=True, pattern=r"punten(?: |$)(.*)"))
+@geez_cmd(pattern="punten$")
async def _(event):
- await event.edit(
+ await edit_or_reply(
"`\n┻┳|―-∩`"
"`\n┳┻| ヽ`"
"`\n┻┳| ● |`"
@@ -31,9 +31,9 @@ async def _(event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"pantau(?: |$)(.*)"))
+@geez_cmd(pattern="pantau$")
async def _(event):
- await event.edit(
+ await edit_or_reply(
"`\n┻┳|―-∩`"
"`\n┳┻| ヽ`"
"`\n┻┳| ● |`"
diff --git a/userbot/modules/rastick.py b/userbot/modules/rastick.py
index 385156d5..2ee06552 100644
--- a/userbot/modules/rastick.py
+++ b/userbot/modules/rastick.py
@@ -7,7 +7,7 @@
from userbot.utils import deEmojify
-@bot.on(geez_cmd(outgoing=True, pattern=r"rst(?: |$)(.*)"))
+@geez_cmd(pattern="rst(?: |$)(.*)")
async def rastick(animu):
text = animu.pattern_match.group(1)
if not text:
diff --git a/userbot/modules/reverse.py b/userbot/modules/reverse.py
index 638fab8d..70c5dedc 100644
--- a/userbot/modules/reverse.py
+++ b/userbot/modules/reverse.py
@@ -18,7 +18,7 @@
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot.utils import geez_cmd
from userbot.utils import googleimagesdownload
opener = urllib.request.build_opener()
@@ -30,7 +30,7 @@
opener.addheaders = [("User-agent", useragent)]
-@bot.on(geez_cmd(outgoing=True, pattern=r"reverse(?: |$)(\d*)"))
+@geez_cmd(pattern="reverse(?: |$)(\d*)")
async def okgoogle(img):
"""For .reverse command, Google search images and stickers."""
if os.path.isfile("okgoogle.png"):
diff --git a/userbot/modules/scrapers.py b/userbot/modules/scrapers.py
index aa86c576..b574023b 100644
--- a/userbot/modules/scrapers.py
+++ b/userbot/modules/scrapers.py
@@ -63,12 +63,12 @@
TEMP_DOWNLOAD_DIRECTORY,
bot,
)
-from userbot.events import geez_cmd
+
from userbot.modules.upload_download import get_video_thumb
from userbot.utils import (
chrome,
edit_delete,
- edit_or_reply,
+ edit_or_reply, geez_cmd,
googleimagesdownload,
options,
progress,
@@ -97,10 +97,10 @@ async def ocr_space_file(
return r.json()
-@bot.on(geez_cmd(outgoing=True, pattern=r"img (.*)"))
+@geez_cmd(pattern="img$")
async def img_sampler(event):
"""For .img command, search and return images matching the query."""
- await event.edit("`Sedang Mencari Gambar Yang Anda Cari...`")
+ await edit_or_reply("`Sedang Mencari Gambar Yang Anda Cari...`")
query = event.pattern_match.group(1)
lim = findall(r"lim=\d+", query)
try:
@@ -129,7 +129,7 @@ async def img_sampler(event):
await event.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"currency ([\d\.]+) ([a-zA-Z]+) ([a-zA-Z]+)"))
+@geez_cmd(pattern="currency ([\d\.]+) ([a-zA-Z]+) ([a-zA-Z]+)")
async def moni(event):
c_from_val = float(event.pattern_match.group(1))
c_from = (event.pattern_match.group(2)).upper()
@@ -140,18 +140,18 @@ async def moni(event):
params={"from": c_from, "to": c_to},
).json()
except Exception:
- await event.edit("**Error: API is down.**")
+ await edit_or_reply("**Error: API is down.**")
return
if "error" in response:
- await event.edit(
+ await edit_or_reply(
"**sepertinya ini mata uang asing, yang tidak dapat saya konversi sekarang.**"
)
return
c_to_val = round(c_from_val * response["rates"][c_to], 2)
- await event.edit(f"**{c_from_val} {c_from} = {c_to_val} {c_to}**")
+ await edit_or_reply(f"**{c_from_val} {c_from} = {c_to_val} {c_to}**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"google ([\s\S]*)"))
+@geez_cmd(pattern="google ([\s\S]*)")
async def gsearch(q_event):
geez = await edit_or_reply(q_event, "`Processing...`")
match = q_event.pattern_match.group(1)
@@ -207,7 +207,7 @@ async def gsearch(q_event):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"wiki (.*)"))
+@geez_cmd(pattern="wiki$")
async def wiki(wiki_q):
"""For .wiki command, fetch content from Wikipedia."""
match = wiki_q.pattern_match.group(1)
@@ -236,25 +236,25 @@ async def wiki(wiki_q):
await wiki_q.edit("**Search:**\n`" + match + "`\n\n**Result:**\n" + result)
-@bot.on(geez_cmd(outgoing=True, pattern=r"ud (.*)"))
+@geez_cmd(pattern="ud$")
async def _(event):
if event.fwd_from:
return
- await event.edit("processing...")
+ await edit_or_reply("processing...")
word = event.pattern_match.group(1)
urban = asyncurban.UrbanDictionary()
try:
mean = await urban.get_word(word)
- await event.edit(
+ await edit_or_reply(
"Text: **{}**\n\nBerarti: **{}**\n\nContoh: __{}__".format(
mean.word, mean.definition, mean.example
)
)
except asyncurban.WordNotFoundError:
- await event.edit("Tidak ada hasil untuk **" + word + "**")
+ await edit_or_reply("Tidak ada hasil untuk **" + word + "**")
-@bot.on(geez_cmd(outgoing=True, pattern=r"tts(?: |$)([\s\S]*)"))
+@geez_cmd(pattern="tts$")
async def text_to_speech(query):
"""For .tts command, a wrapper for Google Text-to-Speech."""
textx = await query.get_reply_message()
@@ -293,7 +293,7 @@ async def text_to_speech(query):
await query.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"tr(?: |$)(.*)"))
+@geez_cmd(pattern="tr$")
async def _(event):
if event.fwd_from:
return
@@ -308,7 +308,7 @@ async def _(event):
elif "|" in input_str:
lan, text = input_str.split("|")
else:
- await event.edit("**.tr ** sambil reply ke pesan")
+ await edit_or_reply("**.tr ** sambil reply ke pesan")
return
text = emoji.demojize(text.strip())
lan = lan.strip()
@@ -320,12 +320,12 @@ async def _(event):
{}""".format(
translated.src, lan, after_tr_text
)
- await event.edit(output_str)
+ await edit_or_reply(output_str)
except Exception as exc:
- await event.edit(str(exc))
+ await edit_or_reply(str(exc))
-@bot.on(geez_cmd(pattern=r"lang (tr|tts) (.*)", outgoing=True))
+@geez_cmd(pattern="lang (tr|tts) (.*)")
async def lang(value):
"""For .lang command, change the default langauge of userbot scrapers."""
util = value.pattern_match.group(1).lower()
@@ -363,7 +363,7 @@ async def lang(value):
)
-@bot.on(geez_cmd(outgoing=True, pattern=r"yt (\d*) *(.*)"))
+@geez_cmd(pattern="yt$")
async def yt_search(video_q):
"""For .yt command, do a YouTube search from Telegram."""
if video_q.pattern_match.group(1) != "":
@@ -403,7 +403,7 @@ async def yt_search(video_q):
await video_q.edit(output, link_preview=False)
-@bot.on(geez_cmd(outgoing=True, pattern=r"yt(audio|video( \d{0,4})?) (.*)"))
+@geez_cmd(pattern="yt(audio|video( \d{0,4})?) (.*)")
async def download_video(v_url):
"""For .yt command, download media from YouTube and many other sites."""
dl_type = v_url.pattern_match.group(1).lower()
@@ -587,7 +587,7 @@ async def download_video(v_url):
await v_url.delete()
-@bot.on(geez_cmd(outgoing=True, pattern=r"rbg(?: |$)(.*)"))
+@geez_cmd(pattern="rbg$")
async def kbg(remob):
"""For .rbg command, Remove Image Background."""
if REM_BG_API_KEY is None:
@@ -675,13 +675,13 @@ async def ReTrieveURL(input_url):
)
-@bot.on(geez_cmd(pattern=r"ocr (.*)", outgoing=True))
+@geez_cmd(pattern="ocr$")
async def ocr(event):
if not OCR_SPACE_API_KEY:
- return await event.edit(
+ return await edit_or_reply(
"`Error: OCR.Space API key is missing! Add it to environment variables or config.env.`"
)
- await event.edit("`Sedang Membaca...`")
+ await edit_or_reply("`Sedang Membaca...`")
if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY):
os.makedirs(TEMP_DOWNLOAD_DIRECTORY)
lang_code = event.pattern_match.group(1)
@@ -692,15 +692,15 @@ async def ocr(event):
try:
ParsedText = test_file["ParsedResults"][0]["ParsedText"]
except BaseException:
- await event.edit(
+ await edit_or_reply(
"`Tidak bisa membacanya.`\n`Saya rasa saya perlu kacamata baru.`"
)
else:
- await event.edit(f"`Inilah yang bisa saya baca darinya:`\n\n{ParsedText}")
+ await edit_or_reply(f"`Inilah yang bisa saya baca darinya:`\n\n{ParsedText}")
os.remove(downloaded_file_name)
-@bot.on(geez_cmd(pattern=r"decode$", outgoing=True))
+@geez_cmd(pattern="decode$")
async def parseqr(qr_e):
"""For .decode command, get QR Code/BarCode content from the replied photo."""
downloaded_file_name = await qr_e.client.download_media(
@@ -735,10 +735,10 @@ async def parseqr(qr_e):
await qr_e.edit(qr_contents)
-@bot.on(geez_cmd(pattern=r"barcode(?: |$)([\s\S]*)", outgoing=True))
+@geez_cmd(pattern="barcode$")
async def bq(event):
"""For .barcode command, genrate a barcode containing the given content."""
- await event.edit("`Processing..`")
+ await edit_or_reply("`Processing..`")
input_str = event.pattern_match.group(1)
message = "SYNTAX: `.barcode `"
reply_msg_id = event.message.id
@@ -757,7 +757,7 @@ async def bq(event):
else:
message = previous_message.message
else:
- return event.edit("SYNTAX: `.barcode `")
+ return edit_or_reply("SYNTAX: `.barcode `")
bar_code_type = "code128"
try:
@@ -766,11 +766,11 @@ async def bq(event):
await event.client.send_file(event.chat_id, filename, reply_to=reply_msg_id)
os.remove(filename)
except Exception as e:
- return await event.edit(str(e))
+ return await edit_or_reply(str(e))
await event.delete()
-@bot.on(geez_cmd(pattern=r"makeqr(?: |$)([\s\S]*)", outgoing=True))
+@geez_cmd(pattern="makeqr(?: |$)([\s\S]*)")
async def make_qr(makeqr):
"""For .makeqr command, make a QR Code containing the given content."""
input_str = makeqr.pattern_match.group(1)
@@ -808,7 +808,7 @@ async def make_qr(makeqr):
await makeqr.delete()
-@bot.on(geez_cmd(pattern=r"ss (.*)", outgoing=True))
+@geez_cmd(pattern="ss (.*)")
async def capture(url):
"""For .ss command, capture a website's screenshot and send the photo."""
await url.edit("`Processing...`")
diff --git a/userbot/modules/sed.py b/userbot/modules/sed.py
index dde4d5ce..817beb9c 100644
--- a/userbot/modules/sed.py
+++ b/userbot/modules/sed.py
@@ -11,7 +11,7 @@
from sre_constants import error as sre_err
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, bot
+from userbot import CMD_HELP
from userbot.events import geez_cmd
DELIMITERS = ("/", ":", "|", "_")
@@ -67,7 +67,7 @@ async def separate_sed(sed_string):
return None
-@bot.on(geez_cmd(outgoing=True, pattern="s"))
+@geez_cmd(pattern="s$")
async def sed(command):
"""For sed command, use sed on Telegram."""
sed_result = await separate_sed(command.text)
diff --git a/userbot/modules/shortlink.py b/userbot/modules/shortlink.py
index c9b88ca3..bac55ab6 100644
--- a/userbot/modules/shortlink.py
+++ b/userbot/modules/shortlink.py
@@ -41,7 +41,7 @@ async def _(event):
url = await conv.get_response()
sponser = await conv.get_response()
await event.client.send_read_acknowledge(conv.chat_id)
- await event.edit(response.text)
+ await edit_or_reply(response.text)
except YouBlockedUserError:
await event.client(UnblockRequest(chat))
return await xx.edit("**Silahkan Unblock @ShortUrlBot dan coba lagi**")
diff --git a/userbot/modules/stats.py b/userbot/modules/stats.py
index 604c7442..ff1c91b6 100644
--- a/userbot/modules/stats.py
+++ b/userbot/modules/stats.py
@@ -16,8 +16,8 @@
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
-from userbot.utils import edit_delete, edit_or_reply
+
+from userbot.utils import edit_delete, edit_or_reply, geez_cmd
# STRINGS
STAT_INDICATION = "`Collecting stats, Please wait....`"
@@ -35,7 +35,7 @@ def inline_mention(user):
return f"[{full_name}](tg://user?id={user.id})"
-@bot.on(geez_cmd(outgoing=True, pattern=r"stats$"))
+@geez_cmd(pattern="stats$")
async def stats(
event: NewMessage.Event,
) -> None:
@@ -109,7 +109,7 @@ async def stats(
await stat.edit(response)
-@bot.on(geez_cmd(outgoing=True, pattern=r"(ustat|deteksi|ustats)(?: |$)(.*)"))
+@geez_cmd(pattern="(ustat|deteksi|ustats)(?: |$)(.*)")
async def _(event):
if event.fwd_from:
return
diff --git a/userbot/modules/tag_all.py b/userbot/modules/tag_all.py
index 47108b56..a3b72845 100644
--- a/userbot/modules/tag_all.py
+++ b/userbot/modules/tag_all.py
@@ -12,7 +12,7 @@
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
-from userbot.events import geez_cmd
+from userbot.utils import geez_cmd
usernexp = re.compile(r"@(\w{3,32})\[(.+?)\]")
nameexp = re.compile(r"\[([\w\S]+)\]\(tg://user\?id=(\d+)\)\[(.+?)\]")
@@ -25,7 +25,7 @@ class FlagContainer:
is_active = False
-@bot.on(geez_cmd(outgoing=True, pattern=r"mention(?: |$)(.*)"))
+@geez_cmd(pattern="mention$")
async def _(event):
if event.fwd_from:
return
@@ -38,7 +38,7 @@ async def _(event):
await bot.send_message(chat, mentions, reply_to=event.message.reply_to_msg_id)
-@bot.on(geez_cmd(outgoing=True, pattern=r"emojitag(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"emojitag(?: |$)(.*)"))
async def _(event):
if event.fwd_from or FlagContainer.is_active:
return
@@ -81,7 +81,7 @@ async def _(event):
FlagContainer.is_active = False
-@bot.on(geez_cmd(outgoing=True, pattern=r"all(?: |$)(.*)"))
+@geez_cmd(geez_cmd(outgoing=True, pattern=r"all(?: |$)(.*)"))
async def _(event):
if event.fwd_from or FlagContainer.is_active:
return
diff --git a/userbot/modules/time_date.py b/userbot/modules/time_date.py
index f5ac8866..b36dc448 100644
--- a/userbot/modules/time_date.py
+++ b/userbot/modules/time_date.py
@@ -13,7 +13,7 @@
from pytz import timezone as tz
from userbot import CMD_HANDLER as cmd
-from userbot import CMD_HELP, COUNTRY, TZ_NUMBER, bot
+from userbot import CMD_HELP, COUNTRY, TZ_NUMBER
from userbot.events import geez_cmd
@@ -42,7 +42,7 @@ async def get_tz(con):
return
-@bot.on(geez_cmd(outgoing=True, pattern=r"time(?: |$)(.*)(?