MORE. LOGS.

This commit is contained in:
Casey 2022-11-02 20:18:31 +03:00
parent 94f477bc45
commit 3904e475a4
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 11 additions and 1 deletions

View File

@ -41,12 +41,14 @@ class DiscordIntegration(BaseIntegration):
logger.debug("Executing webhook with %r", json) logger.debug("Executing webhook with %r", json)
return ( result = (
await c.post( await c.post(
self.webhook, self.webhook,
json=json, json=json,
) )
).json() ).json()
logger.debug("Result: %r", result)
return result
async def __call__(self, status: Status) -> Optional[str]: async def __call__(self, status: Status) -> Optional[str]:
source = status.reblog or status source = status.reblog or status
@ -88,6 +90,11 @@ class DiscordIntegration(BaseIntegration):
), ),
) )
) )
else:
logger.warn(
"Unsupported attachment %r for Discord Embed",
attachment.type,
)
await self.execute_webhook( await self.execute_webhook(
username=status.account.acct, username=status.account.acct,

View File

@ -88,12 +88,15 @@ class TelegramIntegration(BaseIntegration):
async def _tg_request(self, method: str, **kwargs) -> TGResponse: async def _tg_request(self, method: str, **kwargs) -> TGResponse:
url = API_URL.format(self.token, method) url = API_URL.format(self.token, method)
async with AsyncClient() as client: async with AsyncClient() as client:
logger.debug("TG request: %s(%r)", method, kwargs)
response = TGResponse.from_dict( response = TGResponse.from_dict(
(await client.post(url, json=kwargs)).json(), kwargs (await client.post(url, json=kwargs)).json(), kwargs
) )
if not response.ok: if not response.ok:
logger.error("TG error: %r", response.error) logger.error("TG error: %r", response.error)
logger.error("parameters: %r", kwargs) logger.error("parameters: %r", kwargs)
else:
logger.debug("Result: %r", response.result)
return response return response
async def _post_plaintext(self, text: str) -> TGResponse: async def _post_plaintext(self, text: str) -> TGResponse: