From cc6fbef8ea8364553786068b6dfe01b00f6693aa Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Fri, 9 Jun 2017 14:57:43 +0300 Subject: [PATCH] set_webhook return bool --- aiogram/bot/base.py | 2 +- aiogram/bot/bot.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/aiogram/bot/base.py b/aiogram/bot/base.py index 81c90ad6..c957bf44 100644 --- a/aiogram/bot/base.py +++ b/aiogram/bot/base.py @@ -145,7 +145,7 @@ class BaseBot: payload = generate_payload(**locals()) return await self.request(api.Methods.GET_UPDATES, payload) - async def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None) -> dict: + async def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None) -> bool: payload = generate_payload(**locals(), exclude=['certificate']) if certificate: cert = {'certificate': certificate} diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index c1362f46..a9561220 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -84,7 +84,7 @@ class Bot(BaseBot): raw = await super(Bot, self).get_updates(offset, limit, timeout, allowed_updates) return [self.prepare_object(types.Update.de_json(raw_update)) for raw_update in raw] - async def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None) -> types.WebhookInfo: + async def set_webhook(self, url, certificate=None, max_connections=None, allowed_updates=None) -> bool: """ Use this method to specify a url and receive incoming updates via an outgoing webhook. @@ -94,8 +94,7 @@ class Bot(BaseBot): :param allowed_updates: list of str :return: :class:`aiogram.types.WebhookInfo` """ - req = super(Bot, self).set_webhook(url, certificate, max_connections) - return self.prepare_object(types.WebhookInfo.de_json(await req)) + return await super(Bot, self).set_webhook(url, certificate, max_connections) async def delete_webhook(self) -> bool: """