JSPM

waline-notification-telegram-bot

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q27090F
  • License MIT

A Waline notification plugin that sends alerts via telegram bot

Package Exports

  • waline-notification-telegram-bot
  • waline-notification-telegram-bot/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (waline-notification-telegram-bot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

waline-notification-telegram-bot

A Waline plugin that provide Telegram Bot spport.

中文文档 | English Doc

How to install

npm install waline-notification-telegram-bot

How to use

Edit your Waline File:

indes.js

const Application = require('@waline/vercel');
const Telegram = require('waline-notification-telegram-bot');

module.exports = Application({
  plugins: [Telegram],
  async postSave(comment) {
    // do what ever you want after comment saved
  },
});

package.json

Add "waline-notification-telegram-bot": "latest" into package.json dependencies.

Environment Variables

  • TELEGRAM_BOT_TOKEN: Telegram bot token, get it by creating a bot via @BotFather. e.g. 9435023322:DKEEOGmREFHKHwSpo-KfsgSnjwUGEHEft0A
  • TELEGRAM_CHAT_ID: Telegram chat id, can be a single user, channel, or group, get it via @userinfobot. e.g. 098765432
  • SITE_NAME: Your site name, used for display in notification message.
  • SITE_URL: Your site URL, used for display in notification message.
  • TELEGRAM_TEMPLATE: (optional) Your custom notification template, please refer this document.

The default template as below:

{{site.name|safe}} 有新评论啦
【昵称】:{{self.nick}}
【邮箱】:{{self.mail}}
【内容】:{{self.comment}}
【地址】:{{site.postUrl}}

You need redeploy after change environment variables.