Skip to content

Commit

Permalink
fix notes bug in channels, bots and some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Jul 22, 2020
1 parent 1c797ad commit b3669df
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 633 deletions.
5 changes: 3 additions & 2 deletions userge/core/methods/decorators/on_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def on_cmd(self,
If ``True``, allow this via your bot, defaults to True.
check_client (``bool``, *optional*):
If ``True``, check client is bot or not before execute, defaults to True.
If ``True``, check client is bot or not before execute, defaults to False.
kwargs:
prefix (``str``, *optional*):
Expand Down Expand Up @@ -143,4 +143,5 @@ def on_cmd(self,
and (m.text.startswith(Config.SUDO_TRIGGER) if trigger else True))
filters_ = filters_ & (outgoing_flt | incoming_flt)
return self._build_decorator(log=f"On {pattern}", filters=filters_, flt=cmd,
check_client=check_client, scope=scope, **kwargs)
check_client=check_client and allow_via_bot,
scope=scope, **kwargs)
4 changes: 2 additions & 2 deletions userge/core/methods/decorators/on_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def on_filters(self,
filters: Filters,
group: int = 0,
allow_via_bot: bool = True,
check_client: bool = False) -> RawDecorator._PYRORETTYPE:
check_client: bool = True) -> RawDecorator._PYRORETTYPE:
"""\nDecorator for handling filters
Parameters:
Expand All @@ -41,4 +41,4 @@ def on_filters(self,
flt = types.raw.Filter(self, group, allow_via_bot)
filters = Filters.create(lambda _, __: flt.is_enabled) & filters
return self._build_decorator(log=f"On Filters {filters}", filters=filters,
flt=flt, check_client=check_client)
flt=flt, check_client=check_client and allow_via_bot)
2 changes: 1 addition & 1 deletion userge/core/methods/decorators/on_left_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def on_left_member(self,
leaving_chats: Filters.chat,
group: int = -2,
allow_via_bot: bool = True,
check_client: bool = False) -> RawDecorator._PYRORETTYPE:
check_client: bool = True) -> RawDecorator._PYRORETTYPE:
"""\nDecorator for handling left members
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion userge/core/methods/decorators/on_new_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def on_new_member(self,
welcome_chats: Filters.chat,
group: int = -2,
allow_via_bot: bool = True,
check_client: bool = False) -> RawDecorator._PYRORETTYPE:
check_client: bool = True) -> RawDecorator._PYRORETTYPE:
"""\nDecorator for handling new members
Parameters:
Expand Down
Loading

0 comments on commit b3669df

Please sign in to comment.