Pārlūkot izejas kodu

Improve logging for debug purposes

Kirk Trombley 3 gadi atpakaļ
vecāks
revīzija
95065b3406
1 mainītis faili ar 8 papildinājumiem un 6 dzēšanām
  1. 8 6
      drivers/groupme_driver.py

+ 8 - 6
drivers/groupme_driver.py

@@ -76,16 +76,18 @@ class GroupMeBot(rollbot.Rollbot[GroupMeMessage]):
             return (await upload.json())["payload"]["url"]
 
     async def post_message(self, bot_id: str, text: str, attachments: list[dict[str, str]]):
+        body = {
+            "bot_id": bot_id,
+            "text": text,
+            "attachments": attachments,
+        }
+        self.context.logginer.info(f"Sending: {body}")
         result = await self.context.request.post(
             "https://api.groupme.com/v3/bots/post",
-            json={
-                "bot_id": bot_id,
-                "text": text,
-                "attachments": attachments,
-            },
+            json=body,
             timeout=10,
         )
-        self.context.logger.info(f"{result.status} - {await result.json()}")
+        self.context.logger.info(f"Received: {result.status} - {await result.json()}")
 
     async def respond(self, res: rollbot.Response):
         # sleep for a moment to make groupme not misorder messages