Spaces:
Paused
Paused
iamgojoof6eyes
commited on
Commit
·
239f614
1
Parent(s):
a6bd156
Removed dependecy of HTTPx
Browse files- Powers/__init__.py +2 -0
- Powers/bot_class.py +8 -1
- Powers/plugins/admin.py +14 -14
- Powers/plugins/approve.py +5 -5
- Powers/plugins/bans.py +10 -10
- Powers/plugins/blacklist.py +5 -5
- Powers/plugins/dev.py +1 -38
- Powers/plugins/fun.py +12 -12
- Powers/plugins/greetings.py +9 -9
- Powers/plugins/locks.py +4 -4
- Powers/plugins/muting.py +7 -7
- Powers/plugins/notes.py +7 -7
- Powers/plugins/pin.py +7 -7
- Powers/plugins/purge.py +3 -3
- Powers/plugins/report.py +2 -2
- Powers/plugins/rules.py +4 -4
- Powers/plugins/utils.py +117 -164
- Powers/utils/http_helper.py +44 -10
- Powers/utils/start_utils.py +2 -2
- Powers/vars.py +4 -0
- app.json +10 -0
- requirements.txt +5 -3
Powers/__init__.py
CHANGED
|
@@ -60,6 +60,8 @@ LOGGER.info("Source Code: https://github.com/iamgojoof6eyes/Gojo_Satarou\n")
|
|
| 60 |
BOT_TOKEN = Config.BOT_TOKEN
|
| 61 |
API_ID = Config.API_ID
|
| 62 |
API_HASH = Config.API_HASH
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# General Config
|
| 65 |
MESSAGE_DUMP = Config.MESSAGE_DUMP
|
|
|
|
| 60 |
BOT_TOKEN = Config.BOT_TOKEN
|
| 61 |
API_ID = Config.API_ID
|
| 62 |
API_HASH = Config.API_HASH
|
| 63 |
+
ARQ_API_URL = Config.ARQ_API_URL
|
| 64 |
+
ARQ_API_KEY = Config.ARQ_API_KEY
|
| 65 |
|
| 66 |
# General Config
|
| 67 |
MESSAGE_DUMP = Config.MESSAGE_DUMP
|
Powers/bot_class.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
from platform import python_version
|
| 2 |
from threading import RLock
|
| 3 |
from time import gmtime, strftime, time
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
from pyrogram import Client, __version__
|
| 6 |
from pyrogram.raw.all import layer
|
|
@@ -16,6 +19,8 @@ from Powers import (
|
|
| 16 |
NO_LOAD,
|
| 17 |
UPTIME,
|
| 18 |
WORKERS,
|
|
|
|
|
|
|
| 19 |
load_cmds,
|
| 20 |
)
|
| 21 |
from Powers.database import MongoDB
|
|
@@ -29,7 +34,9 @@ if MESSAGE_DUMP == -100 or not str(MESSAGE_DUMP).startswith("-100"):
|
|
| 29 |
raise Exception(
|
| 30 |
"Please enter a vaild Supergroup ID, A Supergroup ID starts with -100",
|
| 31 |
)
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
class Gojo(Client):
|
| 35 |
"""Starts the Pyrogram Client on the Bot Token when we do 'python3 -m Powers'"""
|
|
|
|
| 1 |
from platform import python_version
|
| 2 |
from threading import RLock
|
| 3 |
from time import gmtime, strftime, time
|
| 4 |
+
from aiohttp import ClientSession
|
| 5 |
+
from Python_ARQ import ARQ
|
| 6 |
+
import asyncio
|
| 7 |
|
| 8 |
from pyrogram import Client, __version__
|
| 9 |
from pyrogram.raw.all import layer
|
|
|
|
| 19 |
NO_LOAD,
|
| 20 |
UPTIME,
|
| 21 |
WORKERS,
|
| 22 |
+
ARQ_API_URL,
|
| 23 |
+
ARQ_API_KEY,
|
| 24 |
load_cmds,
|
| 25 |
)
|
| 26 |
from Powers.database import MongoDB
|
|
|
|
| 34 |
raise Exception(
|
| 35 |
"Please enter a vaild Supergroup ID, A Supergroup ID starts with -100",
|
| 36 |
)
|
| 37 |
+
|
| 38 |
+
aiohttpsession = ClientSession()
|
| 39 |
+
arq = ARQ(ARQ_API_URL, ARQ_API_KEY, aiohttpsession)
|
| 40 |
|
| 41 |
class Gojo(Client):
|
| 42 |
"""Starts the Pyrogram Client on the Bot Token when we do 'python3 -m Powers'"""
|
Powers/plugins/admin.py
CHANGED
|
@@ -555,21 +555,21 @@ __alt_name__ = [
|
|
| 555 |
__HELP__ = """Lazy to promote or demote someone for admins? Want to see basic information about chat?
|
| 556 |
All stuff about chatroom such as admin lists, pinning or grabbing an invite link can be done easily using the bot.
|
| 557 |
**User Commands:**
|
| 558 |
-
|
| 559 |
**Admin only:**
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
|
| 574 |
**Example:**
|
| 575 |
`/promote @username`: this promotes a user to admin."""
|
|
|
|
| 555 |
__HELP__ = """Lazy to promote or demote someone for admins? Want to see basic information about chat?
|
| 556 |
All stuff about chatroom such as admin lists, pinning or grabbing an invite link can be done easily using the bot.
|
| 557 |
**User Commands:**
|
| 558 |
+
* /adminlist: List all the admins in the Group.
|
| 559 |
**Admin only:**
|
| 560 |
+
* /invitelink: Gets chat invitelink.
|
| 561 |
+
* /promote: Promotes the user replied to or tagged (supports with title).
|
| 562 |
+
* /fullpromote: Fully Promotes the user replied to or tagged (supports with title).
|
| 563 |
+
* /demote: Demotes the user replied to or tagged.
|
| 564 |
+
* /admincache: Reloads the List of all the admins in the Group.
|
| 565 |
+
* /zombies: Bans all the deleted accounts. (owner only)
|
| 566 |
+
* /title: sets a custom title for an admin that the bot promoted.
|
| 567 |
+
* /disable <commandname>: Stop users from using "commandname" in this group.
|
| 568 |
+
* /enable <item name>: Allow users from using "commandname" in this group.
|
| 569 |
+
* /disableable: List all disableable commands.
|
| 570 |
+
* /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
| 571 |
+
* /disabled: List the disabled commands in this chat.
|
| 572 |
+
* /enableall: enable all disabled commands.
|
| 573 |
|
| 574 |
**Example:**
|
| 575 |
`/promote @username`: this promotes a user to admin."""
|
Powers/plugins/approve.py
CHANGED
|
@@ -238,10 +238,10 @@ __HELP__ = """Sometimes, you might trust a user not to send unwanted content.
|
|
| 238 |
Maybe not enough to make them admin, but you might be ok with locks, blacklists, and antiflood not applying to them.
|
| 239 |
That's what approvals are for - approve trustworthy users to allow them to send stuff without restrictions!
|
| 240 |
**Admin commands:**
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
**Example:**
|
| 247 |
`/approve @username`: this approves a user in the chat."""
|
|
|
|
| 238 |
Maybe not enough to make them admin, but you might be ok with locks, blacklists, and antiflood not applying to them.
|
| 239 |
That's what approvals are for - approve trustworthy users to allow them to send stuff without restrictions!
|
| 240 |
**Admin commands:**
|
| 241 |
+
* /approval: Check a user's approval status in this chat.
|
| 242 |
+
* /approve: Approve of a user. Locks, blacklists, and antiflood won't apply to them anymore.
|
| 243 |
+
* /unapprove: Unapprove of a user. They will now be subject to blocklists.
|
| 244 |
+
* /approved: List all approved users.
|
| 245 |
+
* /unapproveall: Unapprove *ALL* users in a chat. This cannot be undone!
|
| 246 |
**Example:**
|
| 247 |
`/approve @username`: this approves a user in the chat."""
|
Powers/plugins/bans.py
CHANGED
|
@@ -884,15 +884,15 @@ __HELP__ = """Someone annoying entered your group?
|
|
| 884 |
Want to ban/restriction him/her?
|
| 885 |
This is the plugin for you, easily kick, ban and unban members in a group.
|
| 886 |
**Admin only:**
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
**Example:**
|
| 898 |
`/ban @username`: this bans a user in the chat."""
|
|
|
|
| 884 |
Want to ban/restriction him/her?
|
| 885 |
This is the plugin for you, easily kick, ban and unban members in a group.
|
| 886 |
**Admin only:**
|
| 887 |
+
* /kick: Kick the user replied or tagged.
|
| 888 |
+
* /skick: Kick the user replied or tagged and delete your messsage.
|
| 889 |
+
* /dkick: Kick the user replied and delete their message.
|
| 890 |
+
* /ban: Bans the user replied to or tagged.
|
| 891 |
+
* /sban: Bans the user replied or tagged and delete your messsage.
|
| 892 |
+
* /dban: Bans the user replied and delete their message.
|
| 893 |
+
* /tban <userhandle> x(m/h/d): Bans a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 894 |
+
* /stban <userhandle> x(m/h/d): Silently bans a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 895 |
+
* /dtban <userhandle> x(m/h/d): Silently bans a user for x time and delete the replied message. (via reply). m = minutes, h = hours, d = days.
|
| 896 |
+
* /unban: Unbans the user replied to or tagged.
|
| 897 |
**Example:**
|
| 898 |
`/ban @username`: this bans a user in the chat."""
|
Powers/plugins/blacklist.py
CHANGED
|
@@ -213,14 +213,14 @@ __HELP__ = """Want to restrict certain words or sentences in your group?
|
|
| 213 |
Blacklists are used to stop certain triggers from being said in a group. Any time the trigger is mentioned, that message will immediately be deleted.
|
| 214 |
A good combo is sometimes to pair this up with warn filters!
|
| 215 |
**NOTE:** blacklists do not affect group admins.
|
| 216 |
-
|
| 217 |
**Admin only:**
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
Default is 'none', which will delete the users message on typing a blacklist word.
|
| 222 |
**Owner Only**
|
| 223 |
-
|
| 224 |
**Note:** Can only add or remove one blacklist at a time!
|
| 225 |
**Example:**
|
| 226 |
`/addblacklist hello`: this adds the word 'hello' as blacklist in the chat."""
|
|
|
|
| 213 |
Blacklists are used to stop certain triggers from being said in a group. Any time the trigger is mentioned, that message will immediately be deleted.
|
| 214 |
A good combo is sometimes to pair this up with warn filters!
|
| 215 |
**NOTE:** blacklists do not affect group admins.
|
| 216 |
+
* /blacklist: View the current blacklisted words.
|
| 217 |
**Admin only:**
|
| 218 |
+
* /addblacklist `<triggers>`: Add a trigger to the blacklist. Each line is considered one trigger, so using different lines will allow you to add multiple triggers.
|
| 219 |
+
* /unblacklist `<triggers>`: Remove triggers from the blacklist. Same newline logic applies here, so you can remove multiple triggers at once.
|
| 220 |
+
* /blaction `<action>`: This action will occur when user uses a blacklist word. Choose from - 'kick', 'ban', 'mute', 'warn'.
|
| 221 |
Default is 'none', which will delete the users message on typing a blacklist word.
|
| 222 |
**Owner Only**
|
| 223 |
+
* /rmallblacklist: Removes all the blacklists from the current chat.
|
| 224 |
**Note:** Can only add or remove one blacklist at a time!
|
| 225 |
**Example:**
|
| 226 |
`/addblacklist hello`: this adds the word 'hello' as blacklist in the chat."""
|
Powers/plugins/dev.py
CHANGED
|
@@ -21,7 +21,7 @@ from Powers.bot_class import Gojo
|
|
| 21 |
from Powers.database.chats_db import Chats
|
| 22 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 23 |
from Powers.utils.custom_filters import command
|
| 24 |
-
from Powers.utils.http_helper import
|
| 25 |
from Powers.utils.kbhelpers import ikb
|
| 26 |
from Powers.utils.parser import mention_markdown
|
| 27 |
from Powers.vars import Config
|
|
@@ -55,28 +55,6 @@ async def send_log(c: Gojo, m: Message):
|
|
| 55 |
return
|
| 56 |
|
| 57 |
|
| 58 |
-
@Gojo.on_message(command("ginfo", sudo_cmd=True))
|
| 59 |
-
async def group_info(c: Gojo, m: Message):
|
| 60 |
-
if len(m.text.split()) != 2:
|
| 61 |
-
await m.reply_text(
|
| 62 |
-
f"It works like this: <code>{Config.PREFIX_HANDLER} chat_id</code>",
|
| 63 |
-
)
|
| 64 |
-
return
|
| 65 |
-
|
| 66 |
-
chat_id = m.text.split(None, 1)[1]
|
| 67 |
-
|
| 68 |
-
replymsg = await m.reply_text("Fetching info about group...!")
|
| 69 |
-
grp_data = await c.get_chat(chat_id)
|
| 70 |
-
msg = (
|
| 71 |
-
f"Information for group: {chat_id}\n\n"
|
| 72 |
-
f"Group Name: {grp_data['title']}\n"
|
| 73 |
-
f"Members Count: {grp_data['members_count']}\n"
|
| 74 |
-
f"Type: {grp_data['type']}\n"
|
| 75 |
-
f"Group ID: {grp_data['id']}"
|
| 76 |
-
)
|
| 77 |
-
await replymsg.edit_text(msg)
|
| 78 |
-
return
|
| 79 |
-
|
| 80 |
@Gojo.on_message(command("neofetch", dev_cmd=True))
|
| 81 |
async def neofetch_stats(_, m: Message):
|
| 82 |
cmd = "neofetch --stdout"
|
|
@@ -211,21 +189,6 @@ async def execution(_, m: Message):
|
|
| 211 |
return
|
| 212 |
|
| 213 |
|
| 214 |
-
@Gojo.on_message(command("ip", dev_cmd=True))
|
| 215 |
-
async def public_ip(c: Gojo, m: Message):
|
| 216 |
-
ip = await HTTPx.get("https://api.ipify.org")
|
| 217 |
-
await c.send_message(
|
| 218 |
-
MESSAGE_DUMP,
|
| 219 |
-
f"#IP\n\n**User:** {(await mention_markdown(m.from_user.first_name, m.from_user.id))}",
|
| 220 |
-
)
|
| 221 |
-
await m.reply_text(
|
| 222 |
-
text=f"""<b>Bot IP Address:</b>
|
| 223 |
-
<code>{ip.text}</code>""",
|
| 224 |
-
quote=True,
|
| 225 |
-
)
|
| 226 |
-
return
|
| 227 |
-
|
| 228 |
-
|
| 229 |
@Gojo.on_message(command("chatlist", dev_cmd=True))
|
| 230 |
async def chats(c: Gojo, m: Message):
|
| 231 |
exmsg = await m.reply_text(text="Exporting Charlist...")
|
|
|
|
| 21 |
from Powers.database.chats_db import Chats
|
| 22 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 23 |
from Powers.utils.custom_filters import command
|
| 24 |
+
from Powers.utils.http_helper import *
|
| 25 |
from Powers.utils.kbhelpers import ikb
|
| 26 |
from Powers.utils.parser import mention_markdown
|
| 27 |
from Powers.vars import Config
|
|
|
|
| 55 |
return
|
| 56 |
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
@Gojo.on_message(command("neofetch", dev_cmd=True))
|
| 59 |
async def neofetch_stats(_, m: Message):
|
| 60 |
cmd = "neofetch --stdout"
|
|
|
|
| 189 |
return
|
| 190 |
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
@Gojo.on_message(command("chatlist", dev_cmd=True))
|
| 193 |
async def chats(c: Gojo, m: Message):
|
| 194 |
exmsg = await m.reply_text(text="Exporting Charlist...")
|
Powers/plugins/fun.py
CHANGED
|
@@ -209,15 +209,15 @@ _DISABLE_CMDS_ = [
|
|
| 209 |
"shrug",
|
| 210 |
]
|
| 211 |
|
| 212 |
-
__HELP__ = """
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
|
|
|
| 209 |
"shrug",
|
| 210 |
]
|
| 211 |
|
| 212 |
+
__HELP__ = """* /runs: reply a random string from an array of replies.
|
| 213 |
+
* /slap: slap a user, or get slapped if not a reply.
|
| 214 |
+
* /insult: to insult a user, or get insulted if not a reply
|
| 215 |
+
* /shrug : get shrug XD.
|
| 216 |
+
* /decide : Randomly answers yes/no/maybe
|
| 217 |
+
* /toss : Tosses A coin
|
| 218 |
+
* /yes : check urself :V
|
| 219 |
+
* /no : check urself :V
|
| 220 |
+
* /bluetext : check urself :V
|
| 221 |
+
* /roll : Roll a dice.
|
| 222 |
+
* /react : Random Reaction
|
| 223 |
+
* /shout `<keyword>`: write anything you want to give loud shout."""
|
Powers/plugins/greetings.py
CHANGED
|
@@ -485,17 +485,17 @@ a) Currently it supports only text!
|
|
| 485 |
b) Gojo must be an admin to greet and goodbye users.
|
| 486 |
|
| 487 |
Admin Commands:
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
|
| 497 |
── **Cleaner** ──:
|
| 498 |
-
|
| 499 |
|
| 500 |
── **Format** ──
|
| 501 |
Check /markdownhelp for help related to formatting!"""
|
|
|
|
| 485 |
b) Gojo must be an admin to greet and goodbye users.
|
| 486 |
|
| 487 |
Admin Commands:
|
| 488 |
+
* /setwelcome <reply> : Sets a custom welcome message.
|
| 489 |
+
* /setgoodbye <reply> : Sets a custom goodbye message.
|
| 490 |
+
* /resetwelcome : Resets to bot default welcome message.
|
| 491 |
+
* /resetgoodbye : Resets to bot default goodbye message.
|
| 492 |
+
* /welcome <on/off> | noformat : enable/disable | Shows the current welcome message | settings.
|
| 493 |
+
* /goodbye <on/off> | noformat : enable/disable | Shows the current goodbye message | settings.
|
| 494 |
+
* /cleanwelcome <on/off> : Shows or sets the current clean welcome settings.
|
| 495 |
+
* /cleangoodbye <on/off> : Shows or sets the current clean goodbye settings.
|
| 496 |
|
| 497 |
── **Cleaner** ──:
|
| 498 |
+
* /cleanservice <on/off> : Use it to clean all service messages automatically or to view current status.
|
| 499 |
|
| 500 |
── **Format** ──
|
| 501 |
Check /markdownhelp for help related to formatting!"""
|
Powers/plugins/locks.py
CHANGED
|
@@ -331,10 +331,10 @@ __HELP__ = """ Use this to lock group permissions.
|
|
| 331 |
Allows you to lock and unlock permission types in the chat.
|
| 332 |
|
| 333 |
**Usage:**
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
|
| 339 |
**Example:**
|
| 340 |
`/lock media`: this locks all the media messages in the chat."""
|
|
|
|
| 331 |
Allows you to lock and unlock permission types in the chat.
|
| 332 |
|
| 333 |
**Usage:**
|
| 334 |
+
* /lock `<type>`: Lock Chat permission.
|
| 335 |
+
* /unlock `<type>`: Unlock Chat permission.
|
| 336 |
+
* /locks: View Chat permission.
|
| 337 |
+
* /locktypes: Check available lock types!
|
| 338 |
|
| 339 |
**Example:**
|
| 340 |
`/lock media`: this locks all the media messages in the chat."""
|
Powers/plugins/muting.py
CHANGED
|
@@ -603,13 +603,13 @@ __HELP__ = """Want someone to keep quite for a while in the group?
|
|
| 603 |
Mute plugin is here to help, mute or unmute any user easily!
|
| 604 |
|
| 605 |
**Admin only:**
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
|
| 614 |
**Example:**
|
| 615 |
`/mute @username`; this mutes a user."""
|
|
|
|
| 603 |
Mute plugin is here to help, mute or unmute any user easily!
|
| 604 |
|
| 605 |
**Admin only:**
|
| 606 |
+
* /mute: Mute the user replied to or mentioned.
|
| 607 |
+
* /smute: silences a user without notifying. Can also be used as a reply, muting the replied to user.
|
| 608 |
+
* /dmute: Mute a user by reply, and delete their message.
|
| 609 |
+
* /tmute <userhandle> x(m/h/d): mutes a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 610 |
+
* /stmute <userhandle> x(m/h/d): mutes a user for x time without notifying. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 611 |
+
* /dtmute <userhandle> x(m/h/d): Mute the replied user, and delete the replied message. (via reply). m = minutes, h = hours, d = days.
|
| 612 |
+
* /unmute: Unmutes the user mentioned or replied to.
|
| 613 |
|
| 614 |
**Example:**
|
| 615 |
`/mute @username`; this mutes a user."""
|
Powers/plugins/notes.py
CHANGED
|
@@ -429,26 +429,26 @@ __HELP__ = """Save a note, get that, even you can delete that note.
|
|
| 429 |
This note only avaiable for your whole group!
|
| 430 |
Only admins can save and deletenotes, anyone can get them.
|
| 431 |
|
| 432 |
-
|
| 433 |
Save a note, you can get or delete that later.
|
| 434 |
|
| 435 |
-
|
| 436 |
Get that note, if avaiable.
|
| 437 |
|
| 438 |
-
|
| 439 |
Get that note in raw format, so you can edit and update it.
|
| 440 |
|
| 441 |
-
|
| 442 |
Delete that note, if avaiable.
|
| 443 |
|
| 444 |
-
|
| 445 |
Clears all notes in the chat!
|
| 446 |
**NOTE:** Can only be used by owner of chat!
|
| 447 |
|
| 448 |
-
|
| 449 |
Get all your notes, if too much notes, please use this in your saved message instead!
|
| 450 |
|
| 451 |
-
|
| 452 |
|
| 453 |
── **Note Format** ──
|
| 454 |
Check /markdownhelp for help related to formatting!"""
|
|
|
|
| 429 |
This note only avaiable for your whole group!
|
| 430 |
Only admins can save and deletenotes, anyone can get them.
|
| 431 |
|
| 432 |
+
* /save `<notename>` <`note content or reply to message>`
|
| 433 |
Save a note, you can get or delete that later.
|
| 434 |
|
| 435 |
+
* /get `<note>` or #<note>
|
| 436 |
Get that note, if avaiable.
|
| 437 |
|
| 438 |
+
* /get `<note>` noformat or /get `<note>` raw
|
| 439 |
Get that note in raw format, so you can edit and update it.
|
| 440 |
|
| 441 |
+
* /clear `<note>`
|
| 442 |
Delete that note, if avaiable.
|
| 443 |
|
| 444 |
+
* /clearall
|
| 445 |
Clears all notes in the chat!
|
| 446 |
**NOTE:** Can only be used by owner of chat!
|
| 447 |
|
| 448 |
+
* /saved or /notes
|
| 449 |
Get all your notes, if too much notes, please use this in your saved message instead!
|
| 450 |
|
| 451 |
+
* /privatenotes `<on/yes/no/off>`: Whether to turn private rules on or off, prevents spam in chat when people use notes command.
|
| 452 |
|
| 453 |
── **Note Format** ──
|
| 454 |
Check /markdownhelp for help related to formatting!"""
|
Powers/plugins/pin.py
CHANGED
|
@@ -239,10 +239,10 @@ __alt_name__ = ["pin", "unpin"]
|
|
| 239 |
__HELP__ = """Here you find find all help related to groups pins and how to manage them via me.
|
| 240 |
|
| 241 |
**Admin Cmds:**
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
|
|
|
| 239 |
__HELP__ = """Here you find find all help related to groups pins and how to manage them via me.
|
| 240 |
|
| 241 |
**Admin Cmds:**
|
| 242 |
+
* /pin: Silently pins the message replied to - add `loud`, `notify` or `alert` to give notificaton to users.
|
| 243 |
+
* /unpin: Unpins the last pinned message.
|
| 244 |
+
* /pinned: Gives the current pinned message of the chat.
|
| 245 |
+
* /unpinall: Unpins all the pinned message in the current chat.
|
| 246 |
+
* /antichannelpin `<on/off/yes/no>`: Toggle antichannelpin status. All the messages from linked channel will be unpinned if enabled!
|
| 247 |
+
* /cleanlinked `<on/off/yes/no>`: Toggle cleanlinked status. All the messages from linked channel will be deleted if enabled!
|
| 248 |
+
* /permapin `<text>`: Pin a custom messages via bot. This message can contain markdown, and can be used in replies to the media include additional buttons and text."""
|
Powers/plugins/purge.py
CHANGED
|
@@ -117,6 +117,6 @@ __PLUGIN__ = "purges"
|
|
| 117 |
__alt_name__ = ["purge", "del", "spurge"]
|
| 118 |
|
| 119 |
__HELP__ = """Want to delete messages in you group?
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 117 |
__alt_name__ = ["purge", "del", "spurge"]
|
| 118 |
|
| 119 |
__HELP__ = """Want to delete messages in you group?
|
| 120 |
+
* /purge: Deletes messages upto replied message.
|
| 121 |
+
* /spurge: Deletes messages upto replied message without a success message.
|
| 122 |
+
* /del: Deletes a single message, used as a reply to message."""
|
Powers/plugins/report.py
CHANGED
|
@@ -201,11 +201,11 @@ __PLUGIN__ = "reporting"
|
|
| 201 |
|
| 202 |
__alt_name__ = ["reports", "report"]
|
| 203 |
|
| 204 |
-
__HELP__ = """
|
| 205 |
- @admin: reply to a message to report it to admins.
|
| 206 |
**NOTE:** Neither of these will get triggered if used by admins.
|
| 207 |
|
| 208 |
**Admins Only:**
|
| 209 |
-
|
| 210 |
- If done in PM, toggles your status.
|
| 211 |
- If in group, toggles that groups's status."""
|
|
|
|
| 201 |
|
| 202 |
__alt_name__ = ["reports", "report"]
|
| 203 |
|
| 204 |
+
__HELP__ = """* /report `<reason>`: reply to a message to report it to admins.
|
| 205 |
- @admin: reply to a message to report it to admins.
|
| 206 |
**NOTE:** Neither of these will get triggered if used by admins.
|
| 207 |
|
| 208 |
**Admins Only:**
|
| 209 |
+
* /reports `<on/off/yes/no>`: change report setting, or view current status.
|
| 210 |
- If done in PM, toggles your status.
|
| 211 |
- If in group, toggles that groups's status."""
|
Powers/plugins/rules.py
CHANGED
|
@@ -149,9 +149,9 @@ __alt_name__ = ["rule"]
|
|
| 149 |
|
| 150 |
__HELP__ = """Set rules for you chat so that members know what to do and what not to do in your group!
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
**Admin only:**
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
|
|
|
| 149 |
|
| 150 |
__HELP__ = """Set rules for you chat so that members know what to do and what not to do in your group!
|
| 151 |
|
| 152 |
+
* /rules: get the rules for current chat.
|
| 153 |
|
| 154 |
**Admin only:**
|
| 155 |
+
* /setrules `<rules>`: Set the rules for this chat, also works as a reply to a message.
|
| 156 |
+
* /clearrules: Clear the rules for this chat.
|
| 157 |
+
* /privrules `<on/yes/no/off>`: Turns on/off the option to send the rules to PM of user or group."""
|
Powers/plugins/utils.py
CHANGED
|
@@ -1,31 +1,29 @@
|
|
| 1 |
-
from html import escape
|
| 2 |
from io import BytesIO
|
| 3 |
from os import remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
from gpytranslate import Translator
|
| 6 |
from pyrogram import filters
|
| 7 |
from pyrogram.errors import MessageTooLong, PeerIdInvalid, RPCError
|
| 8 |
-
from pyrogram.types import Message
|
| 9 |
-
from tswift import Song
|
| 10 |
-
from wikipedia import summary
|
| 11 |
-
from wikipedia.exceptions import DisambiguationError, PageError
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
LOGGER,
|
| 16 |
-
OWNER_ID,
|
| 17 |
-
SUDO_USERS,
|
| 18 |
-
SUPPORT_GROUP,
|
| 19 |
-
SUPPORT_STAFF,
|
| 20 |
-
WHITELIST_USERS,
|
| 21 |
-
)
|
| 22 |
from Powers.bot_class import Gojo
|
| 23 |
from Powers.database.antispam_db import GBan
|
| 24 |
from Powers.database.users_db import Users
|
| 25 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 26 |
from Powers.utils.custom_filters import command
|
| 27 |
from Powers.utils.extract_user import extract_user
|
| 28 |
-
from Powers.utils.http_helper import
|
| 29 |
from Powers.utils.kbhelpers import ikb
|
| 30 |
from Powers.utils.parser import mention_html
|
| 31 |
from Powers.vars import Config
|
|
@@ -198,176 +196,131 @@ async def get_gifid(_, m: Message):
|
|
| 198 |
@Gojo.on_message(
|
| 199 |
command("github") & (filters.group | filters.private),
|
| 200 |
)
|
| 201 |
-
async def github(_,
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
)
|
| 209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
return
|
|
|
|
| 216 |
|
| 217 |
-
r_json = r.json()
|
| 218 |
-
url = r_json.get("html_url", None)
|
| 219 |
-
name = r_json.get("name", None)
|
| 220 |
-
company = r_json.get("company", None)
|
| 221 |
-
followers = r_json.get("followers", 0)
|
| 222 |
-
following = r_json.get("following", 0)
|
| 223 |
-
public_repos = r_json.get("public_repos", 0)
|
| 224 |
-
bio = r_json.get("bio", None)
|
| 225 |
-
created_at = r_json.get("created_at", "Not Found")
|
| 226 |
-
|
| 227 |
-
REPLY = (
|
| 228 |
-
f"<b>GitHub Info for @{username}:</b>"
|
| 229 |
-
f"\n<b>Name:</b> <code>{name}</code>\n"
|
| 230 |
-
f"<b>Bio:</b> <code>{bio}</code>\n"
|
| 231 |
-
f"<b>URL:</b> {url}\n"
|
| 232 |
-
f"<b>Public Repos:</b> {public_repos}\n"
|
| 233 |
-
f"<b>Followers:</b> {followers}\n"
|
| 234 |
-
f"<b>Following:</b> {following}\n"
|
| 235 |
-
f"<b>Company:</b> <code>{company}</code>\n"
|
| 236 |
-
f"<b>Created at:</b> <code>{created_at}</code>"
|
| 237 |
-
)
|
| 238 |
|
| 239 |
-
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
|
|
|
|
|
|
| 242 |
|
| 243 |
-
|
| 244 |
-
command("info") & (filters.group | filters.private),
|
| 245 |
-
)
|
| 246 |
-
async def my_info(c: Gojo, m: Message):
|
| 247 |
-
try:
|
| 248 |
-
user_id, name, user_name = await extract_user(c, m)
|
| 249 |
-
except PeerIdInvalid:
|
| 250 |
-
await m.reply_text(text="I haven't seen this user, mind forwarding one of their messages so I can recognize them?")
|
| 251 |
-
return
|
| 252 |
-
except ValueError as ef:
|
| 253 |
-
if "Peer id invalid" in str(ef):
|
| 254 |
-
await m.reply_text(text="User not found, please check the ID again")
|
| 255 |
-
return
|
| 256 |
-
try:
|
| 257 |
-
user = Users.get_user_info(int(user_id))
|
| 258 |
-
name = user["name"]
|
| 259 |
-
user_name = user["username"]
|
| 260 |
-
user_id = user["_id"]
|
| 261 |
-
except KeyError:
|
| 262 |
-
LOGGER.warning(f"Calling api to fetch info about user {user_id}")
|
| 263 |
-
user = await c.get_users(user_id)
|
| 264 |
-
name = (
|
| 265 |
-
escape(user["first_name"] + " " + user["last_name"])
|
| 266 |
-
if user["last_name"]
|
| 267 |
-
else user["first_name"]
|
| 268 |
-
)
|
| 269 |
-
user_name = user["username"]
|
| 270 |
-
user_id = user["id"]
|
| 271 |
-
except PeerIdInvalid:
|
| 272 |
-
await m.reply_text(text="""Failed to get user
|
| 273 |
-
Peer ID invalid, I haven't seen this user anywhere earlier, maybe username would help to know them!""")
|
| 274 |
-
return
|
| 275 |
-
except (RPCError, Exception) as ef:
|
| 276 |
-
await m.reply_text(
|
| 277 |
-
text=f"""Some error occured, report to @{SUPPORT_GROUP}
|
| 278 |
-
<b>Error:</b> <code>{ef}</code>"""
|
| 279 |
-
)
|
| 280 |
-
return
|
| 281 |
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
<b>ID:</b> <code>{user_id}</code>
|
| 288 |
-
<b>First Name:</b> {user_name}"""
|
| 289 |
-
|
| 290 |
-
if user_name:
|
| 291 |
-
text += f"<b>Username:</b> @{user_name}"
|
| 292 |
-
perma_link=(await mention_html("Click Here", user_id))
|
| 293 |
-
text += f"<b>Permanent User Link:</b> {perma_link}"
|
| 294 |
-
|
| 295 |
-
if gbanned:
|
| 296 |
-
text += f"\nThis user is Globally banned beacuse: {reason_gban}\n"
|
| 297 |
-
|
| 298 |
-
if user_id == OWNER_ID:
|
| 299 |
-
text += "This person is my Owner, I would never do anything against them!"
|
| 300 |
-
elif user_id in DEV_USERS:
|
| 301 |
-
text += "This member is one of my Developers ⚡️"
|
| 302 |
-
elif user_id in SUDO_USERS:
|
| 303 |
-
text += "This user is one of my Sudos, he has powers which are approximately same to owner!"
|
| 304 |
-
elif user_id in WHITELIST_USERS:
|
| 305 |
-
text += "This person is 'Whitelist User', they cannot be banned!"
|
| 306 |
-
|
| 307 |
-
await m.reply_text(text, parse_mode="html", disable_web_page_preview=True)
|
| 308 |
-
return
|
| 309 |
|
|
|
|
|
|
|
| 310 |
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
try:
|
| 315 |
-
if m.
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
txt = m.reply_to_message.text
|
| 323 |
else:
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
except Exception as e:
|
| 334 |
-
await replymsg.edit_text(f"Error: {e}")
|
| 335 |
-
return
|
| 336 |
-
return
|
| 337 |
|
| 338 |
|
| 339 |
@Gojo.on_message(command("tr"))
|
| 340 |
-
async def
|
| 341 |
trl = Translator()
|
| 342 |
-
if
|
| 343 |
-
if len(
|
| 344 |
target_lang = "en"
|
| 345 |
else:
|
| 346 |
-
target_lang =
|
| 347 |
-
if
|
| 348 |
-
text =
|
| 349 |
else:
|
| 350 |
-
text =
|
| 351 |
else:
|
| 352 |
-
if len(
|
| 353 |
-
await
|
| 354 |
-
"Provide lang code.\n[Available options](https://telegra.ph/Lang-Codes-
|
| 355 |
)
|
| 356 |
return
|
| 357 |
-
target_lang =
|
| 358 |
-
text =
|
| 359 |
detectlang = await trl.detect(text)
|
| 360 |
try:
|
| 361 |
tekstr = await trl(text, targetlang=target_lang)
|
| 362 |
except ValueError as err:
|
| 363 |
-
await
|
| 364 |
return
|
| 365 |
-
|
| 366 |
-
return await m.reply_text(
|
| 367 |
f"<b>Translated:</b> from {detectlang} to {target_lang} \n<code>``{tekstr.text}``</code>",
|
| 368 |
)
|
| 369 |
|
| 370 |
|
|
|
|
|
|
|
| 371 |
__PLUGIN__ = "utils"
|
| 372 |
_DISABLE_CMDS_ = [
|
| 373 |
"paste",
|
|
@@ -384,14 +337,14 @@ __alt_name__ = ["util", "misc", "tools"]
|
|
| 384 |
|
| 385 |
__HELP__ = """Some utils provided by bot to make your tasks easy!
|
| 386 |
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
|
| 396 |
**Example:**
|
| 397 |
-
`/
|
|
|
|
|
|
|
| 1 |
from io import BytesIO
|
| 2 |
from os import remove
|
| 3 |
+
import re
|
| 4 |
+
import aiofiles
|
| 5 |
+
from search_engine_parser import GoogleSearch
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
from aiohttp import ClientSession
|
| 8 |
+
from tswift import Song
|
| 9 |
+
from wikipedia import summary
|
| 10 |
+
from wikipedia.exceptions import DisambiguationError, PageError
|
| 11 |
+
|
| 12 |
|
| 13 |
from gpytranslate import Translator
|
| 14 |
from pyrogram import filters
|
| 15 |
from pyrogram.errors import MessageTooLong, PeerIdInvalid, RPCError
|
| 16 |
+
from pyrogram.types import Message,InlineKeyboardButton, InlineKeyboardMarkup
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
|
| 19 |
+
from Powers import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
from Powers.bot_class import Gojo
|
| 21 |
from Powers.database.antispam_db import GBan
|
| 22 |
from Powers.database.users_db import Users
|
| 23 |
from Powers.utils.clean_file import remove_markdown_and_html
|
| 24 |
from Powers.utils.custom_filters import command
|
| 25 |
from Powers.utils.extract_user import extract_user
|
| 26 |
+
from Powers.utils.http_helper import *
|
| 27 |
from Powers.utils.kbhelpers import ikb
|
| 28 |
from Powers.utils.parser import mention_html
|
| 29 |
from Powers.vars import Config
|
|
|
|
| 196 |
@Gojo.on_message(
|
| 197 |
command("github") & (filters.group | filters.private),
|
| 198 |
)
|
| 199 |
+
async def github(_, message):
|
| 200 |
+
try:
|
| 201 |
+
if len(message.command) < 2:
|
| 202 |
+
await message.reply_text('"/github" Needs An Argument')
|
| 203 |
+
return
|
| 204 |
+
gett = message.text.split(None, 1)[1]
|
| 205 |
+
text = gett + ' "site:github.com"'
|
| 206 |
+
gresults = await GoogleSearch().async_search(text, 1)
|
| 207 |
+
result = ""
|
| 208 |
+
for i in range(4):
|
| 209 |
+
try:
|
| 210 |
+
title = gresults["titles"][i].replace("\n", " ")
|
| 211 |
+
source = gresults["links"][i]
|
| 212 |
+
description = gresults["descriptions"][i]
|
| 213 |
+
result += f"[{title}]({source})\n"
|
| 214 |
+
result += f"`{description}`\n\n"
|
| 215 |
+
except IndexError:
|
| 216 |
+
pass
|
| 217 |
+
await message.reply_text(result, disable_web_page_preview=True)
|
| 218 |
+
except Exception as e:
|
| 219 |
+
await message.reply_text(str(e))
|
| 220 |
+
|
| 221 |
+
#paste here
|
| 222 |
+
session = ClientSession()
|
| 223 |
+
pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
|
| 224 |
+
BASE = "https://batbin.me/"
|
| 225 |
|
| 226 |
+
async def post(url: str, *args, **kwargs):
|
| 227 |
+
async with session.post(url, *args, **kwargs) as resp:
|
| 228 |
+
try:
|
| 229 |
+
data = await resp.json()
|
| 230 |
+
except Exception:
|
| 231 |
+
data = await resp.text()
|
| 232 |
+
return data
|
| 233 |
+
|
| 234 |
+
async def paste(content: str):
|
| 235 |
+
resp = await post(f"{BASE}api/v2/paste", data=content)
|
| 236 |
+
if not resp["success"]:
|
| 237 |
return
|
| 238 |
+
return BASE + resp["message"]
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
+
@Gojo.on_message(command("paste"))
|
| 242 |
+
async def paste_func(_, message: Message):
|
| 243 |
+
if not message.reply_to_message:
|
| 244 |
+
return await message.reply_text("Reply To A Message With `/paste`")
|
| 245 |
+
|
| 246 |
+
r = message.reply_to_message
|
| 247 |
|
| 248 |
+
if not r.text and not r.document:
|
| 249 |
+
return await message.reply_text("Only text and documents are supported")
|
| 250 |
|
| 251 |
+
m = await message.reply_text("Pasting...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
+
if r.text:
|
| 254 |
+
content = str(r.text)
|
| 255 |
+
elif r.document:
|
| 256 |
+
if r.document.file_size > 40000:
|
| 257 |
+
return await m.edit("You can only paste files smaller than 40KB.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
+
if not pattern.search(r.document.mime_type):
|
| 260 |
+
return await m.edit("Only text files can be pasted.")
|
| 261 |
|
| 262 |
+
doc = await message.reply_to_message.download()
|
| 263 |
+
|
| 264 |
+
async with aiofiles.open(doc, mode="r") as f:
|
| 265 |
+
content = await f.read()
|
| 266 |
+
|
| 267 |
+
remove(doc)
|
| 268 |
+
|
| 269 |
+
link = await paste(content)
|
| 270 |
+
kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
|
| 271 |
try:
|
| 272 |
+
if m.from_user.is_bot:
|
| 273 |
+
await message.reply_photo(
|
| 274 |
+
photo=link,
|
| 275 |
+
quote=False,
|
| 276 |
+
caption="Pasted",
|
| 277 |
+
reply_markup=InlineKeyboardMarkup(kb),
|
| 278 |
+
)
|
|
|
|
| 279 |
else:
|
| 280 |
+
await message.reply_photo(
|
| 281 |
+
photo=link,
|
| 282 |
+
quote=False,
|
| 283 |
+
caption="Pasted",
|
| 284 |
+
reply_markup=InlineKeyboardMarkup(kb),
|
| 285 |
+
)
|
| 286 |
+
await m.delete()
|
| 287 |
+
except Exception:
|
| 288 |
+
await m.edit("Here is the link of the document....", reply_markup=InlineKeyboardMarkup(kb))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
|
| 291 |
@Gojo.on_message(command("tr"))
|
| 292 |
+
async def tr(_, message):
|
| 293 |
trl = Translator()
|
| 294 |
+
if message.reply_to_message and (message.reply_to_message.text or message.reply_to_message.caption):
|
| 295 |
+
if len(message.text.split()) == 1:
|
| 296 |
target_lang = "en"
|
| 297 |
else:
|
| 298 |
+
target_lang = message.text.split()[1]
|
| 299 |
+
if message.reply_to_message.text:
|
| 300 |
+
text = message.reply_to_message.text
|
| 301 |
else:
|
| 302 |
+
text = message.reply_to_message.caption
|
| 303 |
else:
|
| 304 |
+
if len(message.text.split()) <= 2:
|
| 305 |
+
await message.reply_text(
|
| 306 |
+
"Provide lang code.\n[Available options](https://telegra.ph/Lang-Codes-02-22).\n<b>Usage:</b> <code>/tr en</code>",
|
| 307 |
)
|
| 308 |
return
|
| 309 |
+
target_lang = message.text.split(None, 2)[1]
|
| 310 |
+
text = message.text.split(None, 2)[2]
|
| 311 |
detectlang = await trl.detect(text)
|
| 312 |
try:
|
| 313 |
tekstr = await trl(text, targetlang=target_lang)
|
| 314 |
except ValueError as err:
|
| 315 |
+
await message.reply_text(f"Error: <code>{str(err)}</code>")
|
| 316 |
return
|
| 317 |
+
return await message.reply_text(
|
|
|
|
| 318 |
f"<b>Translated:</b> from {detectlang} to {target_lang} \n<code>``{tekstr.text}``</code>",
|
| 319 |
)
|
| 320 |
|
| 321 |
|
| 322 |
+
|
| 323 |
+
|
| 324 |
__PLUGIN__ = "utils"
|
| 325 |
_DISABLE_CMDS_ = [
|
| 326 |
"paste",
|
|
|
|
| 337 |
|
| 338 |
__HELP__ = """Some utils provided by bot to make your tasks easy!
|
| 339 |
|
| 340 |
+
* /id: Get the current group id. If used by replying to a message, get that user's id.
|
| 341 |
+
* /info: Get information about a user.
|
| 342 |
+
* /gifid: Reply to a gif to me to tell you its file ID.
|
| 343 |
+
* /wiki: `<query>`: wiki your query.
|
| 344 |
+
* /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
|
| 345 |
+
* /github `<username>`: Search for the user using github api!
|
| 346 |
+
* /lyrics `<song>`: Get the lyrics of the song you specify!
|
| 347 |
+
* /weebify `<text>` or `<reply to message>`: To weebify the text.
|
| 348 |
|
| 349 |
**Example:**
|
| 350 |
+
`/github @iamgojoof6eyes`: this fetches the information about a user from the database."""
|
Powers/utils/http_helper.py
CHANGED
|
@@ -1,14 +1,48 @@
|
|
| 1 |
-
from
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from asyncio import gather
|
| 2 |
+
from bot_class import aiohttpsession as session
|
| 3 |
|
| 4 |
+
async def get(url: str, *args, **kwargs):
|
| 5 |
+
async with session.get(url, *args, **kwargs) as resp:
|
| 6 |
+
try:
|
| 7 |
+
data = await resp.json()
|
| 8 |
+
except Exception:
|
| 9 |
+
data = await resp.text()
|
| 10 |
+
return data
|
| 11 |
|
| 12 |
|
| 13 |
+
async def head(url: str, *args, **kwargs):
|
| 14 |
+
async with session.head(url, *args, **kwargs) as resp:
|
| 15 |
+
try:
|
| 16 |
+
data = await resp.json()
|
| 17 |
+
except Exception:
|
| 18 |
+
data = await resp.text()
|
| 19 |
+
return data
|
| 20 |
|
| 21 |
+
|
| 22 |
+
async def post(url: str, *args, **kwargs):
|
| 23 |
+
async with session.post(url, *args, **kwargs) as resp:
|
| 24 |
+
try:
|
| 25 |
+
data = await resp.json()
|
| 26 |
+
except Exception:
|
| 27 |
+
data = await resp.text()
|
| 28 |
+
return data
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
async def multiget(url: str, times: int, *args, **kwargs):
|
| 32 |
+
return await gather(*[get(url, *args, **kwargs) for _ in range(times)])
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
async def multihead(url: str, times: int, *args, **kwargs):
|
| 36 |
+
return await gather(*[head(url, *args, **kwargs) for _ in range(times)])
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
async def multipost(url: str, times: int, *args, **kwargs):
|
| 40 |
+
return await gather(*[post(url, *args, **kwargs) for _ in range(times)])
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
async def resp_get(url: str, *args, **kwargs):
|
| 44 |
+
return await session.get(url, *args, **kwargs)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
async def resp_post(url: str, *args, **kwargs):
|
| 48 |
+
return await session.post(url, *args, **kwargs)
|
Powers/utils/start_utils.py
CHANGED
|
@@ -256,8 +256,8 @@ async def get_help_msg(m: Message or CallbackQuery, help_option: str):
|
|
| 256 |
Hey There! My name is Gojo.
|
| 257 |
I'm here to help you manage your groups!
|
| 258 |
Commands available:
|
| 259 |
-
|
| 260 |
-
|
| 261 |
"""
|
| 262 |
help_kb = [
|
| 263 |
*(await gen_cmds_kb(m)),
|
|
|
|
| 256 |
Hey There! My name is Gojo.
|
| 257 |
I'm here to help you manage your groups!
|
| 258 |
Commands available:
|
| 259 |
+
* /start: Start the bot
|
| 260 |
+
* /help: Give's you this message.
|
| 261 |
"""
|
| 262 |
help_kb = [
|
| 263 |
*(await gen_cmds_kb(m)),
|
Powers/vars.py
CHANGED
|
@@ -29,6 +29,8 @@ class Config:
|
|
| 29 |
SUPPORT_CHANNEL = config("SUPPORT_CHANNEL", default="gojo_updates")
|
| 30 |
VERSION = config("VERSION", default="v2.0")
|
| 31 |
WORKERS = int(config("WORKERS", default=16))
|
|
|
|
|
|
|
| 32 |
BOT_USERNAME = ""
|
| 33 |
BOT_ID = ""
|
| 34 |
BOT_NAME = ""
|
|
@@ -55,3 +57,5 @@ class Development:
|
|
| 55 |
SUPPORT_CHANNEL = "SUPPORT_CHANNEL"
|
| 56 |
VERSION = "VERSION"
|
| 57 |
WORKERS = 8
|
|
|
|
|
|
|
|
|
| 29 |
SUPPORT_CHANNEL = config("SUPPORT_CHANNEL", default="gojo_updates")
|
| 30 |
VERSION = config("VERSION", default="v2.0")
|
| 31 |
WORKERS = int(config("WORKERS", default=16))
|
| 32 |
+
ARQ_API_URL = config("ARQ_API_URL", default="https://arq.hamker.in")
|
| 33 |
+
ARQ_API_KEY = config("ARQ_API_KEY", default=None)
|
| 34 |
BOT_USERNAME = ""
|
| 35 |
BOT_ID = ""
|
| 36 |
BOT_NAME = ""
|
|
|
|
| 57 |
SUPPORT_CHANNEL = "SUPPORT_CHANNEL"
|
| 58 |
VERSION = "VERSION"
|
| 59 |
WORKERS = 8
|
| 60 |
+
ARQ_API_URL = "ARQ API url here"
|
| 61 |
+
ARQ_API_KEY = "ARQ API key here"
|
app.json
CHANGED
|
@@ -63,6 +63,16 @@
|
|
| 63 |
"required": true,
|
| 64 |
"value": "/ ! $"
|
| 65 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
"DEV_USERS": {
|
| 67 |
"description": "ID of users who are Devs of your bot (can use /py etc.)...Don't give comma or anything after 1 id just give and space then enter second id. If you are a noob and would come and bother Hell support then keep the current ID's here at they are and add yours.",
|
| 68 |
"required": false,
|
|
|
|
| 63 |
"required": true,
|
| 64 |
"value": "/ ! $"
|
| 65 |
},
|
| 66 |
+
"ARQ_API_URL": {
|
| 67 |
+
"description": "Leave it as it is....",
|
| 68 |
+
"required": true,
|
| 69 |
+
"value": "https://arq.hamker.in"
|
| 70 |
+
},
|
| 71 |
+
"ARQ_API_KEY": {
|
| 72 |
+
"description": "Get this from @ARQRobot.",
|
| 73 |
+
"required": true,
|
| 74 |
+
"value":""
|
| 75 |
+
},
|
| 76 |
"DEV_USERS": {
|
| 77 |
"description": "ID of users who are Devs of your bot (can use /py etc.)...Don't give comma or anything after 1 id just give and space then enter second id. If you are a noob and would come and bother Hell support then keep the current ID's here at they are and add yours.",
|
| 78 |
"required": false,
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
aiofiles
|
|
|
|
| 2 |
anyio==3.5.0; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 3 |
asyncio==3.4.3
|
| 4 |
beautifulsoup4==4.10.0; python_full_version > "3.0.0"
|
|
@@ -8,11 +9,11 @@ charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >=
|
|
| 8 |
dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
|
| 9 |
google==3.0.0
|
| 10 |
gpytranslate==1.4.0; python_version >= "3.6"
|
|
|
|
| 11 |
h11==0.12.0; python_version >= "3.6"
|
| 12 |
h2==4.1.0; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 13 |
hpack==4.0.0; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 14 |
httpcore==0.13.7; python_version >= "3.6"
|
| 15 |
-
httpx==0.22.0; python_version >= "3.7"
|
| 16 |
hyperframe==6.0.1; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 17 |
idna==3.3; python_version >= "3.6" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.5") and python_full_version >= "3.6.2"
|
| 18 |
lxml==4.8.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
|
|
@@ -21,15 +22,16 @@ pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
|
|
| 21 |
pymongo==3.12.3
|
| 22 |
pyrogram==2.0.19; python_version >= "3.7"
|
| 23 |
pysocks==1.7.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.4.0"
|
|
|
|
| 24 |
python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
| 25 |
pyyaml==6.0; python_version >= "3.6"
|
| 26 |
regex==2021.11.10
|
| 27 |
requests==2.27.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
|
| 28 |
rfc3986==1.5.0; python_version >= "3.6"
|
|
|
|
| 29 |
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
|
| 30 |
sniffio==1.2.0; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 31 |
soupsieve==2.3.1; python_version >= "3.6" and python_full_version > "3.0.0"
|
| 32 |
-
speedtest-cli==2.1.3
|
| 33 |
tgcrypto==1.2.3; python_version >= "3.6" and python_version < "4.0"
|
| 34 |
tswift==0.7.0
|
| 35 |
typing-extensions==4.1.1; python_full_version >= "3.6.2" and python_version >= "3.6" and python_version < "3.8"
|
|
|
|
| 1 |
+
aiofiles
|
| 2 |
+
aiohttp
|
| 3 |
anyio==3.5.0; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 4 |
asyncio==3.4.3
|
| 5 |
beautifulsoup4==4.10.0; python_full_version > "3.0.0"
|
|
|
|
| 9 |
dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
|
| 10 |
google==3.0.0
|
| 11 |
gpytranslate==1.4.0; python_version >= "3.6"
|
| 12 |
+
gTTS
|
| 13 |
h11==0.12.0; python_version >= "3.6"
|
| 14 |
h2==4.1.0; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 15 |
hpack==4.0.0; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 16 |
httpcore==0.13.7; python_version >= "3.6"
|
|
|
|
| 17 |
hyperframe==6.0.1; python_version >= "3.6" and python_full_version >= "3.6.1"
|
| 18 |
idna==3.3; python_version >= "3.6" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.5") and python_full_version >= "3.6.2"
|
| 19 |
lxml==4.8.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
|
|
|
|
| 22 |
pymongo==3.12.3
|
| 23 |
pyrogram==2.0.19; python_version >= "3.7"
|
| 24 |
pysocks==1.7.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.4.0"
|
| 25 |
+
python-arq
|
| 26 |
python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
|
| 27 |
pyyaml==6.0; python_version >= "3.6"
|
| 28 |
regex==2021.11.10
|
| 29 |
requests==2.27.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
|
| 30 |
rfc3986==1.5.0; python_version >= "3.6"
|
| 31 |
+
search_engine_parser
|
| 32 |
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
|
| 33 |
sniffio==1.2.0; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 34 |
soupsieve==2.3.1; python_version >= "3.6" and python_full_version > "3.0.0"
|
|
|
|
| 35 |
tgcrypto==1.2.3; python_version >= "3.6" and python_version < "4.0"
|
| 36 |
tswift==0.7.0
|
| 37 |
typing-extensions==4.1.1; python_full_version >= "3.6.2" and python_version >= "3.6" and python_version < "3.8"
|