Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ config/config/*
model/db/data.db
model/satori
**/test.js
!.gitignore
!.gitignore
pnpm-lock.yaml
24 changes: 24 additions & 0 deletions components/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,30 @@ async function createWebSocket (data) {
delete data.close
}
data.rawName = data.rawName || data.name
if (data.uin === 'all') {
let uinList = []
if (global.Bot) {
if (Array.isArray(global.Bot.uin)) {
uinList = _.cloneDeep(global.Bot.uin)
} else {
uinList = [global.Bot.uin]
for (const i in global.Bot) {
const uinNum = Number(i)
if (/^\d{5,12}$/.test(i) && !uinList.includes(uinNum)) {
uinList.push(uinNum)
}
}
}
}
// Filter out invalid uins if any
uinList = uinList.filter(u => u)

if (uinList.length > 0) {
data.uin = uinList
await createWebSocket(data)
return
}
}
if (Array.isArray(data.uin)) {
for (const uin of data.uin) {
const str = String(uin)
Expand Down
1 change: 1 addition & 0 deletions config/default_config/ws-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ onlyReplyAt:
# maxReconnectAttempts: 最大连接次数 0 为无限制
# accessToken: 鉴权token
# accessKey: 鉴权token的前缀 比如Bearer 默认为Token
# uin: 绑定的Bot账号, 可填all绑定所有Bot
servers:
- name: ws_name
address: ws_address
Expand Down