Add optional intro message on bot startup
When SEND_INTRO_MESSAGE=true, the bot sends "The deals must flow." as an m.notice to the Matrix room right after startup, before the first scheduled deal checks. Defaults to off. https://claude.ai/code/session_017eMsVwUopgmnEyd6JJedpV
This commit is contained in:
@@ -47,5 +47,26 @@ class MatrixDealsClient:
|
||||
logger.error("Matrix send error: %s", exc)
|
||||
return False
|
||||
|
||||
async def send_notice(self, text: str) -> bool:
|
||||
"""Send a plain m.notice (non-highlight) message to the configured room."""
|
||||
content = {
|
||||
"msgtype": "m.notice",
|
||||
"body": text,
|
||||
}
|
||||
|
||||
try:
|
||||
resp = await self._client.room_send(
|
||||
room_id=self.room_id,
|
||||
message_type="m.room.message",
|
||||
content=content,
|
||||
)
|
||||
if isinstance(resp, RoomSendError):
|
||||
logger.error("Failed to send notice: %s", resp.message)
|
||||
return False
|
||||
return True
|
||||
except Exception as exc:
|
||||
logger.error("Matrix send error: %s", exc)
|
||||
return False
|
||||
|
||||
async def close(self):
|
||||
await self._client.close()
|
||||
|
||||
Reference in New Issue
Block a user