Tag: telegram bot

使用微软BotFramework在电报中寻求显示videocard / youtubevideo的build议

我的目标是在电报中显示YouTubevideo(最好是以卡的forms),同时尽可能使用botbuilder模块将我的代码保持为“通道不可知”。 谁能告诉我为什么Telegram使用从官方示例回购 (createVideoCard()示例)采取的这个NodeJS示例将video显示为一个普通图像? (youtube链接的行为相同)。 var builder = require('botbuilder'); function (session, results, next) { const msg = new builder.Message(session) .addAttachment(new builder.VideoCard(session) .title('Big Buck Bunny') .subtitle('by the Blender Institute') .text('Big Buck Bunny (code-named Peach) is a short computer-animated comedy film by the Blender Institute, part of the Blender Foundation. Like the foundation\'s previous film Elephants Dream, the […]

Node.js无法从电报bot websocket中获取数据

我正在尝试使用自签证书与nodejs https服务器build立一个电报机器人。 ssl证书: openssl req -newkey rsa:2048 -sha256 -nodes -keyout key.pem -x509 -days 365 -out crt.pem -subj "/C=IR/ST=A.Sh/L=Tabriz/O=DominoSystem/CN=5.235.36.42" 非常简单的服务器: var options = { key : fs.readFileSync(__dirname + '/key.pem'), cert: fs.readFileSync(__dirname + '/crt.pem') }; https.createServer(options, function (req, res) { console.log('https server'); console.log(req.url); res.end('yoo hooo'); }).listen(8443,'0.0.0.0'); 服务器可通过Internet访问: https://5.235.36.42:8443/ : https://5.235.36.42:8443/ : https://5.235.36.42:8443/ Telegram bot setWebhook返回ok {"ok":true,"result":true,"description":"Webhook was […]

只运行一次函数

我怎样才能调用和使用这个函数只是为了一个时间,然后再杀死函数? 调用函数: else if (msg.text == ["📠contact us📠"]) { const opts = { reply_to_message_id: msg.message_id, reply_markup: JSON.stringify({ keyboard: arrangeKeyboard(locale.keyboards[msg.text].childs, 2, msg), resize_keyboard: true, one_time_keyboard: true }) }; bot.sendMessage(msg.chat.id, "Please Write your Messages:", opts); getmessage1(); } 这是我的function,我不想在一个循环运行,我需要发送消息和杀死function。 var getmessage = async () => { // Listen for any kind of message. There are different kinds of […]

为什么电报设置webhook后不发送更新?

我可以通过Telegram getUpdates API获取更新,而在使用有效的SSL证书或自签名证书设置webhook后,它会显示: {"ok":true,"result":true,"description":"Webhook was set"} 但它不会发送任何更新到我的webhook链接(我检查了Nginx和node.js访问日志文件),我尝试了很多curl命令为setWebhook API与没有证书,但仍然没有结果: curl -s -X POST https://api.telegram.org/bot<TOKEN>/setWebhook -d url='https://www.example.tech/<TOKEN>/webhook' jq . curl -F "url=https://www.example.tech/<TOKEN>/webhook" -F "certificate=@./www_example_tech.crt" https://api.telegram.org/bot<TOKEN>/setWebhook