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

Commit

Permalink
Release Bug Fix Update v1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantkageri committed Oct 1, 2021
1 parent 8ea61ad commit a1f2a50
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
*.toml


# Environments
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ along with tgEasy. If not, see <http://www.gnu.org/licenses/>.

# tgEasy
```python
from tgEasy import tgClient, command
from tgEasy import tgClient
from pyrogram import Client

app = tgClient(Client("my_account"))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
],
keywords="telegram chat messenger mtproto api client library python pyrogram tgeasy monkey patcher",
keywords="telegram chat messenger mtproto api client library python pyrogram tgeasy",
project_urls={
"Tracker": "https://github.com/jayantkageri/tgEasys/issues",
"Community": "https://telegram.me/tgEasyNews",
Expand Down
30 changes: 15 additions & 15 deletions tgEasy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from .decorater import *
from .helpers import *

__version__ = "1.2.3"
__version__ = "1.2.4"
__copyright__ = "Copyright 2021 Jayant Hegde Kageri <github.com/jayantkageri>"
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
logging = logger.getLogger("tgEasy")
Expand All @@ -49,26 +49,26 @@ class Methods(

class tgClient(Methods, Scaffold):
notice_displayed = False
"""
### `tgEasy.tgClient`
- A Class for Initialising the tgEasy and it's Methods, Types and Functions
- Parameters:
- client (`pyrogram.Client`):
- The Pyrogram Client
#### Example
.. code-block:: python
from tgEasy import tgClient
from pyrogram import Client
app = tgClient(Client("my_account"))
"""
__client__ = None

def __init__(
self,
client=pyrogram.Client
):
"""
### `tgEasy.tgClient`
- A Class for Initialising the tgEasy and it's Methods, Types and Functions
- Parameters:
- client (`pyrogram.Client`):
- The Pyrogram Client
#### Example
.. code-block:: python
from tgEasy import tgClient
from pyrogram import Client
app = tgClient(Client("my_account"))
"""
super().__init__()
self.__client__ = client
tgClient.__client__ = self.__client__
Expand Down
3 changes: 2 additions & 1 deletion tgEasy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
# along with tgEasy. If not, see <http://www.gnu.org/licenses/>.

import os

from prettyconf import Configuration
from prettyconf.loaders import Environment, EnvFile
from prettyconf.loaders import EnvFile, Environment

env_file = f"{os.getcwd()}/.env"
config = Configuration(loaders=[Environment(), EnvFile(filename=env_file)])
Expand Down
15 changes: 9 additions & 6 deletions tgEasy/decorater.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
# along with tgEasy. If not, see <http://www.gnu.org/licenses/>.

import os
import tgEasy
import typing

import pyrogram

import tgEasy
from tgEasy.scaffold import Scaffold

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


class Command(Scaffold):
Expand Down Expand Up @@ -91,7 +94,7 @@ async def decorator(client, message: pyrogram.types.Message):
return await message.reply_text("This command can be used in PMs only.")
try:
await func(client, message)
except pyrogram.errors.forbidden_403.ChatWriteForbidden:
except pyrogram.errors.exceptions.forbidden_403.ChatWriteForbidden:
await client.leave_chat(message.chat.id)
except BaseException as exception:
return await handle_error(exception, message)
Expand Down Expand Up @@ -149,9 +152,9 @@ def wrapper(func):
async def decorator(client, CallbackQuery: pyrogram.types.CallbackQuery):
if self_admin:
me = await client.get_me()
mee = await client.get_chat_member(message.chat.id, me.id)
mee = await client.get_chat_member(CallbackQuery.chat.id, me.id)
if not mee.status == "admin":
return await message.reply_text("I must be admin to execute this Command")
return await CallbackQuery.message.edit_text("I must be admin to execute this Command")
pass
try:
await func(client, CallbackQuery)
Expand Down Expand Up @@ -205,7 +208,7 @@ async def decorator(client, message):
return await message.reply_text(f"You are Missing the following Rights to use this Command:\n{permission}")
try:
await func(client, message)
except pyrogram.errors.exception.forbidden_403.ChatWriteForbidden:
except pyrogram.errors.exceptions.forbidden_403.ChatWriteForbidden:
await client.leave_chat(message.chat.id)
except BaseException as exception:
await handle_error(exception, message)
Expand Down
5 changes: 4 additions & 1 deletion tgEasy/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import platform
import re
import sys

import pyrogram

import tgEasy


class Scaffold:
def __init__(self):
try:
Expand All @@ -30,4 +33,4 @@ async def check_rights(*args, **kwargs):
pass

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

0 comments on commit a1f2a50

Please sign in to comment.