import treq

This commit is contained in:
Nils Büchner 2024-11-04 01:16:19 +01:00
parent ab6c8b78d7
commit 26d88fa7d8

View file

@ -2,6 +2,7 @@ import requests
import json import json
import time import time
import os import os
import treq
from twisted.internet.defer import inlineCallbacks, returnValue from twisted.internet.defer import inlineCallbacks, returnValue
from synapse.module_api import ModuleApi, errors from synapse.module_api import ModuleApi, errors
from synapse.types import UserID from synapse.types import UserID
@ -200,9 +201,8 @@ class InviteChecker:
} }
try: try:
# Send the message directly
send_response = yield treq.put(send_url, headers=headers, json=content) send_response = yield treq.put(send_url, headers=headers, json=content)
response_body = yield send_response.text() # Capture the response text for logging response_body = yield send_response.text()
if send_response.code == 200: if send_response.code == 200:
logger.info(f"Message sent to room {self.config.announcement_room_id}: {message_content}") logger.info(f"Message sent to room {self.config.announcement_room_id}: {message_content}")
else: else: