Skip to content

Commit

Permalink
improve support for deltalab communities
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed May 24, 2024
1 parent 871e0fb commit 779391b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions matterdelta/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
from argparse import Namespace

from deltabot_cli import BotCli
from deltachat2 import Bot, ChatType, CoreEvent, EventType, MsgData, NewMsgEvent, events
from deltachat2 import (
Bot,
ChatType,
CoreEvent,
EventType,
JsonRpcError,
MsgData,
NewMsgEvent,
events,
)
from deltachat2.types import SpecialContactId
from rich.logging import RichHandler

from ._version import __version__
Expand Down Expand Up @@ -60,7 +70,12 @@ def _bridge(bot: Bot, accid: int, event: NewMsgEvent) -> None:
chat = bot.rpc.get_basic_chat_info(accid, msg.chat_id)
if chat.chat_type == ChatType.SINGLE and not msg.is_bot:
bot.rpc.markseen_msgs(accid, [msg.id])
_send_help(bot, accid, msg.chat_id)
try:
community = bot.rpc.get_config(accid, "is_community") == "1"
except JsonRpcError:
community = False
if not community or msg.from_id > SpecialContactId.LAST_SPECIAL:
_send_help(bot, accid, msg.chat_id)
else:
dc2mb(bot, accid, msg)

Expand Down

0 comments on commit 779391b

Please sign in to comment.