Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #94

Merged
merged 15 commits into from
Mar 25, 2023
4 changes: 2 additions & 2 deletions Powers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
WHITELIST_USERS = Config.WHITELIST_USERS


defult_dev = [1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758]
defult_dev = [1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758, 1174290051]
Defult_dev = set(defult_dev)

DEVS = DEVS_USER | Defult_dev
DEV_USERS = list(DEVS)

owner_username = Config.owner_username
SUPPORT_STAFF = list(
set([int(OWNER_ID)] + SUDO_USERS + DEV + WHITELIST_USERS + DEV_USERS),
) # Remove duplicates by using a set
Expand Down
4 changes: 3 additions & 1 deletion Powers/bot_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pyrogram.types import BotCommand

from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER,
MESSAGE_DUMP, NO_LOAD, UPTIME, WORKERS, load_cmds)
MESSAGE_DUMP, NO_LOAD, UPTIME, WORKERS, load_cmds, OWNER_ID)
from Powers.database import MongoDB
from Powers.plugins import all_plugins
from Powers.vars import Config
Expand Down Expand Up @@ -51,6 +51,8 @@ async def start(self):
)
meh = await self.get_me() # Get bot info from pyrogram client
LOGGER.info("Starting bot...")
owner_user = (await self.get_users(OWNER_ID)).username
Config.owner_username = owner_user
Config.BOT_ID = meh.id
Config.BOT_NAME = meh.first_name
Config.BOT_USERNAME = meh.username
Expand Down
24 changes: 22 additions & 2 deletions Powers/plugins/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,35 @@
PeerIdInvalid, RPCError)
from pyrogram.types import Message

from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME, OWNER_ID
from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME, OWNER_ID, defult_dev, OWNER_ID
from Powers.bot_class import Gojo
from Powers.database.chats_db import Chats
from Powers.utils.clean_file import remove_markdown_and_html
from Powers.utils.custom_filters import command
from Powers.utils.http_helper import *
from Powers.utils.parser import mention_markdown


@Gojo.on_message(command("adddev"))
async def add_dev(c: Gojo, m:Message):
if m.from_user.id != OWNER_ID:
await m.reply_text("Only owner can do that")
return
split = m.text.split(None)
reply_to = m.reply_to_message
if len(split) != 2 or not reply_to:
await m.reply_text("Give me an id or reply to message to add the user in dev")
return
if reply_to:
user = reply_to.from_user.id
elif len(split) == 2:
try:
user = int(split[1])
except ValueError:
await m.reply_text("Give me id of the user")
return
defult_dev.append(user)
return

@Gojo.on_message(command("ping", sudo_cmd=True))
async def ping(_, m: Message):
LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
Expand Down
8 changes: 3 additions & 5 deletions Powers/plugins/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ async def fun_toss(_, m: Message):
@Gojo.on_message(command("insult"))
async def insult(c: Gojo, m: Message):
if not m.reply_to_message:
return await m.reply_text("You want to insult yourself such a foolish person")
await m.reply_text("You want to insult yourself such a foolish person.\nYou are not even worth insulting")
return
user_id = m.reply_to_message.from_user.id
user_first_name = m.reply_to_message.from_user.first_name
if user_id in DEV_USERS:
Expand All @@ -110,10 +111,7 @@ async def insult(c: Gojo, m: Message):
)
else:
Insult_omp = choice(extras.INSULT_STRINGS)
reply_text = (
m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
)
await reply_text(Insult_omp)
await m.reply_to_message.reply_text(Insult_omp)
LOGGER.info(f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")


Expand Down
5 changes: 2 additions & 3 deletions Powers/utils/start_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pyrogram.errors import RPCError
from pyrogram.types import CallbackQuery, Message

from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP
from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP, owner_username
from Powers.bot_class import Gojo
from Powers.database.chats_db import Chats
from Powers.database.notes_db import Notes
Expand Down Expand Up @@ -35,7 +35,6 @@ async def gen_cmds_kb(m: Message or CallbackQuery):

async def gen_start_kb(q: Message or CallbackQuery):
"""Generate keyboard with start menu options."""
owner_username = (await Gojo.get_users(Config.OWNER_ID)).username
return ikb(
[
[
Expand All @@ -59,7 +58,7 @@ async def gen_start_kb(q: Message or CallbackQuery):
),
(
"Owner ❤️",
f"https://t.me/{owner_username}",
f"https://t.me/{Config.owner_username}",
"url",
),
],
Expand Down
1 change: 1 addition & 0 deletions Powers/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Config:
BOT_USERNAME = ""
BOT_ID = ""
BOT_NAME = ""
owner_username = ""


class Development:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aiofiles==23.1.0; python_full_version >= "3.7"
aiohttp==3.7.4; python_version >= "3.6" and python_version < "4.0"
anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
asyncio==3.4.3
beautifulsoup4==4.11.2; python_full_version >= "3.6"
beautifulsoup4==4.12.0; python_full_version >= "3.6"
cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
certifi==2022.12.7; python_version >= "3.7" and python_version < "4"
charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
Expand Down