alemonjs 1.1.2 → 1.1.4

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.
package/lib/api.js CHANGED
@@ -24,6 +24,10 @@ export { ClientKOOK } from './kook/index.js';
24
24
  * one客户端
25
25
  */
26
26
  export { ClientONE } from './one/index.js';
27
+ /**
28
+ * discord
29
+ */
30
+ export { ClientDISOCRD } from './discord/index.js';
27
31
  /**
28
32
  * 控制器
29
33
  */
@@ -7,6 +7,7 @@ import { defineVILLA as villa } from '../villa/villa.js';
7
7
  import { defineQQ as qq } from '../qq/qq.js';
8
8
  import { defineNtqq as ntqq } from '../ntqq/ntqq.js';
9
9
  import { defineOne as one } from '../one/one.js';
10
+ import { defineDISCORD as discord } from '../discord/discord.js';
10
11
  /**
11
12
  * *************
12
13
  * defset-config
@@ -21,7 +22,8 @@ const config = {
21
22
  ntqq,
22
23
  server,
23
24
  puppeteer,
24
- one
25
+ one,
26
+ discord
25
27
  };
26
28
  /**
27
29
  * 设置机器人基础配置
@@ -137,6 +137,10 @@ export async function defineAlemonConfig(Options) {
137
137
  // 自定义覆盖
138
138
  setBotConfigByKey('one', Options.login.one);
139
139
  }
140
+ if (Options.login?.discord) {
141
+ // 自定义覆盖
142
+ setBotConfigByKey('discord', Options.login.discord);
143
+ }
140
144
  for (const item in Options.login) {
141
145
  if (arr.indexOf(item) != -1)
142
146
  continue;
package/lib/define/map.js CHANGED
@@ -43,5 +43,13 @@ export const rebotMap = {
43
43
  console.error('ONE BOT open err');
44
44
  return false;
45
45
  });
46
+ },
47
+ discord: async () => {
48
+ const { createAlemonByDISCORD: discord } = await import('../discord/index.js');
49
+ return discord().catch(err => {
50
+ console.error(err);
51
+ console.error('DISCORD BOT open err');
52
+ return false;
53
+ });
46
54
  }
47
55
  };
@@ -0,0 +1,16 @@
1
+ import { MESSAGES } from './message/MESSAGES.js';
2
+ export function conversation(t, d) {
3
+ console.log(t);
4
+ if (t == 'READY') {
5
+ console.log('机器人', d.user);
6
+ }
7
+ else if (t == 'GUILD_CREATE') {
8
+ // console.log(d)
9
+ }
10
+ else if (t == 'MESSAGE_CREATE') {
11
+ MESSAGES(d);
12
+ }
13
+ else {
14
+ console.log('数据', d);
15
+ }
16
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 基础消息
3
+ * @param event
4
+ */
5
+ export function MESSAGES(event) {
6
+ console.log('数据', event);
7
+ }
@@ -0,0 +1,18 @@
1
+ import { IntentsEnum } from './sdk/index.js';
2
+ /**
3
+ *
4
+ */
5
+ export const defineDISCORD = {
6
+ token: '',
7
+ intent: [
8
+ IntentsEnum.DIRECT_MESSAGES,
9
+ IntentsEnum.DIRECT_MESSAGE_TYPING,
10
+ IntentsEnum.DIRECT_MESSAGE_REACTIONS,
11
+ IntentsEnum.GUILD_MESSAGE_TYPING,
12
+ IntentsEnum.GUILD_MESSAGE_REACTIONS,
13
+ IntentsEnum.GUILD_MESSAGES,
14
+ IntentsEnum.GUILDS
15
+ ],
16
+ masterID: '',
17
+ password: ''
18
+ };
@@ -0,0 +1,35 @@
1
+ import { getIntents, setDISOCRD, createClient } from './sdk/index.js';
2
+ import { conversation } from './alemon/conversation.js';
3
+ import { checkRobotByDISCORD } from './login.js';
4
+ import { getBotConfigByKey } from '../config/index.js';
5
+ /**
6
+ * 创建实例
7
+ * @returns
8
+ */
9
+ export async function createAlemonByDISCORD() {
10
+ /**
11
+ * 创建登录配置
12
+ */
13
+ if (await checkRobotByDISCORD().catch(err => {
14
+ console.error(err);
15
+ return false;
16
+ })) {
17
+ /**
18
+ * 读取配置
19
+ */
20
+ const cfg = getBotConfigByKey('discord');
21
+ const size = getIntents(cfg.intent);
22
+ /**
23
+ * 设置配置
24
+ */
25
+ setDISOCRD(cfg.token, size);
26
+ /**
27
+ * 启动监听
28
+ */
29
+ createClient(conversation);
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ // 客户端
35
+ export { ClientDISOCRD } from './sdk/index.js';
@@ -0,0 +1,20 @@
1
+ import { setBotConfigByKey, getBotConfigByKey } from '../config/index.js';
2
+ /**
3
+ * 登录配置
4
+ * @param Bcf
5
+ * @param val
6
+ * @returns
7
+ */
8
+ export async function checkRobotByDISCORD() {
9
+ /**
10
+ * 读取配置
11
+ */
12
+ const config = getBotConfigByKey('discord');
13
+ if ((config ?? '') !== '' && (config.token ?? '') !== '') {
14
+ setBotConfigByKey('kook', config);
15
+ return true;
16
+ }
17
+ console.error('[LOGIN]', '-----------------------');
18
+ console.error('[LOGIN]', 'KOOK ERR');
19
+ return false;
20
+ }
@@ -0,0 +1,25 @@
1
+ import axios from 'axios';
2
+ import { getDISCORD } from './config.js';
3
+ /**
4
+ * KOOK服务
5
+ * @param config
6
+ * @returns
7
+ */
8
+ export function Service(config) {
9
+ const { token } = getDISCORD();
10
+ const service = axios.create({
11
+ baseURL: 'https://discord.com/api/v10',
12
+ timeout: 6000,
13
+ headers: {
14
+ 'Content-Type': 'application/json',
15
+ 'Authorization': `Bot ${token}`
16
+ }
17
+ });
18
+ return service(config);
19
+ }
20
+ export function gateway() {
21
+ return Service({
22
+ method: 'get',
23
+ url: '/gateway'
24
+ }).then(res => res.data);
25
+ }
@@ -0,0 +1,20 @@
1
+ let token = '';
2
+ let intent = 0;
3
+ /**
4
+ *
5
+ * @param val
6
+ */
7
+ export function setDISOCRD(val, i) {
8
+ token = val;
9
+ intent = i;
10
+ }
11
+ /**
12
+ *
13
+ * @returns
14
+ */
15
+ export function getDISCORD() {
16
+ return {
17
+ token,
18
+ intent
19
+ };
20
+ }
@@ -0,0 +1,5 @@
1
+ export * from './types.js';
2
+ export * as ClientDISOCRD from './api.js';
3
+ export * from './wss.js';
4
+ export * from './intents.js';
5
+ export * from './config.js';
@@ -0,0 +1,7 @@
1
+ export function getIntents(intents) {
2
+ let result = 0;
3
+ for (const intent of intents) {
4
+ result += intent;
5
+ }
6
+ return result;
7
+ }
@@ -0,0 +1,23 @@
1
+ export var IntentsEnum;
2
+ (function (IntentsEnum) {
3
+ IntentsEnum[IntentsEnum["GUILDS"] = 1] = "GUILDS";
4
+ IntentsEnum[IntentsEnum["GUILD_MEMBERS"] = 2] = "GUILD_MEMBERS";
5
+ IntentsEnum[IntentsEnum["GUILD_MODERATION"] = 4] = "GUILD_MODERATION";
6
+ IntentsEnum[IntentsEnum["GUILD_EMOJIS_AND_STICKERS"] = 8] = "GUILD_EMOJIS_AND_STICKERS";
7
+ IntentsEnum[IntentsEnum["GUILD_INTEGRATIONS"] = 16] = "GUILD_INTEGRATIONS";
8
+ IntentsEnum[IntentsEnum["GUILD_WEBHOOKS"] = 32] = "GUILD_WEBHOOKS";
9
+ IntentsEnum[IntentsEnum["GUILD_INVITES"] = 64] = "GUILD_INVITES";
10
+ IntentsEnum[IntentsEnum["GUILD_VOICE_STATES"] = 128] = "GUILD_VOICE_STATES";
11
+ IntentsEnum[IntentsEnum["GUILD_PRESENCES"] = 256] = "GUILD_PRESENCES";
12
+ IntentsEnum[IntentsEnum["GUILD_MESSAGES"] = 512] = "GUILD_MESSAGES";
13
+ IntentsEnum[IntentsEnum["GUILD_MESSAGE_REACTIONS"] = 1024] = "GUILD_MESSAGE_REACTIONS";
14
+ IntentsEnum[IntentsEnum["GUILD_MESSAGE_TYPING"] = 2048] = "GUILD_MESSAGE_TYPING";
15
+ IntentsEnum[IntentsEnum["DIRECT_MESSAGES"] = 4096] = "DIRECT_MESSAGES";
16
+ IntentsEnum[IntentsEnum["DIRECT_MESSAGE_REACTIONS"] = 8192] = "DIRECT_MESSAGE_REACTIONS";
17
+ IntentsEnum[IntentsEnum["DIRECT_MESSAGE_TYPING"] = 16384] = "DIRECT_MESSAGE_TYPING";
18
+ IntentsEnum[IntentsEnum["MESSAGE_CONTENT"] = 32768] = "MESSAGE_CONTENT";
19
+ IntentsEnum[IntentsEnum["GUILD_SCHEDULED_EVENTS"] = 65536] = "GUILD_SCHEDULED_EVENTS";
20
+ IntentsEnum[IntentsEnum["AUTO_MODERATION_CONFIGURATION"] = 1048576] = "AUTO_MODERATION_CONFIGURATION";
21
+ IntentsEnum[IntentsEnum["AUTO_MODERATION_EXECUTION"] = 2097152] = "AUTO_MODERATION_EXECUTION";
22
+ })(IntentsEnum = IntentsEnum || (IntentsEnum = {}));
23
+ // 65025
@@ -0,0 +1,117 @@
1
+ import WebSocket from 'ws';
2
+ import { gateway } from './api.js';
3
+ import { getDISCORD } from './config.js';
4
+ /**
5
+ * 创建ws监听
6
+ */
7
+ export async function createClient(conversation) {
8
+ const data = await gateway();
9
+ const websocketUrl = data.url;
10
+ const wsConn = new WebSocket(`${websocketUrl}?v=10&encoding=json`);
11
+ let heartbeat_interval = 0;
12
+ let session_id = '';
13
+ let resume_gateway_url = '';
14
+ wsConn.on('open', async () => {
15
+ // 打开成功
16
+ });
17
+ const call = async () => {
18
+ wsConn.send(JSON.stringify({
19
+ op: 1,
20
+ d: null // 如果是第一次连接,传null
21
+ }));
22
+ setTimeout(call, heartbeat_interval);
23
+ };
24
+ const { token, intent } = getDISCORD();
25
+ const map = {
26
+ 0: ({ d, t }) => {
27
+ conversation(t, d);
28
+ if (t == 'READY') {
29
+ session_id = d?.session_id;
30
+ if (d?.resume_gateway_url) {
31
+ resume_gateway_url = d?.resume_gateway_url;
32
+ }
33
+ }
34
+ },
35
+ 7: () => {
36
+ console.info('重新请求');
37
+ wsConn.send(JSON.stringify({
38
+ op: 6,
39
+ d: {
40
+ token: token,
41
+ session_id: session_id,
42
+ seq: 1337
43
+ }
44
+ }));
45
+ },
46
+ 9: () => {
47
+ // 6 或 2 失败
48
+ console.info('无效会话');
49
+ },
50
+ /**
51
+ * 打招呼
52
+ * @param param0
53
+ */
54
+ 10: ({ d }) => {
55
+ const { heartbeat_interval: ih } = d;
56
+ heartbeat_interval = ih;
57
+ wsConn.send(JSON.stringify({
58
+ op: 1,
59
+ d: null
60
+ }));
61
+ setTimeout(call, heartbeat_interval);
62
+ const data = {
63
+ op: 2,
64
+ d: {
65
+ shard: [0, 1],
66
+ token: `Bot ${token}`,
67
+ intents: intent,
68
+ properties: {
69
+ os: process.platform,
70
+ browser: 'alemonjs',
71
+ device: 'alemonjs'
72
+ }
73
+ }
74
+ };
75
+ if (process.argv.includes('dev')) {
76
+ console.info('data', data);
77
+ }
78
+ // 在初次握手期间启动新会话
79
+ wsConn.send(JSON.stringify(data));
80
+ },
81
+ 11: ({ d }) => {
82
+ console.info('心跳确认');
83
+ }
84
+ };
85
+ wsConn.on('message', data => {
86
+ const jsonData = data.toString();
87
+ const parsedData = JSON.parse(jsonData);
88
+ if (process.argv.includes('dev')) {
89
+ console.info('parsedData', parsedData);
90
+ }
91
+ const { op } = parsedData;
92
+ if (Object.prototype.hasOwnProperty.call(map, op)) {
93
+ map[op](parsedData);
94
+ }
95
+ });
96
+ // 关闭
97
+ wsConn.on('close', () => {
98
+ console.error('ws close');
99
+ });
100
+ // 出错
101
+ wsConn.on('error', error => {
102
+ console.error('ws error:', error);
103
+ });
104
+ }
105
+ /**
106
+ 0 派遣 收到 已发送事件。
107
+ 1 心跳 发送/接收 由客户端定期触发以保持连接处于活动状态。
108
+ 2 确认 发送 在初次握手期间启动新会话。
109
+ 3 状态更新 发送 更新客户的状态。
110
+ 4 语音状态更新 发送 用于加入/离开或在语音通道之间移动。
111
+ 6 恢复 发送 恢复先前断开的会话。
112
+ 7 重新连接 收到 您应该尝试立即重新连接并恢复。
113
+ 8 请求公会成员 发送 请求有关大型公会中的离线公会成员的信息。
114
+ 9 无效会话 收到 会话已失效。您应该重新连接并相应地识别/恢复。
115
+ 10 你好 收到 连接后立即发送,包含heartbeat_interval要使用的。
116
+ 11 心跳确认 收到 发送以响应收到心跳以确认已收到。
117
+ */
@@ -60,47 +60,63 @@ const ConversationMap = {
60
60
  */
61
61
  [255]: {
62
62
  public: async (event) => {
63
- // overheadData | memberData | ChannelData | | EditingData
64
- console.log(event.extra.body);
63
+ // overheadData | memberData
64
+ console.info(event.extra.body);
65
65
  if (event.extra.type == 'added_reaction' ||
66
66
  event.extra.type == 'deleted_reaction') {
67
67
  //StatementData
68
68
  return await GUILD_MESSAGE_REACTIONS(event);
69
69
  }
70
70
  else if (event.extra.type == 'joined_channel') {
71
- console.log('joined_channel');
71
+ //
72
+ console.info('joined_channel');
72
73
  return;
73
74
  }
74
- else if (event.extra.type == 'updated_channel') {
75
- // ChannelData
76
- console.log('updated_channel');
75
+ else if (event.extra.type == 'exited_channel') {
76
+ //
77
+ console.info('exited_channel');
77
78
  return;
78
79
  }
79
- else if (event.extra.type == 'exited_channel') {
80
- console.log('exited_channel');
80
+ else if (event.extra.type == 'updated_channel') {
81
+ // ChannelData
82
+ console.info('updated_channel');
81
83
  return;
84
+ /**
85
+ * ***********
86
+ * 频道进出
87
+ * *******
88
+ */
82
89
  }
83
90
  else if (event.extra.type == 'joined_guild') {
84
- console.log('joined_guild');
91
+ console.info('joined_guild');
85
92
  return;
86
93
  }
87
94
  else if (event.extra.type == 'exited_guild') {
88
- console.log('exited_guild');
95
+ console.info('exited_guild');
89
96
  return;
97
+ /**
98
+ * **********
99
+ * 消息变动
100
+ * ********
101
+ */
90
102
  }
91
103
  else if (event.extra.type == 'updated_message') {
92
104
  // 消息更新
93
- console.log('updated_message');
105
+ // EditingData
106
+ console.info('updated_message');
94
107
  return;
95
108
  }
96
109
  else if (event.extra.type == 'pinned_message') {
97
110
  // 顶置消息
98
- console.log('pinned_message');
111
+ // overheadData
112
+ console.info('pinned_message');
99
113
  return;
100
114
  }
101
- else if (event.extra.type == 'guild_member_online') {
102
- // 成员上线
103
- console.log('exited_guild');
115
+ },
116
+ direct: async (event) => {
117
+ if (event.extra.type == 'guild_member_online') {
118
+ //OnLineData
119
+ console.info('exited_guild');
104
120
  return;
105
121
  }
106
122
  }
package/lib/kook/index.js CHANGED
@@ -18,7 +18,7 @@ export async function createAlemonByKOOK() {
18
18
  /**
19
19
  * 读取配置
20
20
  */
21
- const cfg = await getBotConfigByKey('kook');
21
+ const cfg = getBotConfigByKey('kook');
22
22
  /**
23
23
  * 创建连接
24
24
  */
@@ -25,7 +25,7 @@ export function createWsHandler(options, fun) {
25
25
  }
26
26
  else {
27
27
  if (event?.status != 'ok') {
28
- console.log('[ONE]', event);
28
+ console.info('[ONE]', event);
29
29
  }
30
30
  }
31
31
  }
package/lib/utils.js CHANGED
@@ -37,6 +37,10 @@ export function buttonAutomaticArrangement(arr = []) {
37
37
  slist = [];
38
38
  }
39
39
  }
40
+ if (slist.length == 3) {
41
+ small_component_group_list.push(slist);
42
+ slist = [];
43
+ }
40
44
  // 如果 slist是 1 slist是 2 就留到下一批
41
45
  for (const item of slist) {
42
46
  mid.push(item);
@@ -51,8 +55,15 @@ export function buttonAutomaticArrangement(arr = []) {
51
55
  mlist = [];
52
56
  }
53
57
  }
58
+ if (mlist.length == 2) {
59
+ mid_component_group_list.push(mlist);
60
+ mlist = [];
61
+ }
54
62
  for (const item of mlist) {
55
- big_component_group_list.push(item);
63
+ big_component_group_list.push([item]);
64
+ }
65
+ for (const item of big) {
66
+ big_component_group_list.push([item]);
56
67
  }
57
68
  return {
58
69
  big_component_group_list: big_component_group_list,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "DOCS https://alemonjs.com/",
5
5
  "author": "ningmengchongshui",
6
6
  "license": "GPL-2.0",
package/types/api.d.ts CHANGED
@@ -24,6 +24,10 @@ export { ClientKOOK } from './kook/index.js';
24
24
  * one客户端
25
25
  */
26
26
  export { ClientONE } from './one/index.js';
27
+ /**
28
+ * discord
29
+ */
30
+ export { ClientDISOCRD } from './discord/index.js';
27
31
  import { type MessageControllerType, type MemberControllerType, type ControllerOption } from './core/index.js';
28
32
  declare const PlatformEnum: readonly ["villa", "qq", "kook", "ntqq", "one"];
29
33
  /**
@@ -1,11 +1,12 @@
1
- import { PuppeteerLaunchOptions } from 'puppeteer';
2
- import { MysqlOptions, RedisOptions } from '../default/types.js';
3
- import { ServerOptions } from '../koa/types.js';
4
- import { KOOKOptions } from '../kook/kook.js';
5
- import { VILLAOptions } from '../villa/villa.js';
6
- import { QQOptions } from '../qq/qq.js';
7
- import { NTQQOptions } from '../ntqq/ntqq.js';
8
- import { OneOptions } from '../one/one.js';
1
+ import { type PuppeteerLaunchOptions } from 'puppeteer';
2
+ import { type MysqlOptions, type RedisOptions } from '../default/types.js';
3
+ import { type ServerOptions } from '../koa/types.js';
4
+ import { type KOOKOptions } from '../kook/kook.js';
5
+ import { type VILLAOptions } from '../villa/villa.js';
6
+ import { type QQOptions } from '../qq/qq.js';
7
+ import { type NTQQOptions } from '../ntqq/ntqq.js';
8
+ import { type OneOptions } from '../one/one.js';
9
+ import { type DISOCRDOptions } from '../discord/discord.js';
9
10
  /**
10
11
  * ******
11
12
  * config
@@ -21,4 +22,5 @@ export interface ConfigType {
21
22
  puppeteer: PuppeteerLaunchOptions;
22
23
  ntqq: NTQQOptions;
23
24
  one: OneOptions;
25
+ discord: DISOCRDOptions;
24
26
  }
@@ -3,6 +3,7 @@ import { KOOKOptions } from '../kook/kook.js';
3
3
  import { QQOptions } from '../qq/qq.js';
4
4
  import { NTQQOptions } from '../ntqq/ntqq.js';
5
5
  import { OneOptions } from '../one/one.js';
6
+ import { DISOCRDOptions } from '../discord/discord.js';
6
7
  /**
7
8
  * *****
8
9
  * login
@@ -29,6 +30,10 @@ export interface LoginOptions {
29
30
  * qq配置
30
31
  */
31
32
  one?: OneOptions;
33
+ /**
34
+ * discord配置
35
+ */
36
+ discord?: DISOCRDOptions;
32
37
  }
33
38
  /**
34
39
  * ****
@@ -9,4 +9,5 @@ export declare const rebotMap: {
9
9
  kook: () => Promise<boolean>;
10
10
  ntqq: () => Promise<boolean>;
11
11
  one: () => Promise<boolean>;
12
+ discord: () => Promise<boolean>;
12
13
  };
@@ -0,0 +1 @@
1
+ export declare function conversation(t: string, d: any): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 基础消息
3
+ * @param event
4
+ */
5
+ export declare function MESSAGES(event: any): void;
@@ -0,0 +1,28 @@
1
+ import { IntentsEnum } from './sdk/index.js';
2
+ /**
3
+ * ****
4
+ * discord
5
+ * ***
6
+ */
7
+ export interface DISOCRDOptions {
8
+ /**
9
+ * 钥匙
10
+ */
11
+ token: string;
12
+ /**
13
+ *
14
+ */
15
+ intent?: IntentsEnum[];
16
+ /**
17
+ * 主人编号
18
+ */
19
+ masterID?: string;
20
+ /**
21
+ * 主人密码
22
+ */
23
+ password?: string;
24
+ }
25
+ /**
26
+ *
27
+ */
28
+ export declare const defineDISCORD: DISOCRDOptions;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 创建实例
3
+ * @returns
4
+ */
5
+ export declare function createAlemonByDISCORD(): Promise<boolean>;
6
+ export { ClientDISOCRD } from './sdk/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 登录配置
3
+ * @param Bcf
4
+ * @param val
5
+ * @returns
6
+ */
7
+ export declare function checkRobotByDISCORD(): Promise<boolean>;
@@ -0,0 +1,10 @@
1
+ import { type AxiosRequestConfig } from 'axios';
2
+ /**
3
+ * KOOK服务
4
+ * @param config
5
+ * @returns
6
+ */
7
+ export declare function Service(config: AxiosRequestConfig): Promise<import("axios").AxiosResponse<any, any>>;
8
+ export declare function gateway(): Promise<{
9
+ url: string;
10
+ }>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ * @param val
4
+ */
5
+ export declare function setDISOCRD(val: string, i: number): void;
6
+ /**
7
+ *
8
+ * @returns
9
+ */
10
+ export declare function getDISCORD(): {
11
+ token: string;
12
+ intent: number;
13
+ };
@@ -0,0 +1,5 @@
1
+ export * from './types.js';
2
+ export * as ClientDISOCRD from './api.js';
3
+ export * from './wss.js';
4
+ export * from './intents.js';
5
+ export * from './config.js';
@@ -0,0 +1,2 @@
1
+ import { type IntentsEnum } from './types.js';
2
+ export declare function getIntents(intents: IntentsEnum[]): number;
@@ -0,0 +1,21 @@
1
+ export declare enum IntentsEnum {
2
+ GUILDS = 1,
3
+ GUILD_MEMBERS = 2,
4
+ GUILD_MODERATION = 4,
5
+ GUILD_EMOJIS_AND_STICKERS = 8,
6
+ GUILD_INTEGRATIONS = 16,
7
+ GUILD_WEBHOOKS = 32,
8
+ GUILD_INVITES = 64,
9
+ GUILD_VOICE_STATES = 128,
10
+ GUILD_PRESENCES = 256,
11
+ GUILD_MESSAGES = 512,
12
+ GUILD_MESSAGE_REACTIONS = 1024,
13
+ GUILD_MESSAGE_TYPING = 2048,
14
+ DIRECT_MESSAGES = 4096,
15
+ DIRECT_MESSAGE_REACTIONS = 8192,
16
+ DIRECT_MESSAGE_TYPING = 16384,
17
+ MESSAGE_CONTENT = 32768,
18
+ GUILD_SCHEDULED_EVENTS = 65536,
19
+ AUTO_MODERATION_CONFIGURATION = 1048576,
20
+ AUTO_MODERATION_EXECUTION = 2097152
21
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 创建ws监听
3
+ */
4
+ export declare function createClient(conversation: (...args: any[]) => any): Promise<void>;
5
+ /**
6
+ 0 派遣 收到 已发送事件。
7
+ 1 心跳 发送/接收 由客户端定期触发以保持连接处于活动状态。
8
+ 2 确认 发送 在初次握手期间启动新会话。
9
+ 3 状态更新 发送 更新客户的状态。
10
+ 4 语音状态更新 发送 用于加入/离开或在语音通道之间移动。
11
+ 6 恢复 发送 恢复先前断开的会话。
12
+ 7 重新连接 收到 您应该尝试立即重新连接并恢复。
13
+ 8 请求公会成员 发送 请求有关大型公会中的离线公会成员的信息。
14
+ 9 无效会话 收到 会话已失效。您应该重新连接并相应地识别/恢复。
15
+ 10 你好 收到 连接后立即发送,包含heartbeat_interval要使用的。
16
+ 11 心跳确认 收到 发送以响应收到心跳以确认已收到。
17
+ */
@@ -300,13 +300,18 @@ export interface SystemData {
300
300
  content: string;
301
301
  extra: {
302
302
  type: (typeof SystemDataEnum)[number];
303
- body: overheadData | memberData | ChannelData | StatementData | EditingData;
303
+ body: overheadData | memberData | ChannelData | StatementData | EditingData | OnLineData;
304
304
  };
305
305
  msg_id: string;
306
306
  msg_timestamp: number;
307
307
  nonce: string;
308
308
  from_type: number;
309
309
  }
310
+ export interface OnLineData {
311
+ user_id: string;
312
+ event_time: number;
313
+ guilds: any[];
314
+ }
310
315
  export interface overheadData {
311
316
  channel_id: string;
312
317
  operator_id: string;