Ignore messages from bots
This commit is contained in:
parent
562d7138c0
commit
1ae02d2973
4 changed files with 4 additions and 4 deletions
|
@ -55,7 +55,7 @@ async def incoming_platform_message_view(platform, path=None):
|
|||
)
|
||||
return {"error": str(error)}, 400
|
||||
|
||||
if not message:
|
||||
if not message or message.from_bot:
|
||||
return {}
|
||||
|
||||
for plugin in enabled_plugins:
|
||||
|
|
|
@ -8,7 +8,7 @@ class Message:
|
|||
text: Text
|
||||
chat: Text
|
||||
author: Text
|
||||
is_bot: bool = False
|
||||
from_bot: bool = False
|
||||
date: Optional[datetime] = None
|
||||
id: Optional[Text] = None
|
||||
reply_to: Optional[Text] = None
|
||||
|
|
|
@ -64,7 +64,7 @@ class SlackPlatform(Platform):
|
|||
return Message(
|
||||
id=data["event"].get("thread_ts", data["event"]["ts"]),
|
||||
author=data["event"]["user"],
|
||||
is_bot="bot_id" in data["event"],
|
||||
from_bot="bot_id" in data["event"],
|
||||
date=datetime.fromtimestamp(int(float(data["event"]["event_ts"]))),
|
||||
text=data["event"]["text"],
|
||||
chat=data["event"]["channel"],
|
||||
|
|
|
@ -61,7 +61,7 @@ class TelegramPlatform(Platform):
|
|||
id=request_data["message"]["message_id"],
|
||||
date=datetime.fromtimestamp(request_data["message"]["date"]),
|
||||
text=str(request_data["message"]["text"]),
|
||||
is_bot=request_data["message"]["from"]["is_bot"],
|
||||
from_bot=request_data["message"]["from"]["from_bot"],
|
||||
author=request_data["message"]["from"]["id"],
|
||||
chat=str(request_data["message"]["chat"]["id"]),
|
||||
raw=request_data,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue