Skip to content

Rocket.Chat

https://rocket.chat/

https://docs.rocket.chat/

https://github.com/RocketChat

https://github.com/RocketChat/Rocket.Chat

安卓客户端:

https://github.com/RocketChat/Rocket.Chat.Android/releases

需要 google play 支持,可以直接用网页访问

ubuntu 部署

https://wlfcss.com/rocket-chat-bu-shu-zhi-nan/

1
2
3
4
5
6
apt update -y

snap install rocketchat-server

# 检查是否在允许,按 q 可以退出
service snap.rocketchat-server.rocketchat-server status

安装nginx:

1
2
3
4
5
6
apt install -y nginx
# 开机自动启动
systemctl enable nginx

# 创建反向代理配置
vim /etc/nginx/sites-available/rocketchat.conf
1
2
3
4
5
6
7
8
9
server {
    listen 2333;

    server_name example.com;

    location / {
        proxy_pass http://localhost:3000/;
    }
}

将这里的 example.com 修改为你自己的域名。

1
2
3
4
5
ln -s /etc/nginx/sites-available/rocketchat.conf /etc/nginx/sites-enabled/

ls -l /etc/nginx/sites-enabled
total 0
lrwxrwxrwx 1 root root 42 May 18 11:19 rocketchat.conf -> /etc/nginx/sites-available/rocketchat.conf

检查配置:

1
2
3
4
5
6
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# 重新加载 nginx 配置
nginx -s reload

注意要开放对应的服务器端口

使用

首先创建管理员(我这里管理员用户名为 nocilantro)并且登录
然后再创建一个机器人 dog
新建一个频道 trade
频道里添加 dog 进去

py使用

https://github.com/jadolg/rocketchat_API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from pprint import pprint
from rocketchat_API.rocketchat import RocketChat

rocket = RocketChat('dog', 'xxxxxx', server_url='http://xx.xx.xx.xx:2333')

rocket.chat_post_message('🐶', channel='trade')

# pprint(rocket.chat_post_message('🐶', channel='trade').json())

# pprint(rocket.chat_post_message('🐶 @nocilantro', channel='trade').json())

# pprint(rocket.chat_post_message('🐶 @nocilantro', channel='trade', alias='Rocket.cat').json())

api

https://developer.rocket.chat/api/rest-api