forked from hkc/mastoposter
MORE. LOGS.
This commit is contained in:
parent
94f477bc45
commit
3904e475a4
|
@ -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,
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue