1- import { param , Router , type Session , type types } from '../src' ;
1+ import { type milky , param , Router , type Session } from '../src' ;
22
33import assert from 'node:assert/strict' ;
44import test from 'node:test' ;
55
6- function text ( text : string ) : types . IncomingTextSegment {
6+ function text ( text : string ) : milky . IncomingTextSegment {
77 return {
88 type : 'text' ,
99 data : { text } ,
1010 } ;
1111}
1212
13- function mention ( userId : number , name = 'tester' ) : types . IncomingMentionSegment {
13+ function mention ( userId : number , name = 'tester' ) : milky . IncomingMentionSegment {
1414 return {
1515 type : 'mention' ,
1616 data : {
@@ -20,26 +20,26 @@ function mention(userId: number, name = 'tester'): types.IncomingMentionSegment
2020 } ;
2121}
2222
23- function message ( segments : types . IncomingSegment [ ] ) : types . IncomingMessage {
23+ function message ( segments : milky . IncomingSegment [ ] ) : milky . IncomingMessage {
2424 return {
2525 message_scene : 'friend' ,
2626 peer_id : 1 ,
2727 message_seq : 1 ,
2828 sender_id : 1 ,
2929 time : 1 ,
3030 segments,
31- friend : { } as types . FriendEntity ,
31+ friend : { } as milky . FriendEntity ,
3232 } ;
3333}
3434
35- function session ( raw : types . IncomingMessage ) : Session {
35+ function session ( raw : milky . IncomingMessage ) : Session {
3636 return {
3737 raw,
3838 async reply ( ) { } ,
3939 } ;
4040}
4141
42- async function dispatch ( router : Router , segments : types . IncomingSegment [ ] ) : Promise < boolean > {
42+ async function dispatch ( router : Router , segments : milky . IncomingSegment [ ] ) : Promise < boolean > {
4343 const raw = message ( segments ) ;
4444 return await router . dispatch ( session ( raw ) , raw ) ;
4545}
@@ -165,7 +165,7 @@ test('rejects empty raw patterns and literal-first raw patterns', () => {
165165test ( 'captures non-text segments with segment parameters' , async ( ) => {
166166 const router = new Router ( ) ;
167167 const target = mention ( 42 , 'alice' ) ;
168- let captured : types . IncomingMentionSegment | undefined ;
168+ let captured : milky . IncomingMentionSegment | undefined ;
169169
170170 router . command ( 'poke' , { target : param . segment ( 'mention' ) } , ( _session , params ) => {
171171 captured = params . target ;
0 commit comments