为电报组分配特定的聊天ID
尝试分配一个聊天ID以使我的脚本或bot仅在特定聊天组上发送消息,目前在我的测试中,我只能使用bot消息框与我的bot进行交互,一旦我发送消息,我的机器人将回复我的聊天,我可以知道我需要修改脚本以使我分配特定的聊天ID,以便我只能在特定组上与机器人进行通信吗?
我的脚本
function sendText(chatid,text,replymarkup){
var data = {
method: "post",
payload: {
method: "sendMessage",
chat_id: String (chatid),
text: text,
parse_mode: "HTML",
reply_markup: JSON.stringify(replymarkup)
}
};
UrlFetchApp.fetch('https://api.telegram.org/bot' + BotToken + '/', data);
}
Trying to assign an chat ID to make my script or bot send a message on specific chat group only, currently on my testing I can interact with my bot using bot message box only, once I send a message my bot will reply to my chat, May I know what I need to modify with my script for me to assign specific chat id so I can communicate with my bot on specific group only?
My script
function sendText(chatid,text,replymarkup){
var data = {
method: "post",
payload: {
method: "sendMessage",
chat_id: String (chatid),
text: text,
parse_mode: "HTML",
reply_markup: JSON.stringify(replymarkup)
}
};
UrlFetchApp.fetch('https://api.telegram.org/bot' + BotToken + '/', data);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论