Queer European MD passionate about IT
瀏覽代碼

Coroutines must be awaited!
Accept format keyword arguments.

Davte 6 年之前
父節點
當前提交
b0d97265b5
共有 3 個文件被更改,包括 7 次插入4 次删除
  1. 1 1
      davtelepot/__init__.py
  2. 1 1
      davtelepot/admin_tools.py
  3. 5 2
      davtelepot/custombot.py

+ 1 - 1
davtelepot/__init__.py

@@ -7,7 +7,7 @@ __author__ = "Davide Testa"
 __email__ = "davte@libero.it"
 __credits__ = "Marco Origlia"
 __license__ = "GNU General Public License v3.0"
-__version__ = "1.4.10"
+__version__ = "1.4.11"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 1 - 1
davtelepot/admin_tools.py

@@ -101,7 +101,7 @@ async def _forward_to(update, bot, sender, addressee, is_admin=False):
         pass  # Remove custom parser to sender and addressee
     else:
         bot.set_custom_parser(
-            async_wrapper(
+            await async_wrapper(
                 _forward_to,
                 bot=bot,
                 sender=sender,

+ 5 - 2
davtelepot/custombot.py

@@ -467,7 +467,8 @@ class Bot(telepot.aio.Bot, Gettable):
         self.last_sending_time['absolute'] = datetime.datetime.now()
         return
 
-    def get_message(self, *fields, update=None, language=None):
+    def get_message(self, *fields, update=None, language=None,
+                    **format_kwargs):
         """Given a list of strings (`fields`), return proper message.
 
         If `language` is not passed, it is extracted from `update`.
@@ -517,7 +518,9 @@ class Bot(telepot.aio.Bot, Gettable):
                         )
                     )
                     return "Invalid message!"
-        return result[language]
+        return result[language].format(
+            **format_kwargs
+        )
 
     async def on_inline_query(self, update):
         """Schedule handling of received inline queries.