Skip to content

Commit

Permalink
feat: 获取已登录的账户列表
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Oct 5, 2024
1 parent a892c51 commit 33b080b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ntqq/core/service/nt-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useLogger } from "../../../common/log";
import EventEmitter from "events";

const log = useLogger('NTWrapper')
let globalModuleIndex = 1;
export const useNTWrapper = () => {
// QQ号索引处理
const asyncStore = useAsyncStore()
Expand All @@ -18,8 +17,9 @@ export const useNTWrapper = () => {
const userStore = useNTUserStore().getAllAccountData()
if (!userStore[id])
{
const idx = globalModuleIndex++
log.info('wrapper index:', id, idx)
const ids = Object.keys(userStore)
const idx = ids.length + 1
log.info('wrapper index:', id, idx, ids)
const wrapper = useWrapper(idx)
userStore[id] = {
moduleIndex: idx,
Expand Down
6 changes: 6 additions & 0 deletions src/onebot/actions/bot/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const QuickLoginByUin = async (p: QuickLoginReq) => {
}
return {}
}
const getAccountList = (p: BotActionParams): any => {
const { getAllAccountData } = useNTUserStore()
const allAccount = getAllAccountData()
return Object.keys(allAccount).filter(e => e !== '1234567890')
}
export const initBot = () => {
const { registerActionHandle } = useStore()
// 登录
Expand All @@ -69,4 +74,5 @@ export const initBot = () => {
registerActionHandle('get_quick_login_list', getQuickLoginList)
registerActionHandle('quick_login_by_uin', QuickLoginByUin)
registerActionHandle('get_clipboard_msg', getClipboardMsg)
registerActionHandle('get_account_list', getAccountList)
}

0 comments on commit 33b080b

Please sign in to comment.