From b0c011c70c6a0520dc9382480c7a05bf8c46e8d7 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Thu, 28 Feb 2019 00:27:50 +0300 Subject: [PATCH 1/2] Fix plugins import on windows (#223) Fixes #217 --- pyrogram/client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index f62c046c..ae8ed111 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1139,7 +1139,7 @@ class Client(Methods, BaseClient): if include is None: for path in sorted(Path(root).rglob("*.py")): - module_path = os.path.splitext(str(path))[0].replace("/", ".") + module_path = '.'.join(path.parent.parts + (path.stem,)) module = import_module(module_path) for name in vars(module).keys(): From 5294c21e97e433f4b10b294273387f3120ba92f2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 1 Mar 2019 16:04:21 +0100 Subject: [PATCH 2/2] Automatically coerce any text to string for keyboard buttons --- pyrogram/client/types/bots/inline_keyboard_button.py | 2 +- pyrogram/client/types/bots/keyboard_button.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/types/bots/inline_keyboard_button.py b/pyrogram/client/types/bots/inline_keyboard_button.py index cd30f373..cc829cb1 100644 --- a/pyrogram/client/types/bots/inline_keyboard_button.py +++ b/pyrogram/client/types/bots/inline_keyboard_button.py @@ -63,7 +63,7 @@ class InlineKeyboardButton(PyrogramType): callback_game: CallbackGame = None): super().__init__(None) - self.text = text + self.text = str(text) self.url = url self.callback_data = callback_data self.switch_inline_query = switch_inline_query diff --git a/pyrogram/client/types/bots/keyboard_button.py b/pyrogram/client/types/bots/keyboard_button.py index e93eccb3..3c7c2bd6 100644 --- a/pyrogram/client/types/bots/keyboard_button.py +++ b/pyrogram/client/types/bots/keyboard_button.py @@ -46,7 +46,7 @@ class KeyboardButton(PyrogramType): request_location: bool = None): super().__init__(None) - self.text = text + self.text = str(text) self.request_contact = request_contact self.request_location = request_location