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)
|
||||
|
||||
return (
|
||||
result = (
|
||||
await c.post(
|
||||
self.webhook,
|
||||
json=json,
|
||||
)
|
||||
).json()
|
||||
logger.debug("Result: %r", result)
|
||||
return result
|
||||
|
||||
async def __call__(self, status: Status) -> Optional[str]:
|
||||
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(
|
||||
username=status.account.acct,
|
||||
|
|
|
@ -88,12 +88,15 @@ class TelegramIntegration(BaseIntegration):
|
|||
async def _tg_request(self, method: str, **kwargs) -> TGResponse:
|
||||
url = API_URL.format(self.token, method)
|
||||
async with AsyncClient() as client:
|
||||
logger.debug("TG request: %s(%r)", method, kwargs)
|
||||
response = TGResponse.from_dict(
|
||||
(await client.post(url, json=kwargs)).json(), kwargs
|
||||
)
|
||||
if not response.ok:
|
||||
logger.error("TG error: %r", response.error)
|
||||
logger.error("parameters: %r", kwargs)
|
||||
else:
|
||||
logger.debug("Result: %r", response.result)
|
||||
return response
|
||||
|
||||
async def _post_plaintext(self, text: str) -> TGResponse:
|
||||
|
|
Loading…
Reference in New Issue