Skip to content

avplayer/avbot_webclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avbot Chat WebClient(社区在线聊天网页客户端)

Avbot Chat WebClient用来桥接网页和Telegram,让av社区的友人不用登录IRC安装任何客户端即可参与社区技术讨论。
网站地址:https://avplayer.github.io/avbot_webclient

特点

  • 完全采用Websocket协议
  • 全程HTTPS TLS1.2加密

通讯协议

bot向web推送text消息

{
    "cmd" : 1,
    "data" : {
        "id" : 123,
        "timestamp" : "1503132689",
        "msg" : "this is a message text",
        "from" : "nickname",
        "user" : {
            "id" : 162385454,
            "name" : "username"
        }
    }
}

bot向web推送image消息

{
    "cmd" : 2,
    "data" : {
        "id" : 123,
        "timestamp" : "392873947",
        "file_path" : "/avbot/file/tg/f43f432gfdsyh",
        "caption" : "this is a message text near the picture",
        "from" : "nickname",
        "user" : {
            "id" : 162385454,
            "name" : "username"
        }
    }
}
  • img_type可为:image/png、image/jpeg等
  • img_data为:base64 string from image file

bot向web推送audio/video消息

{
    "cmd" : 3,
    "data" : {
        "id" : 123,
        "timestamp" : "392873947",
        "file_path" : "avbot/file/tg/5g43g56h56"
        "from" : "nickname",
        "user" : {
            "id" : 162385454,
            "name" : "username"
        }
    }
}
  • video_type可为:video/mp4、audio/mpeg3等
  • video_data为:base64 string from audio/video file

web向bot发送text消息

{
    "cmd" : 1,
    "data" : {
        "msg" : "this is a message text",
        "from" : "nickname"
    }
}

web向bot发送image消息

{
    "cmd" : 2,
    "data" : {
        "img_type" : "image/png",
        "img_data" : "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
        "caption" : "this is a message text near the picture",
        "from" : "nickname"
    }
}