-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
58 lines (42 loc) · 1.37 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// <reference types="node" />
import * as oicq from 'oicq'
export interface MessageContext extends Context {
postType: "message",
event: oicq.GroupMessageEvent | oicq.PrivateMessageEvent | oicq.DiscussMessageEvent,
msgId: string,
rawMsg: string,
message: oicq.MessageElem[],
userId: number,
groupId: number,
groupName: string,
}
export interface RequestContext extends Context {
postType: "request",
event: oicq.GroupRequestEvent | oicq.FriendRequestEvent,
}
export interface NoticeContext extends Context {
postType: "notice",
event: oicq.GroupNoticeEvent | oicq.FriendNoticeEvent,
}
export interface Context {
bot: Kocq,
botId: number,
reply: (this: Event, message: string) => void,
}
export type MidFunction = (ctx: MessageContext | RequestContext | NoticeContext, next?: Promise<any>) => void
export interface MidConstructor {
install(add: (mid: MidFunction) => void): void
}
export class Kocq extends oicq.Client {
constructor(uin: number, conf?: oicq.Config)
use(middleware: MidFunction): this
use(middleware: MidConstructor): this
use(middleware: string, ...args: any[]): this
unuse(plugin: MidFunction): void
unuse(plugin: string): void
plugin(name: string, plugin: (...args: any[]) => MidFunction | (new (...args: any[]) => MidConstructor)): this
source(path: string): void
callback(): Function
listen(): void
}
export = Kocq