Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
Release v1.3.1
Browse files Browse the repository at this point in the history
For changelog: For changelog: For changelog: https://github.com/jayantkageri/tgEasy/releases/tag/v1.3.0
  • Loading branch information
jayantkageri committed Jan 18, 2022
1 parent fca3c0e commit 3d61f45
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
5 changes: 3 additions & 2 deletions tgEasy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
import pyrogram
from pyrogram import client
from pyromod import listen
from pyromod.helpers import array_chunk, bki, btn, force_reply, ikb, kb, kbtn, ntb
from pyromod.helpers import (array_chunk, bki, btn, force_reply, ikb, kb, kbtn,
ntb)
from pyromod.nav import Pagination

from .config import Config
from .decorater import *
from .helpers import *
from .scaffold import Scaffold

__version__ = "1.3.0"
__version__ = "1.3.1"
__copyright__ = "Copyright 2021 Jayant Hegde Kageri <github.com/jayantkageri>"
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
logging = logger.getLogger("tgEasy")
Expand Down
8 changes: 2 additions & 6 deletions tgEasy/decorater/adminsOnly.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import pyrogram
from cachetools import TTLCache
from pyrogram.types.messages_and_media import message

from tgEasy.scaffold import Scaffold

Expand Down Expand Up @@ -114,13 +113,13 @@ def adminsOnly(
"""
# `tgEasy.tgClient.adminsOnly`
- A decorater for running the function only if the admin have the specified Rights.
- We are still Working on this to make it to check Rights for Anonoymous Admins, Stay Tuned.
- If the admin is Anonymous Admin, it also checks his rights by making a Callback.
- Parameters:
- permission (str):
- Permission which the User must have to use the Functions
- TRUST_ANON_ADMIN (bool) **optional**:
- If User is Anonymous Admin also, It Runs the Function, By Default False
- If the user is an Anonymous Admin, then it bypasses his right check.
# Example
.. code-block:: python
Expand All @@ -143,9 +142,6 @@ async def decorator(client, message):
"This command can be used in supergroups only.",
)
if message.sender_chat and not TRUST_ANON_ADMINS:
# return await message.reply_text(
# "The Right Check for Anonymous Admins is in Development. So you cannot perform this Action for Now, If you don't want this and want to Allow Anonymous Admins for performing Actions in this time Please Contact Bot Owner.",
# )
ANON[int(f"{message.chat.id}{message.message_id}")] = (
message,
func,
Expand Down
12 changes: 8 additions & 4 deletions tgEasy/decorater/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def command(
group_only: typing.Union[bool, bool] = False,
self_admin: typing.Union[bool, bool] = False,
self_only: typing.Union[bool, bool] = False,
handler: typing.Optional[list] = Config.HANDLERS,
filter: typing.Union[pyrogram.filters.Filter, pyrogram.filters.Filter] = None,
*args,
**kwargs
Expand All @@ -54,6 +55,9 @@ def command(
- self_only (bool) **optional**:
- If True, the command will only excute if used by Self only, By Default False.
- handler (list) **optional**:
- If set, the command will be handled by the specified Handler, By Default `Config.HANDLERS`.
- self_admin (bool) **optional**:
- If True, the command will only executeed if the Bot is Admin in the Chat, By Default False
Expand All @@ -74,28 +78,28 @@ async def start(client, message):
if filter:
if self_only:
filter = (
pyrogram.filters.command(command, prefixes=Config.HANDLERS)
pyrogram.filters.command(command, prefixes=handler)
& ~pyrogram.filters.edited
& filter
& pyrogram.filters.me
)
else:
filter = (
pyrogram.filters.command(command, prefixes=Config.HANDLERS)
pyrogram.filters.command(command, prefixes=handler)
& ~pyrogram.filters.edited
& filter
& pyrogram.filters.me
)
else:
if self_only:
filter = (
pyrogram.filters.command(command, prefixes=Config.HANDLERS)
pyrogram.filters.command(command, prefixes=handler)
& ~pyrogram.filters.edited
& pyrogram.filters.me
)
else:
filter = (
pyrogram.filters.command(command, prefixes=Config.HANDLERS)
pyrogram.filters.command(command, prefixes=handler)
& ~pyrogram.filters.edited
)

Expand Down
4 changes: 2 additions & 2 deletions tgEasy/helpers/get_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

async def get_user(
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery]
):
) -> pyrogram.types.User or bool:
"""
### `tgEasy.get_user`
- Gets a User from Message/RepliedMessage/CallbackQuery
Expand Down Expand Up @@ -88,7 +88,7 @@ async def ban(client, message):

async def get_user_adv(
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery]
):
) -> pyrogram.types.User or bool:
"""
### `tgEasy.get_user_adv`
- A Function to Get the User from the Message/CallbackQuery, If there is None arguments, returns the From User.
Expand Down
1 change: 1 addition & 0 deletions tgEasy/helpers/handle_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ async def start(client, message):
pass
logging.exception(traceback.format_exc())
os.remove("crash.log")
return True
2 changes: 1 addition & 1 deletion tgEasy/helpers/send_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

async def send_typing(
m: typing.Union[pyrogram.types.Message, pyrogram.types.CallbackQuery]
):
) -> bool:
"""
### `tgEasy.send_typing`
- A Function to Send the Typing Status to the Chat.
Expand Down
6 changes: 0 additions & 6 deletions tgEasy/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,3 @@ def callback(*args, **kwargs):

def adminsOnly(*args, **kwargs):
pass

async def check_rights(*args, **kwargs):
pass

async def is_admin(*args, **kwargs):
pass

0 comments on commit 3d61f45

Please sign in to comment.