Read this in other languages: English, 简体中文
telegram-bot-manager is a robot manager for telegram.
go install github.com/pefish/telegram-bot-manager/cmd/telegram-bot-manager@latest
telegram-bot-manager --config="/path/to/sample.yaml"
Robot manager will reply all updates automatically according to the rules in /path/to/sample.js
.
/path/to/config.yaml
token: "***"
commandsJsFile: "/path/to/sample.js"
/path/to/sample.js
var commands = {
"/test": function (args) {
// console.log(args)
return "test: " + JSON.stringify(args)
},
"/haha": function (args) {
return "xixi"
}
}
搜索 BotFather,创建机器人,得到 token
- 将机器人添加到群组
- 在群里随便发送一个消息。比如 /test abc
- 浏览器访问 https://api.telegram.org/botXXX:YYYY/getUpdates (XXX:YYYY 是 token),可以获取到机器人所在组中发的所有命令
- 从返回结果中找到 chat id
- Fork 仓库
- 代码 Clone 到你本机
- 创建feature分支 (
git checkout -b my-new-feature
) - 编写代码然后 Add 代码 (
git add .
) - Commin 代码 (
git commit -m 'Add some feature'
) - Push 代码 (
git push origin my-new-feature
) - 提交pull request
如果你发现了一个安全漏洞,请发送邮件到[email protected]。