如何使用Bale bot分组发送消息?
对于使用BaleBot发送消息,我们需要有用户/组的id和一个accessHash。但我不能让accessHash发送消息给集团。
发布于 2018-06-23 06:18:23
如果您有组(或通道)的id和access_hash,这并不太难。您应该只制作Peer,然后将其放入send_message函数中。看看这段代码。在客户端启动后,它将"Hello“推送到指定的通道。注意:记住组和通道是相似的。
const SDK = require("balebot");
const BaleBot = SDK.BaleBot;
const TextMessage = SDK.TextMessage;
const Group = SDK.Group;
let bot = new BaleBot('token');
bot.hears(["/start"], (message, responder) => {
console.log(responder._peer)
bot.send(new TextMessage("hello"),responder.peer).then((res) => {
console.log(res)
}).catch((err) => {
console.log(err)
});
});https://stackoverflow.com/questions/50998197
复制相似问题