File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed
Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,29 @@ import { msteamsPlugin } from "./channel.js";
99describe ( "msteams directory" , ( ) => {
1010 const runtimeEnv = createDirectoryTestRuntime ( ) as RuntimeEnv ;
1111
12+ describe ( "self()" , ( ) => {
13+ it ( "returns bot identity when credentials are configured" , async ( ) => {
14+ const cfg = {
15+ channels : {
16+ msteams : {
17+ appId : "test-app-id-1234" ,
18+ appPassword : "secret" ,
19+ tenantId : "tenant-id-5678" ,
20+ } ,
21+ } ,
22+ } as unknown as OpenClawConfig ;
23+
24+ const result = await msteamsPlugin . directory ?. self ?.( { cfg, runtime : runtimeEnv } ) ;
25+ expect ( result ) . toEqual ( { kind : "user" , id : "test-app-id-1234" , name : "test-app-id-1234" } ) ;
26+ } ) ;
27+
28+ it ( "returns null when credentials are not configured" , async ( ) => {
29+ const cfg = { channels : { } } as unknown as OpenClawConfig ;
30+ const result = await msteamsPlugin . directory ?. self ?.( { cfg, runtime : runtimeEnv } ) ;
31+ expect ( result ) . toBeNull ( ) ;
32+ } ) ;
33+ } ) ;
34+
1235 it ( "lists peers and groups from config" , async ( ) => {
1336 const cfg = {
1437 channels : {
Original file line number Diff line number Diff line change @@ -217,6 +217,13 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount> = {
217217 } ,
218218 } ,
219219 directory : createChannelDirectoryAdapter ( {
220+ self : async ( { cfg } ) => {
221+ const creds = resolveMSTeamsCredentials ( cfg . channels ?. msteams ) ;
222+ if ( ! creds ) {
223+ return null ;
224+ }
225+ return { kind : "user" as const , id : creds . appId , name : creds . appId } ;
226+ } ,
220227 listPeers : async ( { cfg, query, limit } ) =>
221228 listDirectoryEntriesFromSources ( {
222229 kind : "user" ,
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ export type MSTeamsAdapter = {
6161 res : unknown ,
6262 logic : ( context : unknown ) => Promise < void > ,
6363 ) => Promise < void > ;
64+ updateActivity : ( context : unknown , activity : object ) => Promise < void > ;
65+ deleteActivity : ( context : unknown , reference : { activityId ?: string } ) => Promise < void > ;
6466} ;
6567
6668export type MSTeamsReplyRenderOptions = {
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ export type MSTeamsActivityHandler = {
2121 onMembersAdded : (
2222 handler : ( context : unknown , next : ( ) => Promise < void > ) => Promise < void > ,
2323 ) => MSTeamsActivityHandler ;
24+ onReactionsAdded : (
25+ handler : ( context : unknown , next : ( ) => Promise < void > ) => Promise < void > ,
26+ ) => MSTeamsActivityHandler ;
27+ onReactionsRemoved : (
28+ handler : ( context : unknown , next : ( ) => Promise < void > ) => Promise < void > ,
29+ ) => MSTeamsActivityHandler ;
2430 run ?: ( context : unknown ) => Promise < void > ;
2531} ;
2632
You can’t perform that action at this time.
0 commit comments