Skip to content

Commit

Permalink
optimize it for sudo users
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Feb 4, 2022
1 parent 096ac2c commit 287c8bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions userge/core/types/raw/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ def _public_logic(m: Message, trigger: str, _) -> bool:
return (
not m.edit_date
and (
True if not trigger else m.text.startswith(Config.CMD_TRIGGER)
if m.from_user and m.from_user.id in Config.OWNER_ID else m.text.startswith(trigger)
True if not trigger
else m.text.startswith(Config.CMD_TRIGGER)
if m.from_user and m.from_user.id in Config.OWNER_ID
else m.text.startswith(Config.SUDO_TRIGGER)
if Config.SUDO_ENABLED and m.from_user and m.from_user.id in Config.SUDO_USERS
else m.text.startswith(trigger)
)
)

Expand Down
2 changes: 1 addition & 1 deletion userge/plugins/utils/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async def mv_to_global_note(message: Message) -> None:
'usage': "#[notename]\nget notename"},
group=-1,
name="get_note",
trigger='',
trigger=None,
filter_me=False,
check_client=True)
async def get_note(message: Message) -> None:
Expand Down
10 changes: 5 additions & 5 deletions userge/plugins/utils/voice_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ async def force_play_music(msg: Message):
@userge.on_cmd("current", about={
'header': "View Current playing Song.",
'usage': "{tr}current"},
trigger=Config.SUDO_TRIGGER, check_client=True,
trigger=Config.PUBLIC_TRIGGER, check_client=True,
filter_me=False, allow_bots=False)
@vc_chat
@check_enable_for_all
Expand All @@ -549,7 +549,7 @@ async def current(msg: Message):
@userge.on_cmd("queue", about={
'header': "View Queue of Songs",
'usage': "{tr}queue"},
trigger=Config.SUDO_TRIGGER, check_client=True,
trigger=Config.PUBLIC_TRIGGER, check_client=True,
filter_me=False, allow_bots=False)
@vc_chat
@check_enable_for_all
Expand Down Expand Up @@ -608,7 +608,7 @@ async def set_volume(msg: Message):
@userge.on_cmd("skip", about={
'header': "Skip Song",
'usage': "{tr}skip"},
trigger=Config.SUDO_TRIGGER, check_client=True,
trigger=Config.PUBLIC_TRIGGER, check_client=True,
filter_me=False, allow_bots=False)
@vc_chat
async def skip_music(msg: Message):
Expand All @@ -622,7 +622,7 @@ async def skip_music(msg: Message):
@userge.on_cmd("pause", about={
'header': "Pause Song.",
'usage': "{tr}pause"},
trigger=Config.SUDO_TRIGGER, check_client=True,
trigger=Config.PUBLIC_TRIGGER, check_client=True,
filter_me=False, allow_bots=False)
@vc_chat
async def pause_music(msg: Message):
Expand All @@ -636,7 +636,7 @@ async def pause_music(msg: Message):
@userge.on_cmd("resume", about={
'header': "Resume Song.",
'usage': "{tr}resume"},
trigger=Config.SUDO_TRIGGER, check_client=True,
trigger=Config.PUBLIC_TRIGGER, check_client=True,
filter_me=False, allow_bots=False)
@vc_chat
async def resume_music(msg: Message):
Expand Down

0 comments on commit 287c8bd

Please sign in to comment.