@alemonjs/kook 0.2.2 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,116 +1,124 @@
1
- import { KOOKEventKey } from './message.js'
1
+ import { KOOKEventKey } from './message.js';
2
2
 
3
3
  /**
4
4
  * 事件处理集
5
5
  */
6
6
  const ConversationMap = {
7
- /**
8
- * 文字消息
9
- */
10
- [1]: {
11
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
12
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
13
- },
14
- /**
15
- * 图片消息,
16
- */
17
- [2]: {
18
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
19
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
20
- },
21
- /**
22
- * 视频消息,
23
- */
24
- [3]: {
25
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
26
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
27
- },
28
- /**
29
- * 文件消息,
30
- */
31
- [4]: {
32
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
33
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
34
- },
35
- /**
36
- * 音频消息,
37
- */
38
- [8]: {
39
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
40
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
41
- },
42
- /**
43
- * mk消息
44
- */
45
- [9]: {
46
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
47
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
48
- },
49
- /**
50
- * card消息,
51
- */
52
- [10]: {
53
- public: e => KOOKEventKey['MESSAGES_PUBLIC'],
54
- direct: e => KOOKEventKey['MESSAGES_DIRECT']
55
- },
56
- /**
57
- * 系统消息
58
- * @param event
59
- */
60
- [255]: {
61
- public: event => {
62
- if (event.extra.type == 'added_reaction' || event.extra.type == 'deleted_reaction') {
63
- return KOOKEventKey['REACTIONS']
64
- } else if (event.extra.type == 'joined_channel') {
65
- console.info('joined_channel')
66
- return ''
67
- } else if (event.extra.type == 'exited_channel') {
68
- console.info('111exited_channel')
69
- return ''
70
- } else if (event.extra.type == 'updated_channel') {
71
- // ChannelData
72
- console.info('updated_channel')
73
- return ''
74
- /**
75
- * ***********
76
- * 频道进出
77
- * *******
78
- */
79
- } else if (event.extra.type == 'joined_guild') {
80
- console.info('joined_guild')
81
- return KOOKEventKey['MEMBER_ADD']
82
- } else if (event.extra.type == 'exited_guild') {
83
- console.info('exited_guild')
84
- return KOOKEventKey['MEMBER_REMOVE']
85
- /**
86
- * **********
87
- * 消息变动
88
- * ********
89
- */
90
- } else if (event.extra.type == 'updated_message') {
91
- // 消息更新
92
- // EditingData
93
- console.info('updated_message')
94
- return ''
95
- } else if (event.extra.type == 'pinned_message') {
96
- // 顶置消息
97
- // overheadData
98
- console.info('pinned_message')
99
- return ''
100
- }
7
+ /**
8
+ * 文字消息
9
+ */
10
+ [1]: {
11
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
12
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
101
13
  },
102
- direct: event => {
103
- if (event.extra.type == 'guild_member_online') {
104
- //OnLineData
105
- console.info('exited_guild')
106
- return ''
107
- } else if (event.extra.type == 'message_btn_click') {
108
- //按钮事件
109
- console.info('message_btn_click')
110
- return KOOKEventKey['INTERACTION']
111
- }
14
+ /**
15
+ * 图片消息,
16
+ */
17
+ [2]: {
18
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
19
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
20
+ },
21
+ /**
22
+ * 视频消息,
23
+ */
24
+ [3]: {
25
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
26
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
27
+ },
28
+ /**
29
+ * 文件消息,
30
+ */
31
+ [4]: {
32
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
33
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
34
+ },
35
+ /**
36
+ * 音频消息,
37
+ */
38
+ [8]: {
39
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
40
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
41
+ },
42
+ /**
43
+ * mk消息
44
+ */
45
+ [9]: {
46
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
47
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
48
+ },
49
+ /**
50
+ * card消息,
51
+ */
52
+ [10]: {
53
+ public: e => KOOKEventKey['MESSAGES_PUBLIC'],
54
+ direct: e => KOOKEventKey['MESSAGES_DIRECT']
55
+ },
56
+ /**
57
+ * 系统消息
58
+ * @param event
59
+ */
60
+ [255]: {
61
+ public: (event) => {
62
+ if (event.extra.type == 'added_reaction' || event.extra.type == 'deleted_reaction') {
63
+ return KOOKEventKey['REACTIONS'];
64
+ }
65
+ else if (event.extra.type == 'joined_channel') {
66
+ console.info('joined_channel');
67
+ return '';
68
+ }
69
+ else if (event.extra.type == 'exited_channel') {
70
+ console.info('111exited_channel');
71
+ return '';
72
+ }
73
+ else if (event.extra.type == 'updated_channel') {
74
+ // ChannelData
75
+ console.info('updated_channel');
76
+ return '';
77
+ /**
78
+ * ***********
79
+ * 频道进出
80
+ * *******
81
+ */
82
+ }
83
+ else if (event.extra.type == 'joined_guild') {
84
+ console.info('joined_guild');
85
+ return KOOKEventKey['MEMBER_ADD'];
86
+ }
87
+ else if (event.extra.type == 'exited_guild') {
88
+ console.info('exited_guild');
89
+ return KOOKEventKey['MEMBER_REMOVE'];
90
+ /**
91
+ * **********
92
+ * 消息变动
93
+ * ********
94
+ */
95
+ }
96
+ else if (event.extra.type == 'updated_message') {
97
+ // 消息更新
98
+ // EditingData
99
+ console.info('updated_message');
100
+ return '';
101
+ }
102
+ else if (event.extra.type == 'pinned_message') {
103
+ // 顶置消息
104
+ // overheadData
105
+ console.info('pinned_message');
106
+ return '';
107
+ }
108
+ },
109
+ direct: (event) => {
110
+ if (event.extra.type == 'guild_member_online') {
111
+ //OnLineData
112
+ console.info('exited_guild');
113
+ return '';
114
+ }
115
+ else if (event.extra.type == 'message_btn_click') {
116
+ //按钮事件
117
+ console.info('message_btn_click');
118
+ return KOOKEventKey['INTERACTION'];
119
+ }
120
+ }
112
121
  }
113
- }
114
- }
122
+ };
115
123
 
116
- export { ConversationMap }
124
+ export { ConversationMap };
@@ -1,8 +1,8 @@
1
- import { SystemData } from '../typings.js'
1
+ import { SystemData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  * @param event 按钮数据
5
5
  */
6
- type INTERACTION_TYPE = SystemData
6
+ type INTERACTION_TYPE = SystemData;
7
7
 
8
- export type { INTERACTION_TYPE }
8
+ export type { INTERACTION_TYPE };
@@ -1,10 +1,10 @@
1
- import { SystemData } from '../typings.js'
1
+ import { SystemData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  * 当成员加入时
5
5
  * @param event
6
6
  * @returns
7
7
  */
8
- type MEMBER_ADD_TYPE = SystemData
8
+ type MEMBER_ADD_TYPE = SystemData;
9
9
 
10
- export type { MEMBER_ADD_TYPE }
10
+ export type { MEMBER_ADD_TYPE };
@@ -1,10 +1,10 @@
1
- import { SystemData } from '../typings.js'
1
+ import { SystemData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  * 当成员移除时
5
5
  * @param event
6
6
  * @returns
7
7
  */
8
- type MEMBER_REMOVE_TYPE = SystemData
8
+ type MEMBER_REMOVE_TYPE = SystemData;
9
9
 
10
- export type { MEMBER_REMOVE_TYPE }
10
+ export type { MEMBER_REMOVE_TYPE };
@@ -1,10 +1,10 @@
1
- import { EventData } from '../typings.js'
1
+ import { EventData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  * 私聊消息
5
5
  * @param event
6
6
  * @returns
7
7
  */
8
- type MESSAGES_DIRECT_TYPE = EventData
8
+ type MESSAGES_DIRECT_TYPE = EventData;
9
9
 
10
- export type { MESSAGES_DIRECT_TYPE }
10
+ export type { MESSAGES_DIRECT_TYPE };
@@ -1,10 +1,10 @@
1
- import { EventData } from '../typings.js'
1
+ import { EventData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  * 群聊消息
5
5
  * @param event
6
6
  * @returns
7
7
  */
8
- type MESSAGES_PUBLIC_TYPE = EventData
8
+ type MESSAGES_PUBLIC_TYPE = EventData;
9
9
 
10
- export type { MESSAGES_PUBLIC_TYPE }
10
+ export type { MESSAGES_PUBLIC_TYPE };
@@ -1,10 +1,10 @@
1
- import { SystemData } from '../typings.js'
1
+ import { SystemData } from '../typings.js';
2
2
 
3
3
  /**
4
4
  *
5
5
  * @param event
6
6
  * @returns
7
7
  */
8
- type REACTIONS_TYPE = SystemData
8
+ type REACTIONS_TYPE = SystemData;
9
9
 
10
- export type { REACTIONS_TYPE }
10
+ export type { REACTIONS_TYPE };
@@ -1,18 +1,18 @@
1
- import { MEMBER_ADD_TYPE } from './message/MEMBER_ADD.js'
2
- import { MEMBER_REMOVE_TYPE } from './message/MEMBER_REMOVE.js'
3
- import { INTERACTION_TYPE } from './message/INTERACTION.js'
4
- import { MESSAGES_DIRECT_TYPE } from './message/MESSAGES_DIRECT.js'
5
- import { MESSAGES_PUBLIC_TYPE } from './message/MESSAGES_PUBLIC.js'
6
- import { REACTIONS_TYPE } from './message/REACTIONS.js'
1
+ import { MEMBER_ADD_TYPE } from './message/MEMBER_ADD.js';
2
+ import { MEMBER_REMOVE_TYPE } from './message/MEMBER_REMOVE.js';
3
+ import { INTERACTION_TYPE } from './message/INTERACTION.js';
4
+ import { MESSAGES_DIRECT_TYPE } from './message/MESSAGES_DIRECT.js';
5
+ import { MESSAGES_PUBLIC_TYPE } from './message/MESSAGES_PUBLIC.js';
6
+ import { REACTIONS_TYPE } from './message/REACTIONS.js';
7
7
 
8
8
  type KOOKEventMap = {
9
- MEMBER_ADD: MEMBER_ADD_TYPE
10
- MEMBER_REMOVE: MEMBER_REMOVE_TYPE
11
- INTERACTION: INTERACTION_TYPE
12
- MESSAGES_DIRECT: MESSAGES_DIRECT_TYPE
13
- MESSAGES_PUBLIC: MESSAGES_PUBLIC_TYPE
14
- REACTIONS: REACTIONS_TYPE
15
- ERROR: any
16
- }
9
+ MEMBER_ADD: MEMBER_ADD_TYPE;
10
+ MEMBER_REMOVE: MEMBER_REMOVE_TYPE;
11
+ INTERACTION: INTERACTION_TYPE;
12
+ MESSAGES_DIRECT: MESSAGES_DIRECT_TYPE;
13
+ MESSAGES_PUBLIC: MESSAGES_PUBLIC_TYPE;
14
+ REACTIONS: REACTIONS_TYPE;
15
+ ERROR: any;
16
+ };
17
17
 
18
- export type { KOOKEventMap }
18
+ export type { KOOKEventMap };
@@ -1,18 +1,18 @@
1
1
  const KOOKEventKey = {
2
- // 成员加入
3
- MEMBER_ADD: 'MEMBER_ADD',
4
- // 成员退出
5
- MEMBER_REMOVE: 'MEMBER_REMOVE',
6
- // 交互
7
- INTERACTION: 'INTERACTION',
8
- // 私聊消息
9
- MESSAGES_DIRECT: 'MESSAGES_DIRECT',
10
- // 频道消息
11
- MESSAGES_PUBLIC: 'MESSAGES_PUBLIC',
12
- // 系统消息
13
- REACTIONS: 'REACTIONS',
14
- // 错误消息
15
- ERROR: 'ERROR'
16
- }
2
+ // 成员加入
3
+ MEMBER_ADD: 'MEMBER_ADD',
4
+ // 成员退出
5
+ MEMBER_REMOVE: 'MEMBER_REMOVE',
6
+ // 交互
7
+ INTERACTION: 'INTERACTION',
8
+ // 私聊消息
9
+ MESSAGES_DIRECT: 'MESSAGES_DIRECT',
10
+ // 频道消息
11
+ MESSAGES_PUBLIC: 'MESSAGES_PUBLIC',
12
+ // 系统消息
13
+ REACTIONS: 'REACTIONS',
14
+ // 错误消息
15
+ ERROR: 'ERROR'
16
+ };
17
17
 
18
- export { KOOKEventKey }
18
+ export { KOOKEventKey };