2016-11-12 23:55:48 +01:00
|
|
|
from .abstract_entity import AbstractEntity
|
2016-11-12 13:37:14 +01:00
|
|
|
from src.utils import deep_get_attr
|
2016-11-12 16:36:23 +01:00
|
|
|
from src.config import config
|
2016-11-12 13:37:14 +01:00
|
|
|
|
|
|
|
|
2016-11-12 23:55:48 +01:00
|
|
|
class Status(AbstractEntity):
|
2016-12-02 20:55:53 +01:00
|
|
|
bot_name = config['bot']['name']
|
|
|
|
|
2016-12-01 22:01:04 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super(Status, self).__init__(message)
|
2016-11-12 13:37:14 +01:00
|
|
|
|
|
|
|
def is_bot_kicked(self):
|
|
|
|
"""Returns True if the bot was kicked from group.
|
|
|
|
"""
|
|
|
|
user_name = deep_get_attr(self.message, 'left_chat_member.username')
|
|
|
|
|
2016-12-02 20:55:53 +01:00
|
|
|
return user_name == self.bot_name
|
2016-11-12 13:37:14 +01:00
|
|
|
|
|
|
|
def is_bot_added(self):
|
|
|
|
"""Returns True if the bot was added to group.
|
|
|
|
"""
|
|
|
|
user_name = deep_get_attr(self.message, 'new_chat_member.username')
|
|
|
|
|
2016-12-02 20:55:53 +01:00
|
|
|
return user_name == self.bot_name
|