gpt4 book ai didi

node.js - 如何通过 Bale Bot 发送照片信息?

转载 作者:搜寻专家 更新时间:2023-11-01 00:19:54 24 4
gpt4 key购买 nike

我想通过我的机器人发送 PhotoMessage!但是套接字重新连接并且没有记录错误!

let _pic = {
fileId: '-8485942782244354814',
accessHash: '1533910422',
name: '9312002.jpg',
fileSize: '62379',
mimeType: 'image/jpeg',
fileStorageVersion: 1,
ext_width: 349,
ext_height: 456,
width: 349,
height: 456,
thumb: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAA4KCw0LCQ4NDA0QDw4RFiQXFhQUFiwgIRokNC43NjMuMjI6QVNGOj1OPjIySGJJTlZYXV5dOEVmbWVabFNbXVn/2wBDAQ8QEBYTFioXFypZOzI7WVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVn/wAARCABaAEQDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAYBAgMEBQf/xAA2EAACAQMCBAIIBQMFAAAAAAABAgMABBESIQUxQVEGEyIyQmFxgZHRFCOhwfAHseEVJDNicv/EABgBAAMBAQAAAAAAAAAAAAAAAAABAgME/8QAHBEBAQACAwEBAAAAAAAAAAAAAAECEQMSMSFB/9oADAMBAAIRAxEAPwD0miiqSOI42dvVUEmgFnxd4m/0hRa2hVrtxkk7iMd/jXnFxf3d42bm6mlbfGtyarxC7kv+ITXEzZaVyxOeXYfDlVEg1sxO6LgbY+VOQLJcTW7qUdlPQqabvD/jC4tZkg4o5ltm2Ep3ZD7z1H60phItaAt8SQRj+cqgsgVxqJC4wO+38+tMPcEdZEV0YMrDIIOxFWpY8B37XnARFI2qS2cx+/TzH2+VM9SBRRRQBWK6j861miHtoV+orLUUB4RbwvNdpCAAzNp36U62nhG3kiHmzSasb6cCteDhLW3Gr+QxhmDa4yRgDVkmupY8Tu/P8ryo5ABqOkMpAzjO470rbfG2GMnoi8J2EY9MySH/ALHlS54i4IlkPNhJ8vIBHanS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=='
};

const pMsg = new PhotoMessage(
_pic.fileId, _pic.accessHash, _pic.name,
_pic.size, 'image/jpeg', "title",
_pic.width, _pic.height, _pic.thumb
);

global.bot.send(pMsg, responder.peer);
// responder.reply(pMsg);

最佳答案

这是因为你没有在pMsg中正确设置fileSize。试试下面的代码,它已经过测试:

const SDK = require("balebot");
const BaleBot = SDK.BaleBot;
const PhotoMessage=SDK.PhotoMessage;

let bot = new BaleBot('token');

let _pic = {
fileId: '-8485942782244354814',
accessHash: '1533910422',
name: '9312002.jpg',
fileSize: '62379',
mimeType: 'image/jpeg',
fileStorageVersion: 1,
ext_width: 349,
ext_height: 456,
width: 349,
height: 456,
thumb:'thumbnail'
};
const pMsg = new PhotoMessage(
_pic.fileId, _pic.accessHash, _pic.name,
_pic.fileSize, 'image/jpeg', "title",
_pic.width, _pic.height, _pic.thumb
);
bot.hears(["/start"], (message, responder) => {
bot.send(pMsg, responder.peer).then((res) => {
console.log(res)
}).catch((err) => {
console.log(err)
});
});

关于node.js - 如何通过 Bale Bot 发送照片信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50920764/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com