主页 > 纸飞机官方 >

纸飞机官方

微信消息实时同步至Telegram的Node方案

流量次数: 作者:tg纸飞机 发布时间:2025-07-31 23:34

const TelegramBot = require('node-telegram-bot-api');

const WeChatAPI = require('./wechat');

const token = 'YOUR_TELEGRAM_BOT_TOKEN';

const bot = new TelegramBot(token, {polling: true});

bot.on('message', (msg) => {

const chatId = msg.chat.id;

WeChatAPI.pushMessage({

text: msg.text,

userId: chatId.toString

}).then( => {

bot.sendMessage(chatId, '消息已推送至微信');

});

});

const axios = require('axios');

module.exports = {

pushMessage: (data) => {

return axios.post(' {

touser: data.userId,

msgtype: "text",

agentid: 1000002,

text: { content: data.text }

}, {

params: { access_token: 'WECHAT_ACCESS_TOKEN' }

});

tags标签:tg下载(21)纸飞机tg下载(6)

本文章来自(https://www.ichshaoxing.com),转载请说明出处!

上一篇:Telegram注册指南及代理设置详细教程

下一篇:没有了