一个可以可以统计群组用户发言,并且能将聊天内容生成词云的机器人
Go to file
机器人总动员 d4e5658236 更新演示
2021-05-05 19:13:49 +08:00
test/__pycache__ None 2021-05-05 16:13:28 +08:00
circle.png None 2021-05-05 16:13:28 +08:00
config.py None 2021-05-05 11:10:01 +08:00
connector.py None 2021-05-05 15:35:04 +08:00
Dockerfile 修复系统时间错误 2021-05-05 18:41:42 +08:00
font.ttf None 2021-05-05 16:13:28 +08:00
func.py 添加 /start 检测功能 2021-05-05 18:28:26 +08:00
main.py 添加报表生成时间段 2021-05-05 18:17:21 +08:00
README.md 更新演示 2021-05-05 19:13:49 +08:00
requirements.txt 添加依赖文件 2021-05-05 16:36:32 +08:00
task.py 添加报表生成时间段 2021-05-05 18:17:21 +08:00

演示

xq9iR.png

配置要求

内存1G以上

安装方法

使用 Docker 安装

Docker官方安装地址点击访问

cd /root

# 拉取Redis镜像
docker pull redis

# 创建 entrypoint.sh 入口文件
echo '#! /bin/sh \
cd /root/word_cloud_bot && python3 main.py >> output 2>&1 &
tail -f /dev/null' > /root/entrypoint.sh

# 创建 Dockerfile
wget -O /root/Dockerfile https://github.com/devourbots/word_cloud_bot/raw/master/Dockerfile

# 修改机器人TOKEN
vi /root/Dockerfile

在第8行修改你的机器人TOKEN

修改后:
RUN echo 'TOKEN = "1749418611:AAGcpouQ4EWSDITLQXFozHjMgT_-MsVSmDM"' > /root/word_cloud_bot/config.py


# 根据 Dockerfile 创建镜像
docker build . -t world_cloud_bot:latest

# 运行 Redis 镜像,此步在前
docker run -d -p 6379:6379 redis:latest

# 运行 机器人,此步在后
docker run -d --net=host world_cloud_bot:latest

使用方法

使用 /start 指令测试机器人与 Redis 数据库的连通情况

将机器人拉入群组,设置为管理员(不需要其他权限),设置完毕

xqyvt.png

将机器人设置为仅自己群组可用

如果您不想让别人使用你的机器人,那么可以将 func.py 文件中的

    # if chat_id not in ["1231242141"]:
    #     return

该段注释取消并将自己的群组ID加入到列表中。

例如我两个的群组ID分别为-127892174935、-471892571924

那么修改后为:

    if chat_id not in ["-127892174935", "-471892571924"]:
        return