Skip to content

Commit 837bec5

Browse files
Krishna-Singhalrking32Phyco-Ninja
authored
multi Owner id support (#190)
* fix f-string * multiple Owner Id Support * fixed for Multiple owner id support * some tweaks * added missing parameter in conversation.py (#192) * fix download TypeError + friendly method to handle downloads * fix showing unloaded and disabled plugins in help * deepsource fix * some cleanup + optimize upload plugin + fix promote * ignore updater issue * optimizing Co-authored-by: rking32 <sljohnwick@gmail.com> Co-authored-by: Phyco-Ninja <60768764+Phyco-Ninja@users.noreply.github.com>
1 parent 1eea59e commit 837bec5

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

userge/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Config:
3232
WORKERS = min(32, int(os.environ.get("WORKERS")) or os.cpu_count() + 4)
3333
BOT_TOKEN = os.environ.get("BOT_TOKEN", None)
3434
HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None)
35-
OWNER_ID = int(os.environ.get("OWNER_ID", 0))
35+
OWNER_ID = tuple(filter(lambda x: x, map(int, os.environ.get("OWNER_ID", "0").split())))
3636
LOG_CHANNEL_ID = int(os.environ.get("LOG_CHANNEL_ID"))
3737
DB_URI = os.environ.get("DATABASE_URL")
3838
LANG = os.environ.get("PREFERRED_LANGUAGE")

userge/core/types/raw/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def parse(cls, command: str, # pylint: disable=arguments-differ
6262
and not m.outgoing
6363
and trigger
6464
and m.from_user and m.text
65-
and ((m.from_user.id == Config.OWNER_ID)
65+
and ((m.from_user.id in Config.OWNER_ID)
6666
or (Config.SUDO_ENABLED and (m.from_user.id in Config.SUDO_USERS)
6767
and (cname.lstrip(trigger) in Config.ALLOWED_COMMANDS)))
6868
and m.text.startswith(Config.SUDO_TRIGGER))

userge/plugins/help.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def helpme(message: Message) -> None: # pylint: disable=missing-function-
8484
if userge.has_bot:
8585
def check_owner(func):
8686
async def wrapper(_, c_q: CallbackQuery):
87-
if c_q.from_user and c_q.from_user.id == Config.OWNER_ID:
87+
if c_q.from_user and c_q.from_user.id in Config.OWNER_ID:
8888
try:
8989
await func(c_q)
9090
except MessageNotModified:
@@ -93,7 +93,7 @@ async def wrapper(_, c_q: CallbackQuery):
9393
await c_q.answer("Sorry, I Don't Have Permissions to edit this 😔",
9494
show_alert=True)
9595
else:
96-
user_dict = await userge.bot.get_user_dict(Config.OWNER_ID)
96+
user_dict = await userge.bot.get_user_dict(Config.OWNER_ID[0])
9797
await c_q.answer(
9898
f"Only {user_dict['flname']} Can Access this...! Build Your Own @TheUserge 🤘",
9999
show_alert=True)
@@ -211,7 +211,7 @@ async def prvt_msg(_, c_q: CallbackQuery):
211211
await c_q.answer("message now outdated !", show_alert=True)
212212
return
213213
user_id, flname, msg = PRVT_MSGS[msg_id]
214-
if c_q.from_user.id == user_id or c_q.from_user.id == Config.OWNER_ID:
214+
if c_q.from_user.id == user_id or c_q.from_user.id in Config.OWNER_ID:
215215
await c_q.answer(msg, show_alert=True)
216216
else:
217217
await c_q.answer(
@@ -371,7 +371,7 @@ async def inline_answer(_, inline_query: InlineQuery):
371371
)
372372
)
373373
]
374-
if inline_query.from_user and inline_query.from_user.id == Config.OWNER_ID:
374+
if inline_query.from_user and inline_query.from_user.id in Config.OWNER_ID:
375375
results.append(
376376
InlineQueryResultArticle(
377377
id=uuid4(),

userge/plugins/utils/notes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async def get_note(message: Message) -> None:
171171
return
172172
can_access = message.from_user.is_self or message.from_user.id in Config.SUDO_USERS
173173
if Config.OWNER_ID:
174-
can_access = can_access or message.from_user.id == Config.OWNER_ID
174+
can_access = can_access or message.from_user.id in Config.OWNER_ID
175175
notename = message.matches[0].group(1).lower()
176176
mid, is_global = (0, False)
177177
for note in NOTES_DATA[message.chat.id]:

0 commit comments

Comments
 (0)