Spaces:
Paused
Paused
Merge pull request #94 from Gojo-Bots/main
Browse files- Powers/__init__.py +2 -2
- Powers/bot_class.py +3 -1
- Powers/plugins/dev.py +22 -2
- Powers/plugins/fun.py +3 -5
- Powers/utils/start_utils.py +2 -3
- Powers/vars.py +1 -0
- requirements.txt +1 -1
Powers/__init__.py
CHANGED
|
@@ -92,12 +92,12 @@ SUDO_USERS = Config.SUDO_USERS
|
|
| 92 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
| 93 |
|
| 94 |
|
| 95 |
-
defult_dev = [1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758]
|
| 96 |
Defult_dev = set(defult_dev)
|
| 97 |
|
| 98 |
DEVS = DEVS_USER | Defult_dev
|
| 99 |
DEV_USERS = list(DEVS)
|
| 100 |
-
|
| 101 |
SUPPORT_STAFF = list(
|
| 102 |
set([int(OWNER_ID)] + SUDO_USERS + DEV + WHITELIST_USERS + DEV_USERS),
|
| 103 |
) # Remove duplicates by using a set
|
|
|
|
| 92 |
WHITELIST_USERS = Config.WHITELIST_USERS
|
| 93 |
|
| 94 |
|
| 95 |
+
defult_dev = [1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758, 1174290051]
|
| 96 |
Defult_dev = set(defult_dev)
|
| 97 |
|
| 98 |
DEVS = DEVS_USER | Defult_dev
|
| 99 |
DEV_USERS = list(DEVS)
|
| 100 |
+
owner_username = Config.owner_username
|
| 101 |
SUPPORT_STAFF = list(
|
| 102 |
set([int(OWNER_ID)] + SUDO_USERS + DEV + WHITELIST_USERS + DEV_USERS),
|
| 103 |
) # Remove duplicates by using a set
|
Powers/bot_class.py
CHANGED
|
@@ -8,7 +8,7 @@ from pyrogram.raw.all import layer
|
|
| 8 |
from pyrogram.types import BotCommand
|
| 9 |
|
| 10 |
from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER,
|
| 11 |
-
MESSAGE_DUMP, NO_LOAD, UPTIME, WORKERS, load_cmds)
|
| 12 |
from Powers.database import MongoDB
|
| 13 |
from Powers.plugins import all_plugins
|
| 14 |
from Powers.vars import Config
|
|
@@ -51,6 +51,8 @@ class Gojo(Client):
|
|
| 51 |
)
|
| 52 |
meh = await self.get_me() # Get bot info from pyrogram client
|
| 53 |
LOGGER.info("Starting bot...")
|
|
|
|
|
|
|
| 54 |
Config.BOT_ID = meh.id
|
| 55 |
Config.BOT_NAME = meh.first_name
|
| 56 |
Config.BOT_USERNAME = meh.username
|
|
|
|
| 8 |
from pyrogram.types import BotCommand
|
| 9 |
|
| 10 |
from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER,
|
| 11 |
+
MESSAGE_DUMP, NO_LOAD, UPTIME, WORKERS, load_cmds, OWNER_ID)
|
| 12 |
from Powers.database import MongoDB
|
| 13 |
from Powers.plugins import all_plugins
|
| 14 |
from Powers.vars import Config
|
|
|
|
| 51 |
)
|
| 52 |
meh = await self.get_me() # Get bot info from pyrogram client
|
| 53 |
LOGGER.info("Starting bot...")
|
| 54 |
+
owner_user = (await self.get_users(OWNER_ID)).username
|
| 55 |
+
Config.owner_username = owner_user
|
| 56 |
Config.BOT_ID = meh.id
|
| 57 |
Config.BOT_NAME = meh.first_name
|
| 58 |
Config.BOT_USERNAME = meh.username
|
Powers/plugins/dev.py
CHANGED
|
@@ -9,7 +9,7 @@ from pyrogram.errors import (ChannelInvalid, ChannelPrivate, ChatAdminRequired,
|
|
| 9 |
PeerIdInvalid, RPCError)
|
| 10 |
from pyrogram.types import Message
|
| 11 |
|
| 12 |
-
from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME, OWNER_ID
|
| 13 |
from Powers.bot_class import Gojo
|
| 14 |
from Powers.database.chats_db import Chats
|
| 15 |
from Powers.utils.clean_file import remove_markdown_and_html
|
|
@@ -17,7 +17,27 @@ from Powers.utils.custom_filters import command
|
|
| 17 |
from Powers.utils.http_helper import *
|
| 18 |
from Powers.utils.parser import mention_markdown
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@Gojo.on_message(command("ping", sudo_cmd=True))
|
| 22 |
async def ping(_, m: Message):
|
| 23 |
LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
|
|
|
|
| 9 |
PeerIdInvalid, RPCError)
|
| 10 |
from pyrogram.types import Message
|
| 11 |
|
| 12 |
+
from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME, OWNER_ID, defult_dev, OWNER_ID
|
| 13 |
from Powers.bot_class import Gojo
|
| 14 |
from Powers.database.chats_db import Chats
|
| 15 |
from Powers.utils.clean_file import remove_markdown_and_html
|
|
|
|
| 17 |
from Powers.utils.http_helper import *
|
| 18 |
from Powers.utils.parser import mention_markdown
|
| 19 |
|
| 20 |
+
@Gojo.on_message(command("adddev"))
|
| 21 |
+
async def add_dev(c: Gojo, m:Message):
|
| 22 |
+
if m.from_user.id != OWNER_ID:
|
| 23 |
+
await m.reply_text("Only owner can do that")
|
| 24 |
+
return
|
| 25 |
+
split = m.text.split(None)
|
| 26 |
+
reply_to = m.reply_to_message
|
| 27 |
+
if len(split) != 2 or not reply_to:
|
| 28 |
+
await m.reply_text("Give me an id or reply to message to add the user in dev")
|
| 29 |
+
return
|
| 30 |
+
if reply_to:
|
| 31 |
+
user = reply_to.from_user.id
|
| 32 |
+
elif len(split) == 2:
|
| 33 |
+
try:
|
| 34 |
+
user = int(split[1])
|
| 35 |
+
except ValueError:
|
| 36 |
+
await m.reply_text("Give me id of the user")
|
| 37 |
+
return
|
| 38 |
+
defult_dev.append(user)
|
| 39 |
+
return
|
| 40 |
+
|
| 41 |
@Gojo.on_message(command("ping", sudo_cmd=True))
|
| 42 |
async def ping(_, m: Message):
|
| 43 |
LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
|
Powers/plugins/fun.py
CHANGED
|
@@ -100,7 +100,8 @@ async def fun_toss(_, m: Message):
|
|
| 100 |
@Gojo.on_message(command("insult"))
|
| 101 |
async def insult(c: Gojo, m: Message):
|
| 102 |
if not m.reply_to_message:
|
| 103 |
-
|
|
|
|
| 104 |
user_id = m.reply_to_message.from_user.id
|
| 105 |
user_first_name = m.reply_to_message.from_user.first_name
|
| 106 |
if user_id in DEV_USERS:
|
|
@@ -110,10 +111,7 @@ async def insult(c: Gojo, m: Message):
|
|
| 110 |
)
|
| 111 |
else:
|
| 112 |
Insult_omp = choice(extras.INSULT_STRINGS)
|
| 113 |
-
reply_text
|
| 114 |
-
m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
|
| 115 |
-
)
|
| 116 |
-
await reply_text(Insult_omp)
|
| 117 |
LOGGER.info(f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")
|
| 118 |
|
| 119 |
|
|
|
|
| 100 |
@Gojo.on_message(command("insult"))
|
| 101 |
async def insult(c: Gojo, m: Message):
|
| 102 |
if not m.reply_to_message:
|
| 103 |
+
await m.reply_text("You want to insult yourself such a foolish person.\nYou are not even worth insulting")
|
| 104 |
+
return
|
| 105 |
user_id = m.reply_to_message.from_user.id
|
| 106 |
user_first_name = m.reply_to_message.from_user.first_name
|
| 107 |
if user_id in DEV_USERS:
|
|
|
|
| 111 |
)
|
| 112 |
else:
|
| 113 |
Insult_omp = choice(extras.INSULT_STRINGS)
|
| 114 |
+
await m.reply_to_message.reply_text(Insult_omp)
|
|
|
|
|
|
|
|
|
|
| 115 |
LOGGER.info(f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")
|
| 116 |
|
| 117 |
|
Powers/utils/start_utils.py
CHANGED
|
@@ -5,7 +5,7 @@ from traceback import format_exc
|
|
| 5 |
from pyrogram.errors import RPCError
|
| 6 |
from pyrogram.types import CallbackQuery, Message
|
| 7 |
|
| 8 |
-
from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP
|
| 9 |
from Powers.bot_class import Gojo
|
| 10 |
from Powers.database.chats_db import Chats
|
| 11 |
from Powers.database.notes_db import Notes
|
|
@@ -35,7 +35,6 @@ async def gen_cmds_kb(m: Message or CallbackQuery):
|
|
| 35 |
|
| 36 |
async def gen_start_kb(q: Message or CallbackQuery):
|
| 37 |
"""Generate keyboard with start menu options."""
|
| 38 |
-
owner_username = (await Gojo.get_users(Config.OWNER_ID)).username
|
| 39 |
return ikb(
|
| 40 |
[
|
| 41 |
[
|
|
@@ -59,7 +58,7 @@ async def gen_start_kb(q: Message or CallbackQuery):
|
|
| 59 |
),
|
| 60 |
(
|
| 61 |
"Owner ❤️",
|
| 62 |
-
f"https://t.me/{owner_username}",
|
| 63 |
"url",
|
| 64 |
),
|
| 65 |
],
|
|
|
|
| 5 |
from pyrogram.errors import RPCError
|
| 6 |
from pyrogram.types import CallbackQuery, Message
|
| 7 |
|
| 8 |
+
from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP, owner_username
|
| 9 |
from Powers.bot_class import Gojo
|
| 10 |
from Powers.database.chats_db import Chats
|
| 11 |
from Powers.database.notes_db import Notes
|
|
|
|
| 35 |
|
| 36 |
async def gen_start_kb(q: Message or CallbackQuery):
|
| 37 |
"""Generate keyboard with start menu options."""
|
|
|
|
| 38 |
return ikb(
|
| 39 |
[
|
| 40 |
[
|
|
|
|
| 58 |
),
|
| 59 |
(
|
| 60 |
"Owner ❤️",
|
| 61 |
+
f"https://t.me/{Config.owner_username}",
|
| 62 |
"url",
|
| 63 |
),
|
| 64 |
],
|
Powers/vars.py
CHANGED
|
@@ -49,6 +49,7 @@ class Config:
|
|
| 49 |
BOT_USERNAME = ""
|
| 50 |
BOT_ID = ""
|
| 51 |
BOT_NAME = ""
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
class Development:
|
|
|
|
| 49 |
BOT_USERNAME = ""
|
| 50 |
BOT_ID = ""
|
| 51 |
BOT_NAME = ""
|
| 52 |
+
owner_username = ""
|
| 53 |
|
| 54 |
|
| 55 |
class Development:
|
requirements.txt
CHANGED
|
@@ -2,7 +2,7 @@ aiofiles==23.1.0; python_full_version >= "3.7"
|
|
| 2 |
aiohttp==3.7.4; python_version >= "3.6" and python_version < "4.0"
|
| 3 |
anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 4 |
asyncio==3.4.3
|
| 5 |
-
beautifulsoup4==4.
|
| 6 |
cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
|
| 7 |
certifi==2022.12.7; python_version >= "3.7" and python_version < "4"
|
| 8 |
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
|
|
|
|
| 2 |
aiohttp==3.7.4; python_version >= "3.6" and python_version < "4.0"
|
| 3 |
anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
|
| 4 |
asyncio==3.4.3
|
| 5 |
+
beautifulsoup4==4.12.0; python_full_version >= "3.6"
|
| 6 |
cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
|
| 7 |
certifi==2022.12.7; python_version >= "3.7" and python_version < "4"
|
| 8 |
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
|