Skip to content
 
 

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TG Bot Scraper

Build

docker build -t scraper -f ./backend/Dockerfile ./backend
docker build -t telegram-bot -f ./bot/packages/telegram/dockerfile ./bot/packages/telegram 

Deploy

配置docker-compose.yaml

NOSTR_PRIV_KEY: nsec1ufnus6pju578ste3v90xd5m2decpuzpql2295m3sknqcjzyys9ls0qlc85 #nostr私钥
NOSTR_RELAY_URIS: wss://relay.damus.io,wss://relay.atoms.io #nostr relay uri,逗号分隔

配置bot/packages/telegram/dockerfile中的TELEGRAM_BOT_TOKEN

ENV TELEGRAM_BOT_TOKEN=7926431835:AAEjbScqFyl9W6Qu907xOfoGkZ8EKFpvJgM

启动

docker compose up -d

API

Add Message

插入消息

POST

/api/add_message

{
    "group_id":"", 
    "user_id":"",
    "username":"",
    "message":""
}

GetMessageCnt

查询群组消息数

请求

POST

/api/get_message_cnt

{
    "group_id":""
}

返回

{
    "user_msg_cnt": [
        {
            "user_id": "bob001",
            "cnt": 2 //用户在群组内消息总数
        },
        {
            "user_id": "alice001",
            "cnt": 3
        }
    ],
    "group_cnt": 5 //群组消息总数
}

GetMessageByUser

分页查询指定成员在指定群组的发言记录

请求

POST

/api/get_message_by_user

{
    "group_id":"1001",
    "user_id":"bob001",
    "page_num":1,
    "page_size":100
}

返回

{
    "user_id": "bob001",
    "messages": [
        {
            "group_id": "1001",
            "user_id": "bob001",
            "username": "bob",
            "message": "this this 99ckolo 222",
            "timestamp": "Sun, 26 Jan 2025 05:35:47 -0000"
        },
        {
            "id": 1,
            "group_id": "1001",
            "user_id": "bob001",
            "username": "bob",
            "message": "this this 99ckolo 111",
            "timestamp": "Sun, 26 Jan 2025 05:35:43 -0000"
        }
    ],
    "cnt": 2 //用户在群组内消息总数
}

GetMessageCntByUser

POST /api/get_message_cnt_by_user

请求

{
    "group_id":"1001",
    "user_id":"bob001"
}

返回

{
    "user_id": "bob001",
    "cnt": 2 //用户在群组内消息总数
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages