File tree Expand file tree Collapse file tree
extensions/qqbot/src/bridge/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,6 +130,32 @@ describe("bridge/tools/channel", () => {
130130 expect ( getAccessTokenMock ) . not . toHaveBeenCalled ( ) ;
131131 } ) ;
132132
133+ it ( "does not expose the tool when the active account is disabled" , ( ) => {
134+ const disabledAccount = {
135+ ...cfg ,
136+ channels : {
137+ qqbot : {
138+ ...cfg . channels ?. qqbot ,
139+ accounts : {
140+ bot2 : {
141+ ...cfg . channels ?. qqbot ?. accounts ?. bot2 ,
142+ enabled : false ,
143+ } ,
144+ } ,
145+ } ,
146+ } ,
147+ } as OpenClawConfig ;
148+
149+ expect (
150+ registerToolFactory ( disabledAccount ) ( {
151+ messageChannel : "qqbot" ,
152+ agentAccountId : "bot2" ,
153+ } ) ,
154+ ) . toBeNull ( ) ;
155+ expect ( getAccessTokenMock ) . not . toHaveBeenCalled ( ) ;
156+ expect ( fetchWithSsrFGuardMock ) . not . toHaveBeenCalled ( ) ;
157+ } ) ;
158+
133159 it ( "does not treat another channel's account ID as a QQBot account" , async ( ) => {
134160 const tool = registerToolFactory ( ) ( { messageChannel : "discord" , agentAccountId : "bot2" } ) ;
135161 expect ( tool ) . not . toBeNull ( ) ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ function createChannelTool(
2929 ? ( context . agentAccountId ?? context . deliveryContext ?. accountId )
3030 : undefined ,
3131 ) ;
32- if ( ! account . appId || ! account . clientSecret ) {
32+ if ( ! account . enabled || ! account . appId || ! account . clientSecret ) {
3333 return null ;
3434 }
3535
You can’t perform that action at this time.
0 commit comments