diff --git a/telegram/audio.py b/telegram/audio.py index ff54b339d..30342b7e0 100644 --- a/telegram/audio.py +++ b/telegram/audio.py @@ -49,12 +49,12 @@ class Audio(TelegramObject): duration, **kwargs): # Required - self.file_id = file_id + self.file_id = str(file_id) self.duration = int(duration) # Optionals - self.performer = kwargs.get('performer', '') - self.title = kwargs.get('title', '') - self.mime_type = kwargs.get('mime_type', '') + self.performer = str(kwargs.get('performer', '')) + self.title = str(kwargs.get('title', '')) + self.mime_type = str(kwargs.get('mime_type', '')) self.file_size = int(kwargs.get('file_size', 0)) @staticmethod diff --git a/telegram/contact.py b/telegram/contact.py index e26d755c3..3b9e2b104 100644 --- a/telegram/contact.py +++ b/telegram/contact.py @@ -45,7 +45,7 @@ class Contact(TelegramObject): first_name, **kwargs): # Required - self.phone_number = phone_number + self.phone_number = str(phone_number) self.first_name = first_name # Optionals self.last_name = kwargs.get('last_name', '') diff --git a/telegram/document.py b/telegram/document.py index 31dbeab0b..ff017ceae 100644 --- a/telegram/document.py +++ b/telegram/document.py @@ -46,11 +46,11 @@ class Document(TelegramObject): file_id, **kwargs): # Required - self.file_id = file_id + self.file_id = str(file_id) # Optionals self.thumb = kwargs.get('thumb') - self.file_name = kwargs.get('file_name', '') - self.mime_type = kwargs.get('mime_type', '') + self.file_name = str(kwargs.get('file_name', '')) + self.mime_type = str(kwargs.get('mime_type', '')) self.file_size = int(kwargs.get('file_size', 0)) @staticmethod diff --git a/telegram/error.py b/telegram/error.py index b19b3f905..fdbc00319 100644 --- a/telegram/error.py +++ b/telegram/error.py @@ -22,10 +22,14 @@ class TelegramError(Exception): """This object represents a Telegram Error.""" - @property - def message(self): + def __init__(self, message): """ Returns: str: """ - return self.args[0] + super(TelegramError, self).__init__() + + self.message = message.split(':')[-1].strip().capitalize() + + def __str__(self): + return '%s' % (self.message) diff --git a/telegram/sticker.py b/telegram/sticker.py index 35bc01674..06089e358 100644 --- a/telegram/sticker.py +++ b/telegram/sticker.py @@ -48,7 +48,7 @@ class Sticker(TelegramObject): height, **kwargs): # Required - self.file_id = file_id + self.file_id = str(file_id) self.width = int(width) self.height = int(height) # Optionals diff --git a/telegram/update.py b/telegram/update.py index 83e068593..3bccc7d20 100644 --- a/telegram/update.py +++ b/telegram/update.py @@ -39,7 +39,7 @@ class Update(TelegramObject): update_id, **kwargs): # Required - self.update_id = update_id + self.update_id = int(update_id) # Optionals self.message = kwargs.get('message') diff --git a/telegram/video.py b/telegram/video.py index b10dd475f..d69306337 100644 --- a/telegram/video.py +++ b/telegram/video.py @@ -53,13 +53,13 @@ class Video(TelegramObject): duration, **kwargs): # Required - self.file_id = file_id + self.file_id = str(file_id) self.width = int(width) self.height = int(height) self.duration = int(duration) # Optionals self.thumb = kwargs.get('thumb') - self.mime_type = kwargs.get('mime_type', '') + self.mime_type = str(kwargs.get('mime_type', '')) self.file_size = int(kwargs.get('file_size', 0)) @staticmethod diff --git a/telegram/voice.py b/telegram/voice.py index 96f3fa5f1..53dcdc440 100644 --- a/telegram/voice.py +++ b/telegram/voice.py @@ -44,10 +44,10 @@ class Voice(TelegramObject): file_id, **kwargs): # Required - self.file_id = file_id + self.file_id = str(file_id) # Optionals self.duration = int(kwargs.get('duration', 0)) - self.mime_type = kwargs.get('mime_type', '') + self.mime_type = str(kwargs.get('mime_type', '')) self.file_size = int(kwargs.get('file_size', 0)) @staticmethod