可供多人发送消息的 telegram 机器人 api , 类似server酱的开源实现
- Server酱Turbo:支持企业微信、微信服务号、钉钉、飞书群机器人等多通道的在线服务,无需搭建直接使用,每天有免费额度
- Wecom酱:通过企业微信推送消息到微信的消息推送函数和在线服务方案,开源免费,可自己搭建。支持多语言
- Tele酱:可以通过 Vercel 免费部署,且部署后 API 在国内网络可访问的 Telegram 多账户消息推送机器人
- 添加 @TeleChan8Bot
- 发送 /sendkey 获得 key 和 url
- 通过 url 发送请求即可
- add @TeleChan8Bot in telegram
/sendkey
to get key & url- send request via url
- star and fork this repo
- goto https://vercel.com/ create a new project, select the repo just created
- add BotFather in telegram, create new bot and get
telegram api token
- set output dir to
dist
, setBOT_TOKEN
totelegram api token
, setTCKEY
a random string - deploy
- send /sendkey command to the bot, you will get sendkey and api url
Both HTTP GET
or POST
are OK
- sendkey,required
- text,required
- desp,optional
- markdown,optional
text
and desp
support telegram markdown which is a very small subset of markdown without image support
function tg_send( $text , $desp = '' , $key = '<sendkey>' )
{
$postdata = http_build_query( array( 'text' => $text, 'desp' => $desp ));
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata));
$context = stream_context_create($opts);
return $result = file_get_contents('telechan8.vercel.app/api/send?sendkey='.$key, false, $context);
}
Heavily modified base Telegram Bot Boilerplate with Vercel's Serverless Functions
参数说明:
- sendkey,required
- text,required
- desp,optional
- markdown,optional
仅支持部分 Markdown 语法,任何不兼容以下语法的的提交,都会导致 400 错误。注意不支持图片,注意不支持图片,注意不支持图片:
*bold \*text*
_italic \*text_
__underline__
~strikethrough~
*bold _italic bold ~italic bold strikethrough~ __underline italic bold___ bold*
[inline URL](http://www.example.com/)
[inline mention of a user](tg://user?id=123456789)
`inline fixed-width code`
```
pre-formatted fixed-width code block
```
```python
pre-formatted fixed-width code block written in the Python programming language
```