text: #!/usr/bin/env python3
  #coding=utf-8
  
  import logging
  import requests
  
  class Telegram(object):
      def __init__(self, **kwargs):
          self.token = kwargs.get('token', '')
          self.chat_id = kwargs.get('chat_id', '')
  
      def post(self, title='', author='', summary='', link=''):
          try:
              if not title:
                  raise Exception('no content to post')
  
              text = f'{link}\n{title} （{author}）'
              resp = requests.post(
                  url=f'https://api.telegram.org/bot{self.token}/sendMessage',
                  headers={'Content-Type': 'application/x-www-form-urlencoded'},
                  data={
                      'chat_id': self.chat_id,
                      'text': text,
                      'disable_web_page_preview': False,
                      'disable_notification': True,
                  },
                  timeout=20,
              ).json()
              logging.debug(f'\tTelegram posting result: {resp}')
              if not resp.get('ok', False):
                  raise Exception(resp.get('description', ''))
  
              return True, f"https://t.me/gnewsorg/{resp.get('result', {}).get('message_id', 0)}"
          except Exception as e:
              logging.error(e)
              return False, ''
  