Coder Social home page Coder Social logo

easychen / telechan Goto Github PK

View Code? Open in Web Editor NEW
414.0 9.0 295.0 31 KB

message api for telegram bot 可供多人发送消息的 telegram 机器人 api , 类似server酱的开源实现

Home Page: telechan8.vercel.app

License: MIT License

Shell 1.79% TypeScript 98.21%

telechan's Introduction

⚠️⚠️⚠️ 由于近期 vercel 环境疑似做了调整,新部署的机器人识别命令会报错(原来创建的机器人不受影响),我最近没空修改此项目,先 Archive 掉。着急使用的同学可以 fork & fix 先。

TeleChan - message api for telegram bot

可供多人发送消息的 telegram 机器人 api , 类似server酱的开源实现

🎈 本项目属于方糖推送生态。该生态包含项目如下:

  • Server酱Turbo:支持企业微信、微信服务号、钉钉、飞书群机器人等多通道的在线服务,无需搭建直接使用,每天有免费额度
  • Wecom酱:通过企业微信推送消息到微信的消息推送函数和在线服务方案,开源免费,可自己搭建。支持多语言
  • Tele酱:可以通过 Vercel 免费部署,且部署后 API 在国内网络可访问的 Telegram 多账户消息推送机器人

直接试用我搭建的机器人

  1. 添加 @TeleChan8Bot
  2. 发送 /sendkey 获得 key 和 url
  3. 通过 url 发送请求即可

Example

  1. add @TeleChan8Bot in telegram
  2. /sendkey to get key & url
  3. send request via url

How to use

  1. star and fork this repo
  2. goto https://vercel.com/ create a new project, select the repo just created
  3. add BotFather in telegram, create new bot and get telegram api token
  4. set output dir to dist , set BOT_TOKEN to telegram api token, set TCKEY a random string image
  5. deploy
  6. send /sendkey command to the bot, you will get sendkey and api url

API

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

send function

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);
 
}

Thanks

Heavily modified base Telegram Bot Boilerplate with Vercel's Serverless Functions

中文教程

image

安装视频@B站,欢迎关注作者

参数说明:

  • 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
    ```

telechan's People

Contributors

easychen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telechan's Issues

Cant get "send_key"

when i finish deployment, i found that the rebot kept sending “This is a test bot”
and i cant get [send_key] by sending "/send_key"

Is anyone in the same situation as me?

[Enhancement] Add `revoke` function to avoid message flooding via leaked sendkey

希望机器人添加一个撤销 sendkey 的命令。

目前如果 sendkey 泄漏,就能一直给账号推送消息。而且我看了一下生成的 sendkey 也没有储存到数据库,没法在服务端从数据库里删除。

有段时间没用 Server 酱了,不清楚有没有类似的功能,Tele 酱里看代码没写这个功能,不过我对 TypeScript / JavaScript 不是很熟,直接提交 PR 是指望不上了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.