Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
2707517
1
Parent(s):
e28d0c1
`Fixed error in fetching info`
Browse files- Powers/__init__.py +1 -1
- Powers/plugins/admin.py +15 -14
- Powers/plugins/approve.py +6 -5
- Powers/plugins/bans.py +11 -10
- Powers/plugins/blacklist.py +9 -5
- Powers/plugins/fun.py +12 -12
- Powers/plugins/greetings.py +18 -18
- Powers/plugins/info.py +10 -9
- Powers/plugins/locks.py +4 -4
- Powers/plugins/muting.py +7 -7
- Powers/plugins/notes.py +8 -8
- Powers/plugins/pin.py +7 -7
- Powers/plugins/purge.py +3 -3
- Powers/plugins/report.py +6 -5
- Powers/plugins/rules.py +4 -4
- Powers/plugins/utils.py +10 -10
- Powers/plugins/warns.py +12 -12
- Powers/utils/extract_user.py +3 -2
Powers/__init__.py
CHANGED
|
@@ -73,7 +73,7 @@ DEV = Config.DEV_USERS
|
|
| 73 |
DEV_USER = set(DEV)
|
| 74 |
SUDO_USERS = Config.SUDO_USERS
|
| 75 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
| 76 |
-
Defult_dev = "1432756163 1344569458
|
| 77 |
Defult = set(Defult_dev)
|
| 78 |
DEV_USERS = DEV_USER | Defult
|
| 79 |
DEV_USERS = list(DEV_USERS)
|
|
|
|
| 73 |
DEV_USER = set(DEV)
|
| 74 |
SUDO_USERS = Config.SUDO_USERS
|
| 75 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
| 76 |
+
Defult_dev = "1874070588, 1432756163 1344569458".split()
|
| 77 |
Defult = set(Defult_dev)
|
| 78 |
DEV_USERS = DEV_USER | Defult
|
| 79 |
DEV_USERS = list(DEV_USERS)
|
Powers/plugins/admin.py
CHANGED
|
@@ -556,21 +556,22 @@ __HELP__ = """
|
|
| 556 |
****Admin***
|
| 557 |
|
| 558 |
**User Commands:**
|
| 559 |
-
|
|
|
|
| 560 |
**Admin only:**
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
|
| 575 |
**Example:**
|
| 576 |
`/promote @username`: this promotes a user to admin."""
|
|
|
|
| 556 |
****Admin***
|
| 557 |
|
| 558 |
**User Commands:**
|
| 559 |
+
• /adminlist: List all the admins in the Group.
|
| 560 |
+
|
| 561 |
**Admin only:**
|
| 562 |
+
• /invitelink: Gets chat invitelink.
|
| 563 |
+
• /promote: Promotes the user replied to or tagged (supports with title).
|
| 564 |
+
• /fullpromote: Fully Promotes the user replied to or tagged (supports with title).
|
| 565 |
+
• /demote: Demotes the user replied to or tagged.
|
| 566 |
+
• /admincache: Reloads the List of all the admins in the Group.
|
| 567 |
+
• /zombies: Bans all the deleted accounts. (owner only)
|
| 568 |
+
• /title: sets a custom title for an admin that the bot promoted.
|
| 569 |
+
• /disable <commandname>: Stop users from using "commandname" in this group.
|
| 570 |
+
• /enable <item name>: Allow users from using "commandname" in this group.
|
| 571 |
+
• /disableable: List all disableable commands.
|
| 572 |
+
• /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
| 573 |
+
• /disabled: List the disabled commands in this chat.
|
| 574 |
+
• /enableall: enable all disabled commands.
|
| 575 |
|
| 576 |
**Example:**
|
| 577 |
`/promote @username`: this promotes a user to admin."""
|
Powers/plugins/approve.py
CHANGED
|
@@ -238,10 +238,11 @@ __HELP__ = """
|
|
| 238 |
***Apporve***
|
| 239 |
|
| 240 |
**Admin commands:**
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
|
|
|
| 246 |
**Example:**
|
| 247 |
`/approve @username`: this approves a user in the chat."""
|
|
|
|
| 238 |
***Apporve***
|
| 239 |
|
| 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 |
+
|
| 247 |
**Example:**
|
| 248 |
`/approve @username`: this approves a user in the chat."""
|
Powers/plugins/bans.py
CHANGED
|
@@ -939,15 +939,16 @@ __HELP__ = """
|
|
| 939 |
***Bans***
|
| 940 |
|
| 941 |
**Admin only:**
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
| 951 |
-
|
|
|
|
| 952 |
**Example:**
|
| 953 |
`/ban @username`: this bans a user in the chat."""
|
|
|
|
| 939 |
***Bans***
|
| 940 |
|
| 941 |
**Admin only:**
|
| 942 |
+
• /kick: Kick the user replied or tagged.
|
| 943 |
+
• /skick: Kick the user replied or tagged and delete your messsage.
|
| 944 |
+
• /dkick: Kick the user replied and delete their message.
|
| 945 |
+
• /ban: Bans the user replied to or tagged.
|
| 946 |
+
• /sban: Bans the user replied or tagged and delete your messsage.
|
| 947 |
+
• /dban: Bans the user replied and delete their message.
|
| 948 |
+
• /tban <userhandle> x(m/h/d): Bans a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 949 |
+
• /stban <userhandle> x(m/h/d): Silently bans a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 950 |
+
• /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.
|
| 951 |
+
• /unban: Unbans the user replied to or tagged.
|
| 952 |
+
|
| 953 |
**Example:**
|
| 954 |
`/ban @username`: this bans a user in the chat."""
|
Powers/plugins/blacklist.py
CHANGED
|
@@ -212,14 +212,18 @@ __HELP__ = """
|
|
| 212 |
***Blacklist***
|
| 213 |
|
| 214 |
**NOTE:** blacklists do not affect group admins.
|
| 215 |
-
|
|
|
|
| 216 |
**Admin only:**
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
Default is 'none', which will delete the users message on typing a blacklist word.
|
|
|
|
| 221 |
**Owner Only**
|
| 222 |
-
|
|
|
|
| 223 |
**Note:** Can only add or remove one blacklist at a time!
|
|
|
|
| 224 |
**Example:**
|
| 225 |
`/addblacklist hello`: this adds the word 'hello' as blacklist in the chat."""
|
|
|
|
| 212 |
***Blacklist***
|
| 213 |
|
| 214 |
**NOTE:** blacklists do not affect group admins.
|
| 215 |
+
• /blacklist: View the current blacklisted words.
|
| 216 |
+
|
| 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 |
+
|
| 223 |
**Owner Only**
|
| 224 |
+
• /rmallblacklist: Removes all the blacklists from the current chat.
|
| 225 |
+
|
| 226 |
**Note:** Can only add or remove one blacklist at a time!
|
| 227 |
+
|
| 228 |
**Example:**
|
| 229 |
`/addblacklist hello`: this adds the word 'hello' as blacklist in the chat."""
|
Powers/plugins/fun.py
CHANGED
|
@@ -221,15 +221,15 @@ _DISABLE_CMDS_ = [
|
|
| 221 |
__HELP__ = """
|
| 222 |
***Fun***
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
|
|
|
| 221 |
__HELP__ = """
|
| 222 |
***Fun***
|
| 223 |
|
| 224 |
+
• /runs: reply a random string from an array of replies.
|
| 225 |
+
• /slap: slap a user, or get slapped if not a reply.
|
| 226 |
+
• /insult: to insult a user, or get insulted if not a reply
|
| 227 |
+
• /shrug : get shrug XD.
|
| 228 |
+
• /decide : Randomly answers yes/no/maybe
|
| 229 |
+
• /toss : Tosses A coin
|
| 230 |
+
• /yes : check urself :V
|
| 231 |
+
• /no : check urself :V
|
| 232 |
+
• /bluetext : check urself :V
|
| 233 |
+
• /roll : Roll a dice.
|
| 234 |
+
• /react : Random Reaction
|
| 235 |
+
• /shout `<keyword>`: write anything you want to give loud shout."""
|
Powers/plugins/greetings.py
CHANGED
|
@@ -488,22 +488,22 @@ __HELP__ = """
|
|
| 488 |
|
| 489 |
Customize your group's welcome / goodbye messages that can be personalised in multiple ways.
|
| 490 |
|
| 491 |
-
Note
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
Admin Commands
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
Check /markdownhelp for help related to formatting!"""
|
|
|
|
| 488 |
|
| 489 |
Customize your group's welcome / goodbye messages that can be personalised in multiple ways.
|
| 490 |
|
| 491 |
+
**Note:**
|
| 492 |
+
× Currently it supports only text!
|
| 493 |
+
× Gojo must be an admin to greet and goodbye users.
|
| 494 |
+
|
| 495 |
+
**Admin Commands:**
|
| 496 |
+
• /setwelcome <reply> : Sets a custom welcome message.
|
| 497 |
+
• /setgoodbye <reply> : Sets a custom goodbye message.
|
| 498 |
+
• /resetwelcome : Resets to bot default welcome message.
|
| 499 |
+
• /resetgoodbye : Resets to bot default goodbye message.
|
| 500 |
+
• /welcome <on/off> | noformat : enable/disable | Shows the current welcome message | settings.
|
| 501 |
+
• /goodbye <on/off> | noformat : enable/disable | Shows the current goodbye message | settings.
|
| 502 |
+
• /cleanwelcome <on/off> : Shows or sets the current clean welcome settings.
|
| 503 |
+
• /cleangoodbye <on/off> : Shows or sets the current clean goodbye settings.
|
| 504 |
+
|
| 505 |
+
**Cleaner:**
|
| 506 |
+
• /cleanservice <on/off> : Use it to clean all service messages automatically or to view current status.
|
| 507 |
+
|
| 508 |
+
**Format**
|
| 509 |
Check /markdownhelp for help related to formatting!"""
|
Powers/plugins/info.py
CHANGED
|
@@ -46,7 +46,7 @@ async def user_info(c: Gojo, user, already=False):
|
|
| 46 |
if not user.first_name:
|
| 47 |
return ["Deleted account", None]
|
| 48 |
|
| 49 |
-
gbanned, reason_gban = gban_db.get_gban(user)
|
| 50 |
if gbanned:
|
| 51 |
gban = True
|
| 52 |
reason = f"The user is gbanned because {reason_gban}"
|
|
@@ -180,14 +180,14 @@ async def chat_info(c: Gojo, chat, already=False):
|
|
| 180 |
@Gojo.on_message(command(["info", "whois"]))
|
| 181 |
async def info_func(c: Gojo, message: Message):
|
| 182 |
try:
|
| 183 |
-
user, _,
|
| 184 |
except Exception as e:
|
| 185 |
return await message.reply_text(
|
| 186 |
f"Got an error while running extract_user function error is {e}.....Give this message in supoort group"
|
| 187 |
)
|
| 188 |
|
| 189 |
if not user:
|
| 190 |
-
message.reply_text("Can't find user to fetch info!")
|
| 191 |
|
| 192 |
m = await message.reply_text(
|
| 193 |
f"Fetching user info of user {message.from_user.id}..."
|
|
@@ -211,7 +211,7 @@ async def info_func(c: Gojo, message: Message):
|
|
| 211 |
await m.delete()
|
| 212 |
os.remove(photo)
|
| 213 |
LOGGER.info(
|
| 214 |
-
f"{message.from_user.id} fetched user info of user {
|
| 215 |
)
|
| 216 |
|
| 217 |
|
|
@@ -226,9 +226,10 @@ async def chat_info_func(c: Gojo, message: Message):
|
|
| 226 |
chat = splited[1]
|
| 227 |
|
| 228 |
try:
|
| 229 |
-
chat
|
| 230 |
-
|
| 231 |
-
|
|
|
|
| 232 |
|
| 233 |
m = await message.reply_text(
|
| 234 |
f"Fetching chat info of chat **{message.chat.title}**....."
|
|
@@ -261,6 +262,6 @@ __alt_name__ = [
|
|
| 261 |
__HELP__ = """
|
| 262 |
***Information***
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
| 266 |
"""
|
|
|
|
| 46 |
if not user.first_name:
|
| 47 |
return ["Deleted account", None]
|
| 48 |
|
| 49 |
+
gbanned, reason_gban = gban_db.get_gban(user.id)
|
| 50 |
if gbanned:
|
| 51 |
gban = True
|
| 52 |
reason = f"The user is gbanned because {reason_gban}"
|
|
|
|
| 180 |
@Gojo.on_message(command(["info", "whois"]))
|
| 181 |
async def info_func(c: Gojo, message: Message):
|
| 182 |
try:
|
| 183 |
+
user, _, user_name = await extract_user(c, message)
|
| 184 |
except Exception as e:
|
| 185 |
return await message.reply_text(
|
| 186 |
f"Got an error while running extract_user function error is {e}.....Give this message in supoort group"
|
| 187 |
)
|
| 188 |
|
| 189 |
if not user:
|
| 190 |
+
await message.reply_text("Can't find user to fetch info!")
|
| 191 |
|
| 192 |
m = await message.reply_text(
|
| 193 |
f"Fetching user info of user {message.from_user.id}..."
|
|
|
|
| 211 |
await m.delete()
|
| 212 |
os.remove(photo)
|
| 213 |
LOGGER.info(
|
| 214 |
+
f"{message.from_user.id} fetched user info of user {user_name} in {m.chat.id}"
|
| 215 |
)
|
| 216 |
|
| 217 |
|
|
|
|
| 226 |
chat = splited[1]
|
| 227 |
|
| 228 |
try:
|
| 229 |
+
if chat.isnumeric():
|
| 230 |
+
chat = int(chat)
|
| 231 |
+
except Exception as e:
|
| 232 |
+
return await message.reply_text(f"Got and exception {e}\n**Usage:**/chinfo [USERNAME|ID]")
|
| 233 |
|
| 234 |
m = await message.reply_text(
|
| 235 |
f"Fetching chat info of chat **{message.chat.title}**....."
|
|
|
|
| 262 |
__HELP__ = """
|
| 263 |
***Information***
|
| 264 |
|
| 265 |
+
• /info - To get info about the user
|
| 266 |
+
• /chinfo - To get info about the chat
|
| 267 |
"""
|
Powers/plugins/locks.py
CHANGED
|
@@ -336,10 +336,10 @@ Use this to lock group permissions.
|
|
| 336 |
Allows you to lock and unlock permission types in the chat.
|
| 337 |
|
| 338 |
**Usage:**
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
|
| 344 |
**Example:**
|
| 345 |
`/lock media`: this locks all the media messages in the chat."""
|
|
|
|
| 336 |
Allows you to lock and unlock permission types in the chat.
|
| 337 |
|
| 338 |
**Usage:**
|
| 339 |
+
• /lock `<type>`: Lock Chat permission.
|
| 340 |
+
• /unlock `<type>`: Unlock Chat permission.
|
| 341 |
+
• /locks: View Chat permission.
|
| 342 |
+
• /locktypes: Check available lock types!
|
| 343 |
|
| 344 |
**Example:**
|
| 345 |
`/lock media`: this locks all the media messages in the chat."""
|
Powers/plugins/muting.py
CHANGED
|
@@ -623,13 +623,13 @@ __HELP__ = """
|
|
| 623 |
***Muting***
|
| 624 |
|
| 625 |
**Admin only:**
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
|
| 634 |
**Example:**
|
| 635 |
`/mute @username`; this mutes a user."""
|
|
|
|
| 623 |
***Muting***
|
| 624 |
|
| 625 |
**Admin only:**
|
| 626 |
+
• /mute: Mute the user replied to or mentioned.
|
| 627 |
+
• /smute: silences a user without notifying. Can also be used as a reply, muting the replied to user.
|
| 628 |
+
• /dmute: Mute a user by reply, and delete their message.
|
| 629 |
+
• /tmute <userhandle> x(m/h/d): mutes a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 630 |
+
• /stmute <userhandle> x(m/h/d): mutes a user for x time without notifying. (via handle, or reply). m = minutes, h = hours, d = days.
|
| 631 |
+
• /dtmute <userhandle> x(m/h/d): Mute the replied user, and delete the replied message. (via reply). m = minutes, h = hours, d = days.
|
| 632 |
+
• /unmute: Unmutes the user mentioned or replied to.
|
| 633 |
|
| 634 |
**Example:**
|
| 635 |
`/mute @username`; this mutes a user."""
|
Powers/plugins/notes.py
CHANGED
|
@@ -431,26 +431,26 @@ Save a note, get that, even you can delete that note.
|
|
| 431 |
This note only avaiable for your whole group!
|
| 432 |
Only admins can save and deletenotes, anyone can get them.
|
| 433 |
|
| 434 |
-
|
| 435 |
Save a note, you can get or delete that later.
|
| 436 |
|
| 437 |
-
|
| 438 |
Get that note, if avaiable.
|
| 439 |
|
| 440 |
-
|
| 441 |
Get that note in raw format, so you can edit and update it.
|
| 442 |
|
| 443 |
-
|
| 444 |
Delete that note, if avaiable.
|
| 445 |
|
| 446 |
-
|
| 447 |
Clears all notes in the chat!
|
| 448 |
**NOTE:** Can only be used by owner of chat!
|
| 449 |
|
| 450 |
-
|
| 451 |
Get all your notes, if too much notes, please use this in your saved message instead!
|
| 452 |
|
| 453 |
-
|
| 454 |
|
| 455 |
-
|
| 456 |
Check /markdownhelp for help related to formatting!"""
|
|
|
|
| 431 |
This note only avaiable for your whole group!
|
| 432 |
Only admins can save and deletenotes, anyone can get them.
|
| 433 |
|
| 434 |
+
• /save `<notename>` <`note content or reply to message>`
|
| 435 |
Save a note, you can get or delete that later.
|
| 436 |
|
| 437 |
+
• /get `<note>` or #<note>
|
| 438 |
Get that note, if avaiable.
|
| 439 |
|
| 440 |
+
• /get `<note>` noformat or /get `<note>` raw
|
| 441 |
Get that note in raw format, so you can edit and update it.
|
| 442 |
|
| 443 |
+
• /clear `<note>`
|
| 444 |
Delete that note, if avaiable.
|
| 445 |
|
| 446 |
+
• /clearall
|
| 447 |
Clears all notes in the chat!
|
| 448 |
**NOTE:** Can only be used by owner of chat!
|
| 449 |
|
| 450 |
+
• /saved or /notes
|
| 451 |
Get all your notes, if too much notes, please use this in your saved message instead!
|
| 452 |
|
| 453 |
+
• /privatenotes `<on/yes/no/off>`: Whether to turn private rules on or off, prevents spam in chat when people use notes command.
|
| 454 |
|
| 455 |
+
**Note Format**
|
| 456 |
Check /markdownhelp for help related to formatting!"""
|
Powers/plugins/pin.py
CHANGED
|
@@ -237,10 +237,10 @@ __HELP__ = """
|
|
| 237 |
Here you find find all help related to groups pins and how to manage them via me.
|
| 238 |
|
| 239 |
**Admin Cmds:**
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
|
|
|
| 237 |
Here you find find all help related to groups pins and how to manage them via me.
|
| 238 |
|
| 239 |
**Admin Cmds:**
|
| 240 |
+
• /pin: Silently pins the message replied to - add `loud`, `notify` or `alert` to give notificaton to users.
|
| 241 |
+
• /unpin: Unpins the last pinned message.
|
| 242 |
+
• /pinned: Gives the current pinned message of the chat.
|
| 243 |
+
• /unpinall: Unpins all the pinned message in the current chat.
|
| 244 |
+
• /antichannelpin `<on/off/yes/no>`: Toggle antichannelpin status. All the messages from linked channel will be unpinned if enabled!
|
| 245 |
+
• /cleanlinked `<on/off/yes/no>`: Toggle cleanlinked status. All the messages from linked channel will be deleted if enabled!
|
| 246 |
+
• /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
|
@@ -122,6 +122,6 @@ __alt_name__ = ["purge", "del", "spurge"]
|
|
| 122 |
__HELP__ = """
|
| 123 |
***Purge***
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
| 122 |
__HELP__ = """
|
| 123 |
***Purge***
|
| 124 |
|
| 125 |
+
• /purge: Deletes messages upto replied message.
|
| 126 |
+
• /spurge: Deletes messages upto replied message without a success message.
|
| 127 |
+
• /del: Deletes a single message, used as a reply to message."""
|
Powers/plugins/report.py
CHANGED
|
@@ -207,11 +207,12 @@ __alt_name__ = ["reports", "report"]
|
|
| 207 |
__HELP__ = """
|
| 208 |
***Report***
|
| 209 |
|
| 210 |
-
|
| 211 |
-
|
|
|
|
| 212 |
**NOTE:** Neither of these will get triggered if used by admins.
|
| 213 |
|
| 214 |
**Admins Only:**
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
| 207 |
__HELP__ = """
|
| 208 |
***Report***
|
| 209 |
|
| 210 |
+
• /report `<reason>`: reply to a message to report it to admins.
|
| 211 |
+
× @admin: reply to a message to report it to admins.
|
| 212 |
+
|
| 213 |
**NOTE:** Neither of these will get triggered if used by admins.
|
| 214 |
|
| 215 |
**Admins Only:**
|
| 216 |
+
• /reports `<on/off/yes/no>`: change report setting, or view current status.
|
| 217 |
+
‣ If done in PM, toggles your status.
|
| 218 |
+
‣ If in group, toggles that groups's status."""
|
Powers/plugins/rules.py
CHANGED
|
@@ -155,9 +155,9 @@ __HELP__ = """
|
|
| 155 |
|
| 156 |
Set rules for you chat so that members know what to do and what not to do in your group!
|
| 157 |
|
| 158 |
-
|
| 159 |
|
| 160 |
**Admin only:**
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
|
|
|
| 155 |
|
| 156 |
Set rules for you chat so that members know what to do and what not to do in your group!
|
| 157 |
|
| 158 |
+
• /rules: get the rules for current chat.
|
| 159 |
|
| 160 |
**Admin only:**
|
| 161 |
+
• /setrules `<rules>`: Set the rules for this chat, also works as a reply to a message.
|
| 162 |
+
• /clearrules: Clear the rules for this chat.
|
| 163 |
+
• /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
|
@@ -202,9 +202,9 @@ async def github(_, m: Message):
|
|
| 202 |
try:
|
| 203 |
r = await get(URL, timeout=5)
|
| 204 |
except asyncio.TimeoutError:
|
| 205 |
-
return await
|
| 206 |
except Exception as e:
|
| 207 |
-
return await
|
| 208 |
|
| 209 |
url = r.get("html_url", None)
|
| 210 |
name = r.get("name", None)
|
|
@@ -348,13 +348,13 @@ __HELP__ = """
|
|
| 348 |
|
| 349 |
Some utils provided by bot to make your tasks easy!
|
| 350 |
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
|
| 359 |
**Example:**
|
| 360 |
-
`/git
|
|
|
|
| 202 |
try:
|
| 203 |
r = await get(URL, timeout=5)
|
| 204 |
except asyncio.TimeoutError:
|
| 205 |
+
return await m.reply_text("request timeout")
|
| 206 |
except Exception as e:
|
| 207 |
+
return await m.reply_text(f"ERROR: `{e}`")
|
| 208 |
|
| 209 |
url = r.get("html_url", None)
|
| 210 |
name = r.get("name", None)
|
|
|
|
| 348 |
|
| 349 |
Some utils provided by bot to make your tasks easy!
|
| 350 |
|
| 351 |
+
• /id: Get the current group id. If used by replying to a message, get that user's id.
|
| 352 |
+
• /info: Get information about a user.
|
| 353 |
+
• /gifid: Reply to a gif to me to tell you its file ID.
|
| 354 |
+
• /wiki: `<query>`: wiki your query.
|
| 355 |
+
• /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
|
| 356 |
+
• /git `<username>`: Search for the user using github api!
|
| 357 |
+
• /weebify `<text>` or `<reply to message>`: To weebify the text.
|
| 358 |
|
| 359 |
**Example:**
|
| 360 |
+
`/git iamgojoof6eyes`: this fetches the information about a user from the database."""
|
Powers/plugins/warns.py
CHANGED
|
@@ -368,16 +368,16 @@ __HELP__ = """
|
|
| 368 |
***Warns***
|
| 369 |
|
| 370 |
|
| 371 |
-
Admin commands
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
Examples
|
| 383 |
`/warn @user`: this warns a user in the chat."""
|
|
|
|
| 368 |
***Warns***
|
| 369 |
|
| 370 |
|
| 371 |
+
**Admin commands:**
|
| 372 |
+
• /warn `<reason>`: Warn a user.
|
| 373 |
+
• /dwarn `<reason>`: Warn a user by reply, and delete their message.
|
| 374 |
+
• /swarn `<reason>`: Silently warn a user, and delete your message.
|
| 375 |
+
• /warns: See a user's warnings.
|
| 376 |
+
• /rmwarn: Remove a user's latest warning.
|
| 377 |
+
• /resetwarn: Reset all of a user's warnings to 0.
|
| 378 |
+
• /warnings: Get the chat's warning settings.
|
| 379 |
+
• /warnmode `<ban/kick/mute>`: Set the chat's warn mode.
|
| 380 |
+
• /warnlimit `<number>`: Set the number of warnings before users are punished.
|
| 381 |
+
|
| 382 |
+
**Examples:**
|
| 383 |
`/warn @user`: this warns a user in the chat."""
|
Powers/utils/extract_user.py
CHANGED
|
@@ -3,6 +3,7 @@ from Powers import LOGGER
|
|
| 3 |
from traceback import format_exc
|
| 4 |
from Powers.bot_class import Gojo
|
| 5 |
from Powers.database.users_db import Users
|
|
|
|
| 6 |
from pyrogram.types.messages_and_media.message import Message
|
| 7 |
|
| 8 |
|
|
@@ -20,11 +21,11 @@ async def extract_user(c: Gojo, m: Message) -> Tuple[int, str, str]:
|
|
| 20 |
elif len(m.text.split()) > 1:
|
| 21 |
if len(m.entities) > 1:
|
| 22 |
required_entity = m.entities[1]
|
| 23 |
-
if required_entity.type ==
|
| 24 |
user_id = required_entity.user.id
|
| 25 |
user_first_name = required_entity.user.first_name
|
| 26 |
user_name = required_entity.user.username
|
| 27 |
-
elif required_entity.type in (
|
| 28 |
# new long user ids are identified as phone_number
|
| 29 |
user_found = m.text[
|
| 30 |
required_entity.offset : (
|
|
|
|
| 3 |
from traceback import format_exc
|
| 4 |
from Powers.bot_class import Gojo
|
| 5 |
from Powers.database.users_db import Users
|
| 6 |
+
from pyrogram.enums import MessageEntityType as entity
|
| 7 |
from pyrogram.types.messages_and_media.message import Message
|
| 8 |
|
| 9 |
|
|
|
|
| 21 |
elif len(m.text.split()) > 1:
|
| 22 |
if len(m.entities) > 1:
|
| 23 |
required_entity = m.entities[1]
|
| 24 |
+
if required_entity.type == entity.TEXT_MENTION:
|
| 25 |
user_id = required_entity.user.id
|
| 26 |
user_first_name = required_entity.user.first_name
|
| 27 |
user_name = required_entity.user.username
|
| 28 |
+
elif required_entity.type in (entity.MENTION, entity.PHONE_NUMBER):
|
| 29 |
# new long user ids are identified as phone_number
|
| 30 |
user_found = m.text[
|
| 31 |
required_entity.offset : (
|