add bx to bot api
This commit is contained in:
1 parent
97c4d4b617
commit
9e5357eaa8
11 files changed
+80
-21
No files matched your search
@@ -11,6 +11,7 @@ RUN go -C /src/headless/vk build -trimpath -ldflags="-s -w" -o /out/headl
|
||||
&& go -C /src/headless/telemost build -trimpath -ldflags="-s -w" -o /out/headless-telemost-creator . \
|
||||
&& go -C /src/headless/wbstream build -trimpath -ldflags="-s -w" -o /out/headless-wbstream-creator . \
|
||||
&& go -C /src/headless/dion build -trimpath -ldflags="-s -w" -o /out/headless-dion-creator . \
|
||||
&& go -C /src/headless/bitrix build -trimpath -ldflags="-s -w" -o /out/headless-bitrix-creator . \
|
||||
&& go -C /src/headless/vk-bot build -trimpath -ldflags="-s -w" -o /out/headless-vk-bot .
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
@@ -26,6 +27,7 @@ COPY --from=build /out/headless-vk-creator /opt/wlb/bin/
|
||||
COPY --from=build /out/headless-telemost-creator /opt/wlb/bin/
|
||||
COPY --from=build /out/headless-wbstream-creator /opt/wlb/bin/
|
||||
COPY --from=build /out/headless-dion-creator /opt/wlb/bin/
|
||||
COPY --from=build /out/headless-bitrix-creator /opt/wlb/bin/
|
||||
COPY --from=build /out/headless-vk-bot /usr/local/bin/
|
||||
|
||||
COPY headless/docker/entrypoint.sh /usr/local/bin/wlb-entrypoint
|
||||
|
||||
@@ -16,6 +16,7 @@ services:
|
||||
- ./cookies-yandex.json:/data/cookies-yandex.json:ro
|
||||
- ./cookies-wbstream.json:/data/cookies-wbstream.json:ro
|
||||
- ./cookies-dion.json:/data/cookies-dion.json
|
||||
- ./cookies-bitrix.json:/data/cookies-bitrix.json
|
||||
# Per-session creator logs persist here.
|
||||
- bot-sessions:/data/sessions
|
||||
|
||||
|
||||
@@ -12,14 +12,17 @@ VK_COOKIES_DEFAULT="/data/cookies-vk.json"
|
||||
TM_COOKIES_DEFAULT="/data/cookies-yandex.json"
|
||||
WB_COOKIES_DEFAULT="/data/cookies-wbstream.json"
|
||||
DION_COOKIES_DEFAULT="/data/cookies-dion.json"
|
||||
BITRIX_COOKIES_DEFAULT="/data/cookies-bitrix.json"
|
||||
VK_COOKIES="${VK_COOKIES:-}"
|
||||
TM_COOKIES="${TM_COOKIES:-}"
|
||||
WB_COOKIES="${WB_COOKIES:-}"
|
||||
DION_COOKIES="${DION_COOKIES:-}"
|
||||
BITRIX_COOKIES="${BITRIX_COOKIES:-}"
|
||||
[ -z "$VK_COOKIES" ] && [ -f "$VK_COOKIES_DEFAULT" ] && VK_COOKIES="$VK_COOKIES_DEFAULT"
|
||||
[ -z "$TM_COOKIES" ] && [ -f "$TM_COOKIES_DEFAULT" ] && TM_COOKIES="$TM_COOKIES_DEFAULT"
|
||||
[ -z "$WB_COOKIES" ] && [ -f "$WB_COOKIES_DEFAULT" ] && WB_COOKIES="$WB_COOKIES_DEFAULT"
|
||||
[ -z "$DION_COOKIES" ] && [ -f "$DION_COOKIES_DEFAULT" ] && DION_COOKIES="$DION_COOKIES_DEFAULT"
|
||||
[ -z "$BITRIX_COOKIES" ] && [ -f "$BITRIX_COOKIES_DEFAULT" ] && BITRIX_COOKIES="$BITRIX_COOKIES_DEFAULT"
|
||||
|
||||
mkdir -p "$SESSIONS_DIR"
|
||||
|
||||
@@ -35,6 +38,7 @@ set -- \
|
||||
[ -n "$TM_COOKIES" ] && set -- "$@" --tm-cookies "$TM_COOKIES"
|
||||
[ -n "$WB_COOKIES" ] && set -- "$@" --wb-cookies "$WB_COOKIES"
|
||||
[ -n "$DION_COOKIES" ] && set -- "$@" --dion-cookies "$DION_COOKIES"
|
||||
[ -n "$BITRIX_COOKIES" ] && set -- "$@" --bitrix-cookies "$BITRIX_COOKIES"
|
||||
[ -n "${UPSTREAM_SOCKS:-}" ] && set -- "$@" --upstream-socks "$UPSTREAM_SOCKS"
|
||||
[ -n "${UPSTREAM_USER:-}" ] && set -- "$@" --upstream-user "$UPSTREAM_USER"
|
||||
[ -n "${UPSTREAM_PASS:-}" ] && set -- "$@" --upstream-pass "$UPSTREAM_PASS"
|
||||
|
||||
@@ -27,6 +27,8 @@ func platformSquare(platform string) string {
|
||||
return "🟪"
|
||||
case "dion":
|
||||
return "🟩"
|
||||
case "bitrix":
|
||||
return "🟧"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -43,6 +45,9 @@ func mainMenuKeyboard() string {
|
||||
{Action: kbAction{Type: "text", Label: "🟪 WBStream", Payload: `{"cmd":"wb"}`}},
|
||||
{Action: kbAction{Type: "text", Label: "🟩 DION", Payload: `{"cmd":"dion"}`}},
|
||||
},
|
||||
{
|
||||
{Action: kbAction{Type: "text", Label: "🟧 Bitrix", Payload: `{"cmd":"bitrix"}`}},
|
||||
},
|
||||
{
|
||||
{Action: kbAction{Type: "text", Label: "🔗 Join by link", Payload: `{"cmd":"join-prompt"}`}},
|
||||
},
|
||||
|
||||
+23
-12
@@ -59,16 +59,17 @@ type session struct {
|
||||
}
|
||||
|
||||
type bot struct {
|
||||
token string
|
||||
groupID string
|
||||
userIDs []string
|
||||
binsDir string
|
||||
vkCookies string
|
||||
tmCookies string
|
||||
wbCookies string
|
||||
dionCookies string
|
||||
sessionsDir string
|
||||
resources string
|
||||
token string
|
||||
groupID string
|
||||
userIDs []string
|
||||
binsDir string
|
||||
vkCookies string
|
||||
tmCookies string
|
||||
wbCookies string
|
||||
dionCookies string
|
||||
bitrixCookies string
|
||||
sessionsDir string
|
||||
resources string
|
||||
|
||||
upstreamSocks string
|
||||
upstreamUser string
|
||||
@@ -207,7 +208,7 @@ func (b *bot) handleMessage(peerID, fromID int64, text, payload string) {
|
||||
delete(b.awaitingJoin, peerID)
|
||||
b.mu.Unlock()
|
||||
switch p.Cmd {
|
||||
case "vk", "tm", "wb", "dion":
|
||||
case "vk", "tm", "wb", "dion", "bitrix":
|
||||
b.handleSpawn(peerID, p.Cmd, "")
|
||||
return
|
||||
case "list":
|
||||
@@ -236,7 +237,7 @@ func (b *bot) handleMessage(peerID, fromID int64, text, payload string) {
|
||||
return
|
||||
}
|
||||
if wasAwaiting {
|
||||
b.sendMessage(peerID, "Couldn't detect a VK / Telemost / WBStream / DION link. Paste a join link or press Back.", waitingKeyboard())
|
||||
b.sendMessage(peerID, "Couldn't detect a VK / Telemost / WBStream / DION / Bitrix link. Paste a join link or press Back.", waitingKeyboard())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -251,6 +252,8 @@ func (b *bot) handleMessage(peerID, fromID int64, text, payload string) {
|
||||
b.handleSpawn(peerID, "wb", "")
|
||||
case strings.HasPrefix(text, "/dion"):
|
||||
b.handleSpawn(peerID, "dion", "")
|
||||
case strings.HasPrefix(text, "/bitrix"):
|
||||
b.handleSpawn(peerID, "bitrix", "")
|
||||
case text == "/list":
|
||||
b.handleList(peerID)
|
||||
case strings.HasPrefix(text, "/close "):
|
||||
@@ -272,6 +275,8 @@ func detectJoinLink(text string) (platform, target string, ok bool) {
|
||||
return "tm", trimmed, true
|
||||
case strings.HasPrefix(lower, "dion://"), strings.Contains(lower, "dion.vc"):
|
||||
return "dion", trimmed, true
|
||||
case strings.Contains(lower, "bitrix24") && strings.Contains(lower, "/video/"):
|
||||
return "bitrix", trimmed, true
|
||||
case strings.Contains(lower, "vk.ru/call/join"):
|
||||
return "vk", trimmed, true
|
||||
}
|
||||
@@ -324,6 +329,10 @@ func (b *bot) spawn(platform, joinTarget string) (*session, error) {
|
||||
binName = "headless-dion-creator"
|
||||
cookies = b.dionCookies
|
||||
joinFlag = "--room"
|
||||
case "bitrix":
|
||||
binName = "headless-bitrix-creator"
|
||||
cookies = b.bitrixCookies
|
||||
joinFlag = "--room"
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown platform: %s", platform)
|
||||
}
|
||||
@@ -490,6 +499,7 @@ func main() {
|
||||
tmCookies := flag.String("tm-cookies", "", "path to Yandex cookies JSON for Telemost")
|
||||
wbCookies := flag.String("wb-cookies", "", "path to WB Stream cookies JSON")
|
||||
dionCookies := flag.String("dion-cookies", "", "path to DION cookies JSON")
|
||||
bitrixCookies := flag.String("bitrix-cookies", "", "path to Bitrix cookies JSON")
|
||||
sessionsDir := flag.String("sessions-dir", "", "directory for per-session creator logs (optional)")
|
||||
resources := flag.String("resources", "default", "resource mode forwarded to spawned creators: default, moderate, unlimited")
|
||||
upstreamSocks := flag.String("upstream-socks", "", "forward to spawned creators: route tunneled egress through this SOCKS5 proxy (host:port), e.g. a local VPN client")
|
||||
@@ -531,6 +541,7 @@ func main() {
|
||||
tmCookies: *tmCookies,
|
||||
wbCookies: *wbCookies,
|
||||
dionCookies: *dionCookies,
|
||||
bitrixCookies: *bitrixCookies,
|
||||
sessionsDir: *sessionsDir,
|
||||
resources: *resources,
|
||||
upstreamSocks: *upstreamSocks,
|
||||
|
||||
Reference in new issue
Block a user