1. `chat.telegram` -> `telegram` plugin. 2. Merged `backend.chat.telegram` logic into `telegram` plugin. 3. Rewritten the architecture of the integration to adapt to the new asyncio API introduced in the latest versions of telegram-bot-api. Closes: #349
21 lines
429 B
Python
21 lines
429 B
Python
import logging
|
|
|
|
from telegram import Message as TelegramMessage, User as TelegramUser
|
|
|
|
from platypush.schemas.telegram import (
|
|
TelegramMessageSchema,
|
|
TelegramUserSchema,
|
|
)
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
def dump_msg(msg: TelegramMessage) -> dict:
|
|
return dict(TelegramMessageSchema().dump(msg))
|
|
|
|
|
|
def dump_user(user: TelegramUser) -> dict:
|
|
return dict(TelegramUserSchema().dump(user))
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|