mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Rework warning for not defined fields (#931)
This commit is contained in:
parent
a0fb37a54d
commit
7940613ec0
1 changed files with 6 additions and 2 deletions
|
|
@ -3,12 +3,14 @@ from __future__ import annotations
|
|||
import io
|
||||
import logging
|
||||
import typing
|
||||
import warnings
|
||||
from typing import TypeVar
|
||||
|
||||
from babel.support import LazyProxy
|
||||
|
||||
from .fields import BaseField
|
||||
from ..utils import json
|
||||
from ..utils.exceptions import AIOGramWarning
|
||||
from ..utils.mixins import ContextInstanceMixin
|
||||
if typing.TYPE_CHECKING:
|
||||
from ..bot.bot import Bot
|
||||
|
|
@ -243,8 +245,10 @@ class TelegramObject(ContextInstanceMixin, metaclass=MetaTelegramObject):
|
|||
return self.props[key].set_value(self, value, self.conf.get('parent', self))
|
||||
self.values[key] = value
|
||||
|
||||
# Log warning when Telegram silently adds new Fields
|
||||
log.warning("Field '%s' doesn't exist in %s", key, self.__class__)
|
||||
# Show warning when Telegram silently adds new Fields
|
||||
warnings.warn(f"Bot API Field {key!r} is not defined in {self.__class__!r} class.\n"
|
||||
"Bot API has been updated. Check for updates at https://telegram.org/blog and "
|
||||
"https://github.com/aiogram/aiogram/releases", AIOGramWarning)
|
||||
|
||||
def __contains__(self, item: str) -> bool:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue