Improved #28
This commit is contained in:
parent
80391a61ac
commit
4c724e8fdc
|
@ -6,3 +6,13 @@ class AbstractEntity(ABC):
|
|||
self.chat_id = message.chat.id
|
||||
self.chat_type = message.chat.type
|
||||
self.message = message
|
||||
|
||||
def is_private(self):
|
||||
"""Returns True if the message is private.
|
||||
"""
|
||||
return self.message.chat.type == 'private'
|
||||
|
||||
def is_editing(self):
|
||||
"""Returns True if the message was edited.
|
||||
"""
|
||||
return self.message.edit_date is not None
|
||||
|
|
|
@ -28,11 +28,6 @@ class Message(AbstractEntity):
|
|||
"""
|
||||
return self.message.sticker is not None
|
||||
|
||||
def is_editing(self):
|
||||
"""Returns True if the message was edited.
|
||||
"""
|
||||
return self.message.edit_date is not None
|
||||
|
||||
def has_entities(self):
|
||||
"""Returns True if the message has entities (attachments).
|
||||
"""
|
||||
|
@ -44,11 +39,6 @@ class Message(AbstractEntity):
|
|||
anchors = config.getlist('bot', 'anchors')
|
||||
return self.has_text() and any(a in self.message.text.split(' ') for a in anchors)
|
||||
|
||||
def is_private(self):
|
||||
"""Returns True if the message is private.
|
||||
"""
|
||||
return self.message.chat.type == 'private'
|
||||
|
||||
def is_reply_to_bot(self):
|
||||
"""Returns True if the message is a reply to bot.
|
||||
"""
|
||||
|
|
|
@ -8,6 +8,9 @@ class Chance(Base):
|
|||
|
||||
@staticmethod
|
||||
def execute(bot, command):
|
||||
if command.is_private():
|
||||
return Chance.reply(bot, command, 'Command disabled for private chats')
|
||||
|
||||
try:
|
||||
new_chance = int(command.args[0])
|
||||
|
||||
|
|
Loading…
Reference in New Issue