Merge branch 'master' into rlottie
This commit is contained in:
@@ -226,7 +226,7 @@ class Bot(AbstractUser):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def handle_command(self, message: Message) -> None:
|
async def handle_command(self, message: Message) -> Optional[bool]:
|
||||||
def reply(reply_text: str) -> Awaitable[Message]:
|
def reply(reply_text: str) -> Awaitable[Message]:
|
||||||
return self.client.send_message(message.chat_id, reply_text, reply_to=message.id)
|
return self.client.send_message(message.chat_id, reply_text, reply_to=message.id)
|
||||||
|
|
||||||
@@ -234,8 +234,9 @@ class Bot(AbstractUser):
|
|||||||
|
|
||||||
if self.match_command(text, "start"):
|
if self.match_command(text, "start"):
|
||||||
pcm = config["bridge.relaybot.private_chat.message"]
|
pcm = config["bridge.relaybot.private_chat.message"]
|
||||||
if pcm:
|
if not pcm:
|
||||||
await reply(pcm)
|
return True
|
||||||
|
await reply(pcm)
|
||||||
return
|
return
|
||||||
elif self.match_command(text, "id"):
|
elif self.match_command(text, "id"):
|
||||||
await self.handle_command_id(message, reply)
|
await self.handle_command_id(message, reply)
|
||||||
@@ -289,8 +290,7 @@ class Bot(AbstractUser):
|
|||||||
and update.message.entities and len(update.message.entities) > 0
|
and update.message.entities and len(update.message.entities) > 0
|
||||||
and isinstance(update.message.entities[0], MessageEntityBotCommand))
|
and isinstance(update.message.entities[0], MessageEntityBotCommand))
|
||||||
if is_command:
|
if is_command:
|
||||||
await self.handle_command(update.message)
|
return not await self.handle_command(update.message)
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_in_chat(self, peer_id) -> bool:
|
def is_in_chat(self, peer_id) -> bool:
|
||||||
|
|||||||
@@ -147,8 +147,9 @@ class BasePortal(ABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def has_bot(self) -> bool:
|
def has_bot(self) -> bool:
|
||||||
return ((bool(self.bot) and self.bot.is_in_chat(self.tgid))
|
return (bool(self.bot)
|
||||||
or (self.peer_type == "user" and self.tg_receiver == self.bot.tgid))
|
and (self.bot.is_in_chat(self.tgid)
|
||||||
|
or (self.peer_type == "user" and self.tg_receiver == self.bot.tgid)))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def main_intent(self) -> IntentAPI:
|
def main_intent(self) -> IntentAPI:
|
||||||
|
|||||||
Reference in New Issue
Block a user