
Python
1
Вклад в тег
banned_users = []
def is_not_banned(func):
@wraps(func)
def decorator(message):
if message.from_user.id not in banned_users:
return func(message)
return decorator
class MyTeleBot(TeleBot):
def get_updates(self, *args, **kwargs):
json_updates = apihelper.get_updates(self.token, *args, **kwargs)
ret = []
for ju in json_updates:
if ju['message']['from']['id'] in banned_users:
self.last_update_id = ju['update_id']
else:
ret.append(types.Update.de_json(ju))
return ret