Updated README, minor changes and pip ready

The module is now ready to be installed via pip
README.md has been updated to reflect these changes
Minor changes to the interactive client example
Versioning is now done by editting TelegramClient's
__version__, rather than looking for the string
This commit is contained in:
Lonami
2016-09-18 12:04:17 +02:00
parent 6642f73a3d
commit d8757af5c5
6 changed files with 156 additions and 25 deletions
+1 -1
View File
@@ -176,7 +176,7 @@ class BadMessageError(Exception):
ErrorMessages = {
16: 'msg_id too low (most likely, client time is wrong it would be worthwhile to '
'synchronize it using msg_id notifications and re-send the original message '
'with the “correct” msg_id or wrap it in a container with a new msg_id if the '
'with the "correct" msg_id or wrap it in a container with a new msg_id if the '
'original message had waited too long on the client to be transmitted).',
17: 'msg_id too high (similar to the previous case, the client time has to be '
+10 -2
View File
@@ -211,7 +211,15 @@ class InteractiveTelegramClient(TelegramClient):
@staticmethod
def update_handler(update_object):
if type(update_object) is UpdateShortMessage:
print('[User #{} sent {}]'.format(update_object.user_id, update_object.message))
if update_object.out:
print('You sent {} to user #{}'.format(update_object.message, update_object.user_id))
else:
print('[User #{} sent {}]'.format(update_object.user_id, update_object.message))
elif type(update_object) is UpdateShortChatMessage:
print('[Chat #{} sent {}]'.format(update_object.chat_id, update_object.message))
if update_object.out:
print('You sent {} to chat #{}'.format(update_object.message, update_object.chat_id))
else:
print('[Chat #{}, user #{} sent {}]'.format(update_object.chat_id,
update_object.from_id,
update_object.message))
+4 -1
View File
@@ -34,6 +34,9 @@ from telethon.tl.all_tlobjects import layer
class TelegramClient:
# Current TelegramClient version
__version__ = '0.5'
# region Initialization
def __init__(self, session_user_id, api_id, api_hash):
@@ -73,7 +76,7 @@ class TelegramClient:
query = InitConnectionRequest(api_id=self.api_id,
device_model=platform.node(),
system_version=platform.system(),
app_version='0.4',
app_version=self.__version__,
lang_code='en',
query=GetConfigRequest())