A Waline plugin that provide Telegram Bot spport.
中文文档 | English Doc
npm install waline-notification-telegram-botEdit 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
},
});Add "waline-notification-telegram-bot": "latest" into package.json dependencies.
TELEGRAM_BOT_TOKEN: Telegram bot token, get it by creating a bot via@BotFather. e.g.9435023322:DKEEOGmREFHKHwSpo-KfsgSnjwUGEHEft0ATELEGRAM_CHAT_ID: Telegram chat id, can be a single user, channel, or group, get it via@userinfobot. e.g.098765432SITE_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.