From be6adcca438232de6bd9849fd7e81e45ab8cf17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Sun, 6 Mar 2022 00:53:19 +0530 Subject: [PATCH 1/7] Update utils.py --- tronx/modules/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tronx/modules/utils.py b/tronx/modules/utils.py index 652f1231..b90f76a6 100644 --- a/tronx/modules/utils.py +++ b/tronx/modules/utils.py @@ -201,7 +201,6 @@ async def tag_all_users(app, m: Message): async for x in app.iter_chat_members(m.chat.id): if x.user.is_bot is False: text += app.MentionHtml(x.user.id, "\u200b") - await m.delete() if reply: await app.send_message(m.chat.id, text, reply_to_message_id=reply.message_id, parse_mode="html") else: From ed44bf7da1d26e119c83e57e03f3b0ca2eb4d10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Sun, 6 Mar 2022 00:59:18 +0530 Subject: [PATCH 2/7] Update tools.py --- tronx/modules/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tronx/modules/tools.py b/tronx/modules/tools.py index 9091de50..4fa891fc 100644 --- a/tronx/modules/tools.py +++ b/tronx/modules/tools.py @@ -68,9 +68,9 @@ async def get_word_links(_, m: Message): return await app.send_edit(m, "Please give some text to search in chat ...") else: - m = await app.send_edit(m, "Finding word in this chat . . .", mono=True) info = await app.get_history(m.chat.id) query = m.text.split(None, 1)[1] + m = await app.send_edit(m, "Finding word in this chat . . .", mono=True) for words in info: if query in words.text: links.append(words.link) From a92d53d567e288fd03fe9095a2cafdf3a4ec5cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Mon, 7 Mar 2022 19:08:55 +0530 Subject: [PATCH 3/7] Update welcome.py --- tronx/modules/welcome.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tronx/modules/welcome.py b/tronx/modules/welcome.py index ebd86d54..8d670ae3 100644 --- a/tronx/modules/welcome.py +++ b/tronx/modules/welcome.py @@ -30,13 +30,14 @@ -@app.on_message(filters.new_chat_members & filters.group & ~filters.chat(IgnoreList)) +@app.on_message(filters.new_chat_members & filters.group & ~filters.chat(IgnoreChat)) async def send_welcome(_, m: Message): chat = app.get_welcome(str(m.chat.id)) if bool(chat) is True: if chat["file_id"] is None: - IgnoreList.append(m.chat.id) # decrease the number of updates per chat - return + if not m.chat.id in IgnoreChat: + IgnoreChat.append(m.chat.id) # decrease the number of updates per chat + return try: file_id = chat["file_id"] if chat["file_id"] else False From 1a628d4b0407d86e392657268118848fa93a5bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Mon, 7 Mar 2022 19:14:13 +0530 Subject: [PATCH 4/7] Update welcome.py --- tronx/modules/welcome.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tronx/modules/welcome.py b/tronx/modules/welcome.py index 8d670ae3..09f46bcd 100644 --- a/tronx/modules/welcome.py +++ b/tronx/modules/welcome.py @@ -42,10 +42,10 @@ async def send_welcome(_, m: Message): try: file_id = chat["file_id"] if chat["file_id"] else False caption = chat["caption"] if chat["caption"] else False - if file_id and not file_id.startswith("#"): + if file_id and not file_id.startswith("#"): # as a text return await app.send_message(m.chat.id, f"{file_id}", reply_to_message_id=m.message_id) - elif file_id and file_id.startswith("#"): + elif file_id and file_id.startswith("#"): # as a file id file_id = file_id.replace("#", "") if caption: @@ -69,7 +69,9 @@ async def send_welcome(_, m: Message): @app.on_message(gen(["setwelcome", "setwc"], allow = ["sudo", "channel"])) async def save_welcome(_, m: Message): - await app.private(m) + if await app.private(m) + return + await app.send_edit(m, "Setting this media as a welcome message . . .", mono=True) reply = m.reply_to_message if reply: @@ -85,7 +87,7 @@ async def save_welcome(_, m: Message): app.set_welcome(str(m.chat.id), "#" + file_id) await app.send_edit(m, "Added this media to welcome message . . .", delme=2, mono=True) elif bool(reply.media) is False: - app.set_welcome(str(m.chat.id), reply.text) + app.set_welcome(str(m.chat.id), reply.text.markdown) await app.send_edit(m, "Added this text to welcome message . . .", delme=2, mono=True) except Exception as e: await app.error(m, e) @@ -98,7 +100,9 @@ async def save_welcome(_, m: Message): @app.on_message(gen(["delwelcome", "delwc"], allow = ["sudo", "channel"])) async def delete_welcome(_, m: Message): - await app.private(m) + if await app.private(m) + return + try: await app.send_edit(m, "Checking welcome message for this group . . .", mono=True) app.del_welcome(str(m.chat.id)) @@ -111,7 +115,9 @@ async def delete_welcome(_, m: Message): @app.on_message(gen(["getwelcome", "getwc"], allow = ["sudo", "channel"])) async def delete_welcome(_, m: Message): - await app.private(m) + if await app.private(m) + return + try: await app.send_edit(m, "Getting welcome message of this group . . .") data = app.get_welcome(str(m.chat.id)) From 1deb454b0e9f493e73584b812f12edd24798fdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Mon, 7 Mar 2022 20:38:11 +0530 Subject: [PATCH 5/7] Update pastebin.py changing online pasting url to hastebin.com --- tronx/modules/pastebin.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tronx/modules/pastebin.py b/tronx/modules/pastebin.py index 321dbc23..95cfa610 100644 --- a/tronx/modules/pastebin.py +++ b/tronx/modules/pastebin.py @@ -28,28 +28,27 @@ @app.on_message(gen(["paste", "bin"], allow = ["sudo"])) async def paster(_, m: Message): reply = m.reply_to_message - m = await app.send_edit(m, "`Pasting to nekobin ...`") - if reply: - text = reply.text + if reply and reply.text or reply.caption: + text = reply.text or reply.caption elif not reply and app.long(m) > 1: text = m.text.split(None, 1)[1] - else: - return await app.send_edit(m, "Please reply to a message or give some text after command.", delme=2) + elif not reply and app.long(m) == 1: + return await app.send_edit(m, "Please reply to a message or give some text after command.", mono=True, delme=4) try: async with aiohttp.ClientSession() as session: async with session.post( - "https://nekobin.com/api/documents", json={"content": text}, timeout=3 + "https://www.toptal.com/developers/hastebin/documents", data=text.encode("utf-8"), timeout=3 ) as response: - key = (await response.json())["result"]["key"] + key = (await response.json())["key"] except Exception as e: - return await app.send_edit(m, "Pasting failed, Try again . . .", delme=2, mono=True) - print(e) + await app.error(m, e) + return await app.send_edit(m, "Pasting failed, Try again later . . .", delme=4, mono=True) else: - url = f"https://nekobin.com/{key}" - reply_text = f"**Nekobin** : [Here]({url})" + url = f"https://hastebin.com/raw/{key}" + reply_text = f"**Hastebin** : [Click Here]({url})" delete = (True if app.long(m) > 1 and m.command[1] in ["d", "del"] and reply.from_user.is_self else False) if delete: await asyncio.gather( From b5c082c9f79c0cd1997e8ab11272645d587e44ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Mon, 7 Mar 2022 20:45:18 +0530 Subject: [PATCH 6/7] Update welcome.py missed colons --- tronx/modules/welcome.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tronx/modules/welcome.py b/tronx/modules/welcome.py index 09f46bcd..27147e57 100644 --- a/tronx/modules/welcome.py +++ b/tronx/modules/welcome.py @@ -69,7 +69,7 @@ async def send_welcome(_, m: Message): @app.on_message(gen(["setwelcome", "setwc"], allow = ["sudo", "channel"])) async def save_welcome(_, m: Message): - if await app.private(m) + if await app.private(m): return await app.send_edit(m, "Setting this media as a welcome message . . .", mono=True) @@ -100,7 +100,7 @@ async def save_welcome(_, m: Message): @app.on_message(gen(["delwelcome", "delwc"], allow = ["sudo", "channel"])) async def delete_welcome(_, m: Message): - if await app.private(m) + if await app.private(m): return try: @@ -115,7 +115,7 @@ async def delete_welcome(_, m: Message): @app.on_message(gen(["getwelcome", "getwc"], allow = ["sudo", "channel"])) async def delete_welcome(_, m: Message): - if await app.private(m) + if await app.private(m): return try: From 284fd497e00dcb7bfb04947abf8418a3be25ba74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=87=E2=80=A2=E1=BA=9E=E1=97=B4=E1=97=A9S=D4=B5?= =?UTF-8?q?=E2=80=A2=E0=BF=87?= <80647839+beastzx18@users.noreply.github.com> Date: Mon, 7 Mar 2022 20:47:01 +0530 Subject: [PATCH 7/7] Update welcome.py --- tronx/modules/welcome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tronx/modules/welcome.py b/tronx/modules/welcome.py index 27147e57..b689a2f0 100644 --- a/tronx/modules/welcome.py +++ b/tronx/modules/welcome.py @@ -25,7 +25,7 @@ ) -IgnoreList = [] +IgnoreChat = []