@alemonjs/discord 0.2.9 → 2.1.0-alpha.0
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/dist/assets/index.js +3 -3
- package/lib/env.js +1 -0
- package/lib/index.d.ts +2 -7
- package/lib/index.js +189 -271
- package/lib/sdk/api.d.ts +972 -0
- package/lib/sdk/{platform/discord/sdk/api.js → api.js} +27 -10
- package/lib/sdk/config.js +10 -0
- package/lib/sdk/intents.js +154 -0
- package/lib/sdk/message/CHANNEL_TOPIC_UPDATE.d.ts +11 -0
- package/lib/sdk/message/CHANNEL_UPDATE.d.ts +48 -0
- package/lib/sdk/message/GUILD_MEMBER_ADD.d.ts +28 -0
- package/lib/sdk/message/GUILD_MEMBER_REMOVE.d.ts +18 -0
- package/lib/sdk/message/GUILD_MEMBER_UPDATE.d.ts +33 -0
- package/lib/sdk/message/INTERACTION_CREATE.d.ts +126 -0
- package/lib/sdk/message/MESSAGE_CREATE.d.ts +59 -0
- package/lib/sdk/message/MESSAGE_DELETE.d.ts +11 -0
- package/lib/sdk/message/MESSAGE_REACTION_ADD.d.ts +42 -0
- package/lib/sdk/message/MESSAGE_UPDATE.d.ts +56 -0
- package/lib/sdk/message/PRESENCE_UPDATE.d.ts +69 -0
- package/lib/sdk/message/READY.d.ts +9 -0
- package/lib/sdk/message/TYPING_START.d.ts +35 -0
- package/lib/sdk/message/VOICE_CHANNEL_STATUS_UPDATE.d.ts +10 -0
- package/lib/sdk/message/VOICE_STATE_UPDATE.d.ts +41 -0
- package/lib/sdk/message.d.ts +101 -0
- package/lib/sdk/types.d.ts +5 -0
- package/lib/sdk/types.js +25 -0
- package/lib/sdk/wss.d.ts +27 -0
- package/lib/sdk/{platform/discord/sdk/wss.js → wss.js} +14 -7
- package/lib/sdk/wss.types.d.ts +30 -0
- package/lib/send.js +132 -0
- package/package.json +4 -1
- package/lib/sdk/platform/discord/sdk/api.d.ts +0 -896
- package/lib/sdk/platform/discord/sdk/config.js +0 -29
- package/lib/sdk/platform/discord/sdk/intents.js +0 -36
- package/lib/sdk/platform/discord/sdk/message/CHANNEL_TOPIC_UPDATE.d.ts +0 -11
- package/lib/sdk/platform/discord/sdk/message/CHANNEL_UPDATE.d.ts +0 -48
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_ADD.d.ts +0 -28
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_REMOVE.d.ts +0 -18
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_UPDATE.d.ts +0 -33
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_CREATE.d.ts +0 -59
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_DELETE.d.ts +0 -11
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_REACTION_ADD.d.ts +0 -42
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_UPDATE.d.ts +0 -56
- package/lib/sdk/platform/discord/sdk/message/PRESENCE_UPDATE.d.ts +0 -63
- package/lib/sdk/platform/discord/sdk/message/READY.d.ts +0 -9
- package/lib/sdk/platform/discord/sdk/message/TYPING_START.d.ts +0 -35
- package/lib/sdk/platform/discord/sdk/message/VOICE_CHANNEL_STATUS_UPDATE.d.ts +0 -10
- package/lib/sdk/platform/discord/sdk/message/VOICE_STATE_UPDATE.d.ts +0 -41
- package/lib/sdk/platform/discord/sdk/message.d.ts +0 -37
- package/lib/sdk/platform/discord/sdk/types.d.ts +0 -4
- package/lib/sdk/platform/discord/sdk/wss.d.ts +0 -27
- package/lib/sdk/platform/discord/sdk/wss.types.d.ts +0 -26
- /package/lib/sdk/core/{utils/from.js → from.js} +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
|
-
import 'fs';
|
|
3
2
|
import axios from 'axios';
|
|
4
|
-
import 'path';
|
|
5
|
-
import 'qrcode';
|
|
6
|
-
import 'public-ip';
|
|
7
|
-
import { createPicFrom } from '../../../core/utils/from.js';
|
|
8
3
|
import { config } from './config.js';
|
|
4
|
+
import { createPicFrom } from './core/from.js';
|
|
9
5
|
|
|
10
6
|
/**
|
|
11
7
|
* api接口
|
|
@@ -71,8 +67,9 @@ class DCAPI {
|
|
|
71
67
|
}
|
|
72
68
|
/**
|
|
73
69
|
*
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
70
|
+
* @param channel_id
|
|
71
|
+
* @param data
|
|
72
|
+
* @param headers
|
|
76
73
|
* @returns
|
|
77
74
|
*/
|
|
78
75
|
async channelsMessages(channel_id, data, headers) {
|
|
@@ -89,14 +86,18 @@ class DCAPI {
|
|
|
89
86
|
* @param img
|
|
90
87
|
* @returns
|
|
91
88
|
*/
|
|
92
|
-
async channelsMessagesImage(channel_id, img,
|
|
89
|
+
async channelsMessagesImage(channel_id, img, param) {
|
|
93
90
|
const from = await createPicFrom(img);
|
|
94
91
|
if (!from)
|
|
95
92
|
return;
|
|
96
93
|
const { picData, name } = from;
|
|
97
94
|
const formData = new FormData();
|
|
98
|
-
if (
|
|
99
|
-
|
|
95
|
+
if (param) {
|
|
96
|
+
for (const key in param) {
|
|
97
|
+
if (param[key]) {
|
|
98
|
+
formData.append(key, param[key]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
100
101
|
}
|
|
101
102
|
formData.append('file', picData, name);
|
|
102
103
|
return this.request({
|
|
@@ -1552,6 +1553,22 @@ class DCAPI {
|
|
|
1552
1553
|
url: '/gateway'
|
|
1553
1554
|
}).then(res => res?.data);
|
|
1554
1555
|
}
|
|
1556
|
+
/**
|
|
1557
|
+
*
|
|
1558
|
+
*/
|
|
1559
|
+
async interactionsCallback(id, token, content) {
|
|
1560
|
+
return this.request({
|
|
1561
|
+
method: 'POST',
|
|
1562
|
+
url: `/interactions/${id}/${token}/callback`,
|
|
1563
|
+
data: {
|
|
1564
|
+
type: 4, // CHANNEL_MESSAGE_WITH_SOURCE
|
|
1565
|
+
data: {
|
|
1566
|
+
content: content,
|
|
1567
|
+
flags: 64 // EPHEMERAL(仅发送者可见)
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}).then(res => res.data);
|
|
1571
|
+
}
|
|
1555
1572
|
}
|
|
1556
1573
|
|
|
1557
1574
|
export { DCAPI };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GUILDS (1 << 0)
|
|
3
|
+
- GUILD_CREATE
|
|
4
|
+
- GUILD_UPDATE
|
|
5
|
+
- GUILD_DELETE
|
|
6
|
+
- GUILD_ROLE_CREATE
|
|
7
|
+
- GUILD_ROLE_UPDATE
|
|
8
|
+
- GUILD_ROLE_DELETE
|
|
9
|
+
- CHANNEL_CREATE
|
|
10
|
+
- CHANNEL_UPDATE
|
|
11
|
+
- CHANNEL_DELETE
|
|
12
|
+
- CHANNEL_PINS_UPDATE
|
|
13
|
+
- THREAD_CREATE
|
|
14
|
+
- THREAD_UPDATE
|
|
15
|
+
- THREAD_DELETE
|
|
16
|
+
- THREAD_LIST_SYNC
|
|
17
|
+
- THREAD_MEMBER_UPDATE
|
|
18
|
+
- THREAD_MEMBERS_UPDATE *
|
|
19
|
+
- STAGE_INSTANCE_CREATE
|
|
20
|
+
- STAGE_INSTANCE_UPDATE
|
|
21
|
+
- STAGE_INSTANCE_DELETE
|
|
22
|
+
|
|
23
|
+
GUILD_MEMBERS (1 << 1) **
|
|
24
|
+
- GUILD_MEMBER_ADD
|
|
25
|
+
- GUILD_MEMBER_UPDATE
|
|
26
|
+
- GUILD_MEMBER_REMOVE
|
|
27
|
+
- THREAD_MEMBERS_UPDATE *
|
|
28
|
+
|
|
29
|
+
GUILD_MODERATION (1 << 2)
|
|
30
|
+
- GUILD_AUDIT_LOG_ENTRY_CREATE
|
|
31
|
+
- GUILD_BAN_ADD
|
|
32
|
+
- GUILD_BAN_REMOVE
|
|
33
|
+
|
|
34
|
+
GUILD_EXPRESSIONS (1 << 3)
|
|
35
|
+
- GUILD_EMOJIS_UPDATE
|
|
36
|
+
- GUILD_STICKERS_UPDATE
|
|
37
|
+
- GUILD_SOUNDBOARD_SOUND_CREATE
|
|
38
|
+
- GUILD_SOUNDBOARD_SOUND_UPDATE
|
|
39
|
+
- GUILD_SOUNDBOARD_SOUND_DELETE
|
|
40
|
+
- GUILD_SOUNDBOARD_SOUNDS_UPDATE
|
|
41
|
+
|
|
42
|
+
GUILD_INTEGRATIONS (1 << 4)
|
|
43
|
+
- GUILD_INTEGRATIONS_UPDATE
|
|
44
|
+
- INTEGRATION_CREATE
|
|
45
|
+
- INTEGRATION_UPDATE
|
|
46
|
+
- INTEGRATION_DELETE
|
|
47
|
+
|
|
48
|
+
GUILD_WEBHOOKS (1 << 5)
|
|
49
|
+
- WEBHOOKS_UPDATE
|
|
50
|
+
|
|
51
|
+
GUILD_INVITES (1 << 6)
|
|
52
|
+
- INVITE_CREATE
|
|
53
|
+
- INVITE_DELETE
|
|
54
|
+
|
|
55
|
+
GUILD_VOICE_STATES (1 << 7)
|
|
56
|
+
- VOICE_CHANNEL_EFFECT_SEND
|
|
57
|
+
- VOICE_STATE_UPDATE
|
|
58
|
+
|
|
59
|
+
GUILD_PRESENCES (1 << 8) **
|
|
60
|
+
- PRESENCE_UPDATE
|
|
61
|
+
|
|
62
|
+
GUILD_MESSAGES (1 << 9)
|
|
63
|
+
- MESSAGE_CREATE
|
|
64
|
+
- MESSAGE_UPDATE
|
|
65
|
+
- MESSAGE_DELETE
|
|
66
|
+
- MESSAGE_DELETE_BULK
|
|
67
|
+
|
|
68
|
+
GUILD_MESSAGE_REACTIONS (1 << 10)
|
|
69
|
+
- MESSAGE_REACTION_ADD
|
|
70
|
+
- MESSAGE_REACTION_REMOVE
|
|
71
|
+
- MESSAGE_REACTION_REMOVE_ALL
|
|
72
|
+
- MESSAGE_REACTION_REMOVE_EMOJI
|
|
73
|
+
|
|
74
|
+
GUILD_MESSAGE_TYPING (1 << 11)
|
|
75
|
+
- TYPING_START
|
|
76
|
+
|
|
77
|
+
DIRECT_MESSAGES (1 << 12)
|
|
78
|
+
- MESSAGE_CREATE
|
|
79
|
+
- MESSAGE_UPDATE
|
|
80
|
+
- MESSAGE_DELETE
|
|
81
|
+
- CHANNEL_PINS_UPDATE
|
|
82
|
+
|
|
83
|
+
DIRECT_MESSAGE_REACTIONS (1 << 13)
|
|
84
|
+
- MESSAGE_REACTION_ADD
|
|
85
|
+
- MESSAGE_REACTION_REMOVE
|
|
86
|
+
- MESSAGE_REACTION_REMOVE_ALL
|
|
87
|
+
- MESSAGE_REACTION_REMOVE_EMOJI
|
|
88
|
+
|
|
89
|
+
DIRECT_MESSAGE_TYPING (1 << 14)
|
|
90
|
+
- TYPING_START
|
|
91
|
+
|
|
92
|
+
MESSAGE_CONTENT (1 << 15) ***
|
|
93
|
+
|
|
94
|
+
GUILD_SCHEDULED_EVENTS (1 << 16)
|
|
95
|
+
- GUILD_SCHEDULED_EVENT_CREATE
|
|
96
|
+
- GUILD_SCHEDULED_EVENT_UPDATE
|
|
97
|
+
- GUILD_SCHEDULED_EVENT_DELETE
|
|
98
|
+
- GUILD_SCHEDULED_EVENT_USER_ADD
|
|
99
|
+
- GUILD_SCHEDULED_EVENT_USER_REMOVE
|
|
100
|
+
|
|
101
|
+
AUTO_MODERATION_CONFIGURATION (1 << 20)
|
|
102
|
+
- AUTO_MODERATION_RULE_CREATE
|
|
103
|
+
- AUTO_MODERATION_RULE_UPDATE
|
|
104
|
+
- AUTO_MODERATION_RULE_DELETE
|
|
105
|
+
|
|
106
|
+
AUTO_MODERATION_EXECUTION (1 << 21)
|
|
107
|
+
- AUTO_MODERATION_ACTION_EXECUTION
|
|
108
|
+
|
|
109
|
+
GUILD_MESSAGE_POLLS (1 << 24)
|
|
110
|
+
- MESSAGE_POLL_VOTE_ADD
|
|
111
|
+
- MESSAGE_POLL_VOTE_REMOVE
|
|
112
|
+
|
|
113
|
+
DIRECT_MESSAGE_POLLS (1 << 25)
|
|
114
|
+
- MESSAGE_POLL_VOTE_ADD
|
|
115
|
+
- MESSAGE_POLL_VOTE_REMOVE
|
|
116
|
+
*/
|
|
117
|
+
const DCIntentsMap = {
|
|
118
|
+
GUILDS: 1 << 0,
|
|
119
|
+
GUILD_MEMBERS: 1 << 1,
|
|
120
|
+
GUILD_MODERATION: 1 << 2,
|
|
121
|
+
GUILD_EXPRESSIONS: 1 << 3,
|
|
122
|
+
GUILD_INTEGRATIONS: 1 << 4,
|
|
123
|
+
GUILD_WEBHOOKS: 1 << 5,
|
|
124
|
+
GUILD_INVITES: 1 << 6,
|
|
125
|
+
GUILD_VOICE_STATES: 1 << 7,
|
|
126
|
+
GUILD_PRESENCES: 1 << 8,
|
|
127
|
+
GUILD_MESSAGES: 1 << 9,
|
|
128
|
+
GUILD_MESSAGE_REACTIONS: 1 << 10,
|
|
129
|
+
GUILD_MESSAGE_TYPING: 1 << 11,
|
|
130
|
+
DIRECT_MESSAGES: 1 << 12,
|
|
131
|
+
DIRECT_MESSAGE_REACTIONS: 1 << 13,
|
|
132
|
+
DIRECT_MESSAGE_TYPING: 1 << 14,
|
|
133
|
+
MESSAGE_CONTENT: 1 << 15,
|
|
134
|
+
GUILD_SCHEDULED_EVENTS: 1 << 16,
|
|
135
|
+
AUTO_MODERATION_CONFIGURATION: 1 << 20,
|
|
136
|
+
AUTO_MODERATION_EXECUTION: 1 << 21,
|
|
137
|
+
GUILD_MESSAGE_POLLS: 1 << 24,
|
|
138
|
+
DIRECT_MESSAGE_POLLS: 1 << 25
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
* @param intents
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
function getIntents(intents) {
|
|
146
|
+
let result = 0;
|
|
147
|
+
for (const intent of intents) {
|
|
148
|
+
const i = DCIntentsMap[intent];
|
|
149
|
+
result |= i;
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { getIntents };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 子频道更新
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type CHANNEL_UPDATE_TYPE = {
|
|
6
|
+
version: number
|
|
7
|
+
user_limit: number
|
|
8
|
+
type: number
|
|
9
|
+
rtc_region: null
|
|
10
|
+
rate_limit_per_user: number
|
|
11
|
+
position: number
|
|
12
|
+
permission_overwrites: [
|
|
13
|
+
{
|
|
14
|
+
type: number
|
|
15
|
+
id: string
|
|
16
|
+
deny: string
|
|
17
|
+
allow: string
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: number
|
|
21
|
+
id: string
|
|
22
|
+
deny: string
|
|
23
|
+
allow: string
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: number
|
|
27
|
+
id: string
|
|
28
|
+
deny: string
|
|
29
|
+
allow: string
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: number
|
|
33
|
+
id: string
|
|
34
|
+
deny: string
|
|
35
|
+
allow: string
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
parent_id: null
|
|
39
|
+
nsfw: false
|
|
40
|
+
name: string
|
|
41
|
+
last_message_id: null
|
|
42
|
+
id: string
|
|
43
|
+
guild_id: string
|
|
44
|
+
flags: number
|
|
45
|
+
bitrate: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type { CHANNEL_UPDATE_TYPE }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 频道 成员 增加
|
|
3
|
+
*/
|
|
4
|
+
type GUILD_MEMBER_ADD_TYPE = {
|
|
5
|
+
user: {
|
|
6
|
+
username: string
|
|
7
|
+
public_flags: number
|
|
8
|
+
id: string
|
|
9
|
+
global_name: string
|
|
10
|
+
discriminator: string
|
|
11
|
+
avatar_decoration_data: null
|
|
12
|
+
avatar: string
|
|
13
|
+
}
|
|
14
|
+
unusual_dm_activity_until: null
|
|
15
|
+
roles: any[]
|
|
16
|
+
premium_since: null
|
|
17
|
+
pending: boolean
|
|
18
|
+
nick: null
|
|
19
|
+
mute: boolean
|
|
20
|
+
joined_at: string
|
|
21
|
+
guild_id: string
|
|
22
|
+
flags: number
|
|
23
|
+
deaf: boolean
|
|
24
|
+
communication_disabled_until: null
|
|
25
|
+
avatar: null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type { GUILD_MEMBER_ADD_TYPE }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 频道成员删除
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type GUILD_MEMBER_REMOVE_TYPE = {
|
|
6
|
+
user: {
|
|
7
|
+
username: string
|
|
8
|
+
public_flags: number
|
|
9
|
+
id: string
|
|
10
|
+
global_name: string
|
|
11
|
+
discriminator: string
|
|
12
|
+
avatar_decoration_data: null
|
|
13
|
+
avatar: string
|
|
14
|
+
}
|
|
15
|
+
guild_id: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { GUILD_MEMBER_REMOVE_TYPE }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 频道成员更新
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type GUILD_MEMBER_UPDATE_TYPE = {
|
|
6
|
+
user: {
|
|
7
|
+
username: string
|
|
8
|
+
public_flags: number
|
|
9
|
+
id: string
|
|
10
|
+
global_name: string
|
|
11
|
+
display_name: string
|
|
12
|
+
discriminator: string
|
|
13
|
+
bot: boolean
|
|
14
|
+
avatar_decoration_data: {
|
|
15
|
+
sku_id: string
|
|
16
|
+
asset: string
|
|
17
|
+
}
|
|
18
|
+
avatar: string
|
|
19
|
+
}
|
|
20
|
+
roles: string[]
|
|
21
|
+
premium_since: null
|
|
22
|
+
pending: boolean
|
|
23
|
+
nick: null
|
|
24
|
+
mute: boolean
|
|
25
|
+
joined_at: string
|
|
26
|
+
guild_id: string
|
|
27
|
+
flags: number
|
|
28
|
+
deaf: boolean
|
|
29
|
+
communication_disabled_until: null
|
|
30
|
+
avatar: null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type { GUILD_MEMBER_UPDATE_TYPE }
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
interface User {
|
|
2
|
+
username: string
|
|
3
|
+
public_flags: number
|
|
4
|
+
primary_guild: null
|
|
5
|
+
id: string
|
|
6
|
+
global_name: string | null
|
|
7
|
+
discriminator: string
|
|
8
|
+
collectibles: null
|
|
9
|
+
clan: null
|
|
10
|
+
avatar_decoration_data: null
|
|
11
|
+
avatar: string
|
|
12
|
+
}
|
|
13
|
+
type Message = {
|
|
14
|
+
type: number
|
|
15
|
+
tts: boolean
|
|
16
|
+
timestamp: string
|
|
17
|
+
pinned: boolean
|
|
18
|
+
mentions: unknown[]
|
|
19
|
+
mention_roles: unknown[]
|
|
20
|
+
mention_everyone: boolean
|
|
21
|
+
id: string
|
|
22
|
+
flags: number
|
|
23
|
+
embeds: unknown[]
|
|
24
|
+
edited_timestamp: string | null
|
|
25
|
+
content: string
|
|
26
|
+
components: unknown[]
|
|
27
|
+
channel_id: string
|
|
28
|
+
author: User
|
|
29
|
+
attachments: unknown[]
|
|
30
|
+
}
|
|
31
|
+
type Member = {
|
|
32
|
+
user: User
|
|
33
|
+
unusual_dm_activity_until: string | null
|
|
34
|
+
roles: string[]
|
|
35
|
+
premium_since: string | null
|
|
36
|
+
permissions: string
|
|
37
|
+
pending: boolean
|
|
38
|
+
nick: string | null
|
|
39
|
+
mute: boolean
|
|
40
|
+
joined_at: string
|
|
41
|
+
flags: number
|
|
42
|
+
deaf: boolean
|
|
43
|
+
communication_disabled_until: string | null
|
|
44
|
+
banner: string | null
|
|
45
|
+
avatar: string | null
|
|
46
|
+
}
|
|
47
|
+
type DiscordGuild = {
|
|
48
|
+
locale: string
|
|
49
|
+
id: string
|
|
50
|
+
features: string[]
|
|
51
|
+
}
|
|
52
|
+
type PublicChannel = {
|
|
53
|
+
type: number
|
|
54
|
+
topic: string | null
|
|
55
|
+
theme_color: number | null
|
|
56
|
+
rate_limit_per_user: number
|
|
57
|
+
position: number
|
|
58
|
+
permissions: string
|
|
59
|
+
parent_id: string
|
|
60
|
+
nsfw: boolean
|
|
61
|
+
name: string
|
|
62
|
+
last_message_id: string
|
|
63
|
+
id: string
|
|
64
|
+
icon_emoji: {
|
|
65
|
+
name: string
|
|
66
|
+
id: string | null
|
|
67
|
+
}
|
|
68
|
+
guild_id: string
|
|
69
|
+
flags: number
|
|
70
|
+
}
|
|
71
|
+
interface Channel {
|
|
72
|
+
type: number
|
|
73
|
+
recipients: any[]
|
|
74
|
+
recipient_flags: number
|
|
75
|
+
last_message_id: string
|
|
76
|
+
id: string
|
|
77
|
+
flags: number
|
|
78
|
+
}
|
|
79
|
+
interface Data {
|
|
80
|
+
id: number
|
|
81
|
+
custom_id: string
|
|
82
|
+
component_type: number
|
|
83
|
+
}
|
|
84
|
+
type Public = {
|
|
85
|
+
version: number
|
|
86
|
+
type: number
|
|
87
|
+
token: string
|
|
88
|
+
member: Member
|
|
89
|
+
message: Message
|
|
90
|
+
locale: string
|
|
91
|
+
id: string
|
|
92
|
+
guild_locale: string
|
|
93
|
+
guild_id: string
|
|
94
|
+
guild: DiscordGuild
|
|
95
|
+
entitlement_sku_ids: any[]
|
|
96
|
+
entitlements: any[]
|
|
97
|
+
data: Data
|
|
98
|
+
context: number
|
|
99
|
+
channel_id: string
|
|
100
|
+
channel: PublicChannel
|
|
101
|
+
authorizing_integration_owners: Record<string, string>
|
|
102
|
+
attachment_size_limit: number
|
|
103
|
+
application_id: string
|
|
104
|
+
app_permissions: string
|
|
105
|
+
}
|
|
106
|
+
type Private = {
|
|
107
|
+
version: number
|
|
108
|
+
type: number
|
|
109
|
+
token: string
|
|
110
|
+
user: User
|
|
111
|
+
message: Message
|
|
112
|
+
locale: string
|
|
113
|
+
id: string
|
|
114
|
+
entitlements: any[]
|
|
115
|
+
data: Data
|
|
116
|
+
context: number
|
|
117
|
+
channel_id: string
|
|
118
|
+
channel: Channel
|
|
119
|
+
authorizing_integration_owners: Record<string, string>
|
|
120
|
+
attachment_size_limit: number
|
|
121
|
+
application_id: string
|
|
122
|
+
app_permissions: string
|
|
123
|
+
}
|
|
124
|
+
type INTERACTION_CREATE_TYPE = Public | Private
|
|
125
|
+
|
|
126
|
+
export type { INTERACTION_CREATE_TYPE }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 基础消息
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type MESSAGE_CREATE_TYPE = {
|
|
6
|
+
type: number
|
|
7
|
+
tts: boolean
|
|
8
|
+
timestamp: string
|
|
9
|
+
referenced_message: null
|
|
10
|
+
pinned: boolean
|
|
11
|
+
nonce: string
|
|
12
|
+
mentions: {
|
|
13
|
+
username: string
|
|
14
|
+
public_flags: number
|
|
15
|
+
member: any
|
|
16
|
+
id: string
|
|
17
|
+
global_name: null
|
|
18
|
+
discriminator: string
|
|
19
|
+
bot: boolean
|
|
20
|
+
avatar_decoration_data: null
|
|
21
|
+
avatar: string
|
|
22
|
+
}[]
|
|
23
|
+
mention_roles: any[]
|
|
24
|
+
mention_everyone: boolean
|
|
25
|
+
member: {
|
|
26
|
+
roles: any[]
|
|
27
|
+
premium_since: null
|
|
28
|
+
pending: boolean
|
|
29
|
+
nick: null
|
|
30
|
+
mute: boolean
|
|
31
|
+
joined_at: string
|
|
32
|
+
flags: number
|
|
33
|
+
deaf: boolean
|
|
34
|
+
communication_disabled_until: null
|
|
35
|
+
avatar: null
|
|
36
|
+
}
|
|
37
|
+
id: string
|
|
38
|
+
flags: number
|
|
39
|
+
embeds: any[]
|
|
40
|
+
edited_timestamp: null
|
|
41
|
+
content: string
|
|
42
|
+
components: any[]
|
|
43
|
+
channel_id: string
|
|
44
|
+
author: {
|
|
45
|
+
username: string
|
|
46
|
+
public_flags: number
|
|
47
|
+
premium_type: number
|
|
48
|
+
id: string
|
|
49
|
+
global_name: string
|
|
50
|
+
discriminator: string
|
|
51
|
+
avatar_decoration_data: null
|
|
52
|
+
avatar: string
|
|
53
|
+
bot?: boolean
|
|
54
|
+
}
|
|
55
|
+
attachments: any[]
|
|
56
|
+
guild_id: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type { MESSAGE_CREATE_TYPE }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 表情增加
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type MESSAGE_REACTION_ADD_TYPE = {
|
|
6
|
+
user_id: string
|
|
7
|
+
type: number
|
|
8
|
+
message_id: string
|
|
9
|
+
message_author_id: string
|
|
10
|
+
member: {
|
|
11
|
+
user: {
|
|
12
|
+
username: string
|
|
13
|
+
public_flags: number
|
|
14
|
+
id: string
|
|
15
|
+
global_name: string
|
|
16
|
+
display_name: string
|
|
17
|
+
discriminator: string
|
|
18
|
+
bot: boolean
|
|
19
|
+
avatar_decoration_data: null
|
|
20
|
+
avatar: string
|
|
21
|
+
}
|
|
22
|
+
roles: string[]
|
|
23
|
+
premium_since: null
|
|
24
|
+
pending: boolean
|
|
25
|
+
nick: null
|
|
26
|
+
mute: boolean
|
|
27
|
+
joined_at: string
|
|
28
|
+
flags: number
|
|
29
|
+
deaf: boolean
|
|
30
|
+
communication_disabled_until: null
|
|
31
|
+
avatar: null
|
|
32
|
+
}
|
|
33
|
+
emoji: {
|
|
34
|
+
name: string
|
|
35
|
+
id: string
|
|
36
|
+
}
|
|
37
|
+
channel_id: string
|
|
38
|
+
burst: boolean
|
|
39
|
+
guild_id: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { MESSAGE_REACTION_ADD_TYPE }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息更新
|
|
3
|
+
* @param event
|
|
4
|
+
*/
|
|
5
|
+
type MESSAGE_UPDATE_TYPE = {
|
|
6
|
+
type: number
|
|
7
|
+
tts: boolean
|
|
8
|
+
timestamp: string
|
|
9
|
+
pinned: boolean
|
|
10
|
+
mentions: any[]
|
|
11
|
+
mention_roles: string[]
|
|
12
|
+
mention_everyone: boolean
|
|
13
|
+
member: {
|
|
14
|
+
roles: string[]
|
|
15
|
+
premium_since: null
|
|
16
|
+
pending: boolean
|
|
17
|
+
nick: null
|
|
18
|
+
mute: boolean
|
|
19
|
+
joined_at: string
|
|
20
|
+
flags: number
|
|
21
|
+
deaf: boolean
|
|
22
|
+
communication_disabled_until: null
|
|
23
|
+
avatar: null
|
|
24
|
+
}
|
|
25
|
+
id: string
|
|
26
|
+
flags: number
|
|
27
|
+
embeds: {
|
|
28
|
+
type: string
|
|
29
|
+
title: string
|
|
30
|
+
image: any
|
|
31
|
+
description: ''
|
|
32
|
+
color: number
|
|
33
|
+
}[]
|
|
34
|
+
edited_timestamp: string
|
|
35
|
+
content: string
|
|
36
|
+
components: {
|
|
37
|
+
type: number
|
|
38
|
+
components: any
|
|
39
|
+
}[]
|
|
40
|
+
channel_id: string
|
|
41
|
+
author: {
|
|
42
|
+
username: string
|
|
43
|
+
public_flags: number
|
|
44
|
+
premium_type: number
|
|
45
|
+
id: string
|
|
46
|
+
global_name: null
|
|
47
|
+
discriminator: string
|
|
48
|
+
bot: true
|
|
49
|
+
avatar_decoration_data: null
|
|
50
|
+
avatar: string
|
|
51
|
+
}
|
|
52
|
+
attachments: any[]
|
|
53
|
+
guild_id: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type { MESSAGE_UPDATE_TYPE }
|