fix: 修复空指针访问问题
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -30,13 +30,13 @@ export const qqbotPlugin: ChannelPlugin<ResolvedQQBotAccount> = {
|
|||||||
listAccountIds: (cfg) => listQQBotAccountIds(cfg),
|
listAccountIds: (cfg) => listQQBotAccountIds(cfg),
|
||||||
resolveAccount: (cfg, accountId) => resolveQQBotAccount(cfg, accountId),
|
resolveAccount: (cfg, accountId) => resolveQQBotAccount(cfg, accountId),
|
||||||
defaultAccountId: () => DEFAULT_ACCOUNT_ID,
|
defaultAccountId: () => DEFAULT_ACCOUNT_ID,
|
||||||
isConfigured: (account) => Boolean(account.appId && account.clientSecret),
|
isConfigured: (account) => Boolean(account?.appId && account?.clientSecret),
|
||||||
describeAccount: (account) => ({
|
describeAccount: (account) => ({
|
||||||
accountId: account.accountId,
|
accountId: account?.accountId ?? DEFAULT_ACCOUNT_ID,
|
||||||
name: account.name,
|
name: account?.name,
|
||||||
enabled: account.enabled,
|
enabled: account?.enabled ?? false,
|
||||||
configured: Boolean(account.appId && account.clientSecret),
|
configured: Boolean(account?.appId && account?.clientSecret),
|
||||||
tokenSource: account.secretSource,
|
tokenSource: account?.secretSource,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
setup: {
|
setup: {
|
||||||
@@ -118,11 +118,11 @@ export const qqbotPlugin: ChannelPlugin<ResolvedQQBotAccount> = {
|
|||||||
lastError: null,
|
lastError: null,
|
||||||
},
|
},
|
||||||
buildAccountSnapshot: ({ account, runtime }) => ({
|
buildAccountSnapshot: ({ account, runtime }) => ({
|
||||||
accountId: account.accountId,
|
accountId: account?.accountId ?? DEFAULT_ACCOUNT_ID,
|
||||||
name: account.name,
|
name: account?.name,
|
||||||
enabled: account.enabled,
|
enabled: account?.enabled ?? false,
|
||||||
configured: Boolean(account.appId && account.clientSecret),
|
configured: Boolean(account?.appId && account?.clientSecret),
|
||||||
tokenSource: account.secretSource,
|
tokenSource: account?.secretSource,
|
||||||
running: runtime?.running ?? false,
|
running: runtime?.running ?? false,
|
||||||
connected: runtime?.connected ?? false,
|
connected: runtime?.connected ?? false,
|
||||||
lastConnectedAt: runtime?.lastConnectedAt ?? null,
|
lastConnectedAt: runtime?.lastConnectedAt ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user