n8n-nodes-discord-dnd 0.1.57 → 0.1.59
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/Interfaces/types.d.ts +125 -0
- package/dist/{nodes → Interfaces}/types.js.map +1 -1
- package/dist/handlers/DiscordEventHandler.js +39 -3
- package/dist/handlers/DiscordEventHandler.js.map +1 -1
- package/dist/transformers/MessageTransformer.d.ts +2 -1
- package/dist/transformers/MessageTransformer.js +39 -64
- package/dist/transformers/MessageTransformer.js.map +1 -1
- package/package.json +1 -1
- package/dist/nodes/types.d.ts +0 -4
- /package/dist/{nodes → Interfaces}/types.js +0 -0
@@ -0,0 +1,125 @@
|
|
1
|
+
import { User, Attachment, MessageReference, Poll, MessageCall } from "discord.js";
|
2
|
+
export interface ITriggerParameters {
|
3
|
+
triggerType: string;
|
4
|
+
event: string;
|
5
|
+
}
|
6
|
+
export interface n8nMessage {
|
7
|
+
id: string;
|
8
|
+
content: string;
|
9
|
+
channelId: string;
|
10
|
+
guildId: string | null;
|
11
|
+
createdTimestamp: number;
|
12
|
+
type: number;
|
13
|
+
system: boolean;
|
14
|
+
isDirectMessage: boolean;
|
15
|
+
author: User;
|
16
|
+
pinned: boolean;
|
17
|
+
tts: boolean;
|
18
|
+
nonce: string | number | null;
|
19
|
+
embeds: Array<{
|
20
|
+
title?: string;
|
21
|
+
description?: string;
|
22
|
+
url?: string;
|
23
|
+
timestamp?: string;
|
24
|
+
color?: number;
|
25
|
+
fields?: Array<{
|
26
|
+
name: string;
|
27
|
+
value: string;
|
28
|
+
inline?: boolean;
|
29
|
+
}>;
|
30
|
+
author?: {
|
31
|
+
name?: string;
|
32
|
+
url?: string;
|
33
|
+
iconURL?: string;
|
34
|
+
} | null;
|
35
|
+
footer?: {
|
36
|
+
text: string;
|
37
|
+
iconURL?: string;
|
38
|
+
} | null;
|
39
|
+
image?: {
|
40
|
+
url: string;
|
41
|
+
} | null;
|
42
|
+
thumbnail?: {
|
43
|
+
url: string;
|
44
|
+
} | null;
|
45
|
+
video?: {
|
46
|
+
url: string;
|
47
|
+
} | null;
|
48
|
+
}>;
|
49
|
+
components?: Array<{
|
50
|
+
type: number;
|
51
|
+
components: Array<{
|
52
|
+
type: number;
|
53
|
+
customId?: string;
|
54
|
+
label?: string;
|
55
|
+
style?: number;
|
56
|
+
url?: string;
|
57
|
+
disabled?: boolean;
|
58
|
+
}>;
|
59
|
+
}>;
|
60
|
+
attachments?: Array<Partial<Attachment>>;
|
61
|
+
stickers?: any[];
|
62
|
+
position?: number | null;
|
63
|
+
roleSubscriptionData?: any;
|
64
|
+
editedTimestamp: number | null;
|
65
|
+
mentions: {
|
66
|
+
everyone: boolean;
|
67
|
+
users: Array<{
|
68
|
+
id: string;
|
69
|
+
username: string;
|
70
|
+
discriminator: string;
|
71
|
+
globalName: string | null;
|
72
|
+
avatar: string | null;
|
73
|
+
}>;
|
74
|
+
roles: Array<{
|
75
|
+
id: string;
|
76
|
+
name: string;
|
77
|
+
color: number;
|
78
|
+
}>;
|
79
|
+
crosspostedChannels: Array<{
|
80
|
+
id: string;
|
81
|
+
guildId: string;
|
82
|
+
type: number;
|
83
|
+
}>;
|
84
|
+
repliedUser: {
|
85
|
+
id: string;
|
86
|
+
username: string;
|
87
|
+
discriminator: string;
|
88
|
+
globalName: string | null;
|
89
|
+
avatar: string | null;
|
90
|
+
} | null;
|
91
|
+
repliedMessage: {
|
92
|
+
id: string;
|
93
|
+
channelId: string;
|
94
|
+
guildId?: string;
|
95
|
+
content: string | null;
|
96
|
+
} | null;
|
97
|
+
members: Array<{
|
98
|
+
id: string;
|
99
|
+
nickname: string | null;
|
100
|
+
}>;
|
101
|
+
channels: Array<{
|
102
|
+
id: string;
|
103
|
+
name: string;
|
104
|
+
type: number;
|
105
|
+
}>;
|
106
|
+
};
|
107
|
+
webhookId?: string | null;
|
108
|
+
applicationId?: string | null;
|
109
|
+
activity?: any;
|
110
|
+
flags?: string[];
|
111
|
+
reference?: MessageReference | null;
|
112
|
+
interaction?: {
|
113
|
+
id: string;
|
114
|
+
type: number;
|
115
|
+
userId?: string;
|
116
|
+
} | null;
|
117
|
+
poll?: Poll | null;
|
118
|
+
messageSnapshots?: Array<{
|
119
|
+
message: {
|
120
|
+
id: string;
|
121
|
+
content: string;
|
122
|
+
};
|
123
|
+
}>;
|
124
|
+
call?: MessageCall | null;
|
125
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Interfaces/types.ts"],"names":[],"mappings":""}
|
@@ -20,7 +20,7 @@ class DiscordEventHandler {
|
|
20
20
|
return null;
|
21
21
|
const guild = guildId ? this.client.guilds.cache.get(guildId) : null;
|
22
22
|
const member = guild
|
23
|
-
? await guild.members.fetch(memberOrUser.id)
|
23
|
+
? await guild.members.fetch(memberOrUser.id).catch(() => null)
|
24
24
|
: null;
|
25
25
|
return {
|
26
26
|
...memberOrUser,
|
@@ -39,7 +39,13 @@ class DiscordEventHandler {
|
|
39
39
|
const message = args[0];
|
40
40
|
const messageData = (0, MessageTransformer_1.messageToJson)(message);
|
41
41
|
data.message = messageData;
|
42
|
-
|
42
|
+
// Use the guild ID from the message when enriching the author
|
43
|
+
if (message.author && message.guildId) {
|
44
|
+
data.user = await enrichMember(message.author, message.guildId);
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
data.user = message.author;
|
48
|
+
}
|
43
49
|
if (message.reference && ((_a = messageData.mentions) === null || _a === void 0 ? void 0 : _a.repliedMessage)) {
|
44
50
|
const referencedContent = await (0, MessageTransformer_1.fetchReferencedMessage)(message);
|
45
51
|
if (referencedContent) {
|
@@ -55,7 +61,37 @@ class DiscordEventHandler {
|
|
55
61
|
break;
|
56
62
|
default:
|
57
63
|
data.eventData = args;
|
58
|
-
|
64
|
+
// Try to extract user/member and guild info from the first argument
|
65
|
+
const firstArg = args[0];
|
66
|
+
if (firstArg) {
|
67
|
+
if (firstArg.author && firstArg.guildId) {
|
68
|
+
// Message-like object
|
69
|
+
data.user = await enrichMember(firstArg.author, firstArg.guildId);
|
70
|
+
}
|
71
|
+
else if (firstArg.user && firstArg.guild) {
|
72
|
+
// Member-like object
|
73
|
+
data.user = await enrichMember(firstArg.user, firstArg.guild.id);
|
74
|
+
}
|
75
|
+
else if (firstArg.id) {
|
76
|
+
// User-like object, try to find in guilds
|
77
|
+
const guilds = this.client.guilds.cache;
|
78
|
+
let enrichedUser = null;
|
79
|
+
// Try to find user in any guild the bot is in
|
80
|
+
for (const [, guild] of guilds) {
|
81
|
+
try {
|
82
|
+
const member = await guild.members.fetch(firstArg.id);
|
83
|
+
if (member) {
|
84
|
+
enrichedUser = await enrichMember(firstArg, guild.id);
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
catch {
|
89
|
+
// Ignore errors, just try next guild
|
90
|
+
}
|
91
|
+
}
|
92
|
+
data.user = enrichedUser || firstArg;
|
93
|
+
}
|
94
|
+
}
|
59
95
|
}
|
60
96
|
this.triggerInstance.emit([
|
61
97
|
this.triggerInstance.helpers.returnJsonArray([data]),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DiscordEventHandler.js","sourceRoot":"","sources":["../../src/handlers/DiscordEventHandler.ts"],"names":[],"mappings":";;;AAEA,2EAG4C;AAE5C,MAAa,mBAAmB;IAC9B,YACmB,MAAc,EACd,eAAkC;QADlC,WAAM,GAAN,MAAM,CAAQ;QACd,oBAAe,GAAf,eAAe,CAAmB;IAClD,CAAC;IAEJ,iBAAiB,CAAC,KAAa;QAC7B,iBAAiB;QACjB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,qBAAqB;QACrB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;;YAC7C,MAAM,IAAI,GAAgB,EAAE,CAAC;YAE7B,+CAA+C;YAC/C,MAAM,YAAY,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YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;wCACtD,MAAM;qCACP;iCACF;gCAAC,MAAM;oCACN,qCAAqC;iCACtC;6BACF;4BAED,IAAI,CAAC,IAAI,GAAG,YAAY,IAAI,QAAQ,CAAC;yBACtC;qBACF;aACJ;YAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;gBACxB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC;aACrD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAChC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvHD,kDAuHC"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Message } from "discord.js";
|
2
|
+
import { n8nMessage } from "../Interfaces/types";
|
2
3
|
/**
|
3
4
|
* Fetches the referenced message and returns its content
|
4
5
|
* @param message The message that contains a reference to another message
|
5
6
|
* @returns The referenced message content or null if no reference exists
|
6
7
|
*/
|
7
8
|
export declare function fetchReferencedMessage(message: Message): Promise<string | null>;
|
8
|
-
export declare function messageToJson(message: Message):
|
9
|
+
export declare function messageToJson(message: Message): n8nMessage;
|
@@ -13,7 +13,7 @@ async function fetchReferencedMessage(message) {
|
|
13
13
|
return referencedMessage.content;
|
14
14
|
}
|
15
15
|
catch (error) {
|
16
|
-
console.error(
|
16
|
+
console.error("Error fetching referenced message:", error);
|
17
17
|
return null;
|
18
18
|
}
|
19
19
|
}
|
@@ -21,7 +21,7 @@ async function fetchReferencedMessage(message) {
|
|
21
21
|
}
|
22
22
|
exports.fetchReferencedMessage = fetchReferencedMessage;
|
23
23
|
function messageToJson(message) {
|
24
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
25
25
|
const n8nMessage = {
|
26
26
|
id: message.id,
|
27
27
|
content: message.content,
|
@@ -31,23 +31,11 @@ function messageToJson(message) {
|
|
31
31
|
type: message.type,
|
32
32
|
system: message.system,
|
33
33
|
isDirectMessage: !message.guild,
|
34
|
-
author:
|
35
|
-
id: (_a = message.author) === null || _a === void 0 ? void 0 : _a.id,
|
36
|
-
username: (_b = message.author) === null || _b === void 0 ? void 0 : _b.username,
|
37
|
-
discriminator: (_c = message.author) === null || _c === void 0 ? void 0 : _c.discriminator,
|
38
|
-
globalName: (_d = message.author) === null || _d === void 0 ? void 0 : _d.globalName,
|
39
|
-
avatar: (_e = message.author) === null || _e === void 0 ? void 0 : _e.avatar,
|
40
|
-
bot: (_f = message.author) === null || _f === void 0 ? void 0 : _f.bot,
|
41
|
-
system: (_g = message.author) === null || _g === void 0 ? void 0 : _g.system,
|
42
|
-
flags: (_j = (_h = message.author) === null || _h === void 0 ? void 0 : _h.flags) === null || _j === void 0 ? void 0 : _j.toArray(),
|
43
|
-
banner: (_k = message.author) === null || _k === void 0 ? void 0 : _k.banner,
|
44
|
-
accentColor: (_l = message.author) === null || _l === void 0 ? void 0 : _l.accentColor,
|
45
|
-
avatarDecoration: (_m = message.author) === null || _m === void 0 ? void 0 : _m.avatarDecoration,
|
46
|
-
},
|
34
|
+
author: message.author,
|
47
35
|
pinned: message.pinned,
|
48
36
|
tts: message.tts,
|
49
37
|
nonce: message.nonce,
|
50
|
-
embeds: (
|
38
|
+
embeds: (_a = message.embeds) === null || _a === void 0 ? void 0 : _a.map((embed) => {
|
51
39
|
var _a;
|
52
40
|
return ({
|
53
41
|
title: embed.title,
|
@@ -78,7 +66,7 @@ function messageToJson(message) {
|
|
78
66
|
video: embed.video ? { url: embed.video.url } : null,
|
79
67
|
});
|
80
68
|
}),
|
81
|
-
components: (
|
69
|
+
components: (_b = message.components) === null || _b === void 0 ? void 0 : _b.map((component) => {
|
82
70
|
var _a;
|
83
71
|
return ({
|
84
72
|
type: component.type,
|
@@ -92,16 +80,27 @@ function messageToJson(message) {
|
|
92
80
|
})),
|
93
81
|
});
|
94
82
|
}),
|
95
|
-
attachments: (
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
83
|
+
attachments: (_c = message.attachments) === null || _c === void 0 ? void 0 : _c.map((attachment) => {
|
84
|
+
var _a;
|
85
|
+
return ({
|
86
|
+
contentType: attachment.contentType,
|
87
|
+
description: attachment.description,
|
88
|
+
duration: attachment.duration,
|
89
|
+
ephemeral: attachment.ephemeral,
|
90
|
+
flags: (_a = attachment.flags) === null || _a === void 0 ? void 0 : _a.toArray(),
|
91
|
+
height: attachment.height,
|
92
|
+
id: attachment.id,
|
93
|
+
name: attachment.name,
|
94
|
+
proxyURL: attachment.proxyURL,
|
95
|
+
size: attachment.size,
|
96
|
+
spoiler: attachment.spoiler,
|
97
|
+
title: attachment.title,
|
98
|
+
url: attachment.url,
|
99
|
+
waveform: attachment.waveform,
|
100
|
+
width: attachment.width,
|
101
|
+
});
|
102
|
+
}),
|
103
|
+
stickers: (_d = message.stickers) === null || _d === void 0 ? void 0 : _d.map((sticker) => ({
|
105
104
|
id: sticker.id,
|
106
105
|
name: sticker.name,
|
107
106
|
formatType: sticker.formatType,
|
@@ -110,25 +109,25 @@ function messageToJson(message) {
|
|
110
109
|
roleSubscriptionData: message.roleSubscriptionData,
|
111
110
|
editedTimestamp: message.editedTimestamp,
|
112
111
|
mentions: {
|
113
|
-
everyone: (
|
114
|
-
users: ((
|
112
|
+
everyone: (_e = message.mentions) === null || _e === void 0 ? void 0 : _e.everyone,
|
113
|
+
users: ((_g = (_f = message.mentions) === null || _f === void 0 ? void 0 : _f.users) === null || _g === void 0 ? void 0 : _g.map((user) => ({
|
115
114
|
id: user.id,
|
116
115
|
username: user.username,
|
117
116
|
discriminator: user.discriminator,
|
118
117
|
globalName: user.globalName,
|
119
118
|
avatar: user.avatar,
|
120
119
|
}))) || [],
|
121
|
-
roles: ((
|
120
|
+
roles: ((_j = (_h = message.mentions) === null || _h === void 0 ? void 0 : _h.roles) === null || _j === void 0 ? void 0 : _j.map((role) => ({
|
122
121
|
id: role.id,
|
123
122
|
name: role.name,
|
124
123
|
color: role.color,
|
125
124
|
}))) || [],
|
126
|
-
crosspostedChannels: ((
|
125
|
+
crosspostedChannels: ((_l = (_k = message.mentions) === null || _k === void 0 ? void 0 : _k.crosspostedChannels) === null || _l === void 0 ? void 0 : _l.map((channel) => ({
|
127
126
|
id: channel.id,
|
128
127
|
guildId: channel.guildId,
|
129
128
|
type: channel.type,
|
130
129
|
}))) || [],
|
131
|
-
repliedUser: ((
|
130
|
+
repliedUser: ((_m = message.mentions) === null || _m === void 0 ? void 0 : _m.repliedUser)
|
132
131
|
? {
|
133
132
|
id: message.mentions.repliedUser.id,
|
134
133
|
username: message.mentions.repliedUser.username,
|
@@ -145,11 +144,11 @@ function messageToJson(message) {
|
|
145
144
|
content: null, // Will be populated if fetchReferencedMessage is called
|
146
145
|
}
|
147
146
|
: null,
|
148
|
-
members: ((
|
147
|
+
members: ((_p = (_o = message.mentions) === null || _o === void 0 ? void 0 : _o.members) === null || _p === void 0 ? void 0 : _p.map((member) => ({
|
149
148
|
id: member.id,
|
150
149
|
nickname: member.nickname,
|
151
150
|
}))) || [],
|
152
|
-
channels: ((
|
151
|
+
channels: ((_r = (_q = message.mentions) === null || _q === void 0 ? void 0 : _q.channels) === null || _r === void 0 ? void 0 : _r.map((channel) => ({
|
153
152
|
id: channel.id,
|
154
153
|
name: channel.name,
|
155
154
|
type: channel.type,
|
@@ -158,47 +157,23 @@ function messageToJson(message) {
|
|
158
157
|
webhookId: message.webhookId,
|
159
158
|
applicationId: message.applicationId,
|
160
159
|
activity: message.activity,
|
161
|
-
flags: (
|
162
|
-
reference: message.reference
|
163
|
-
? {
|
164
|
-
channelId: message.reference.channelId,
|
165
|
-
guildId: message.reference.guildId,
|
166
|
-
messageId: message.reference.messageId,
|
167
|
-
}
|
168
|
-
: null,
|
160
|
+
flags: (_s = message.flags) === null || _s === void 0 ? void 0 : _s.toArray(),
|
161
|
+
reference: message.reference,
|
169
162
|
interaction: message.interactionMetadata
|
170
163
|
? {
|
171
164
|
id: message.interactionMetadata.id,
|
172
165
|
type: message.interactionMetadata.type,
|
173
|
-
userId: (
|
174
|
-
}
|
175
|
-
: null,
|
176
|
-
poll: message.poll
|
177
|
-
? {
|
178
|
-
question: (_6 = message.poll.question) === null || _6 === void 0 ? void 0 : _6.text,
|
179
|
-
answers: (_7 = message.poll.answers) === null || _7 === void 0 ? void 0 : _7.map((answer) => ({
|
180
|
-
answerId: answer.answerId,
|
181
|
-
text: answer.text,
|
182
|
-
voteCount: answer.voteCount,
|
183
|
-
})),
|
184
|
-
expiresTimestamp: message.poll.expiresTimestamp,
|
185
|
-
allowMultiselect: message.poll.allowMultiselect,
|
186
|
-
layoutType: message.poll.layoutType,
|
187
|
-
resultsFinalized: message.poll.resultsFinalized,
|
166
|
+
userId: (_t = message.interactionMetadata.user) === null || _t === void 0 ? void 0 : _t.id,
|
188
167
|
}
|
189
168
|
: null,
|
190
|
-
|
169
|
+
poll: message.poll,
|
170
|
+
messageSnapshots: (_u = message.messageSnapshots) === null || _u === void 0 ? void 0 : _u.map((snapshot) => ({
|
191
171
|
message: {
|
192
172
|
id: snapshot.message.id,
|
193
173
|
content: snapshot.message.content,
|
194
174
|
},
|
195
175
|
})),
|
196
|
-
call: message.call
|
197
|
-
? {
|
198
|
-
endedTimestamp: message.call.endedTimestamp,
|
199
|
-
participants: (_9 = message.call.participants) === null || _9 === void 0 ? void 0 : _9.map((user) => user.id),
|
200
|
-
}
|
201
|
-
: null,
|
176
|
+
call: message.call,
|
202
177
|
};
|
203
178
|
return n8nMessage;
|
204
179
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessageTransformer.js","sourceRoot":"","sources":["../../src/transformers/MessageTransformer.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"MessageTransformer.js","sourceRoot":"","sources":["../../src/transformers/MessageTransformer.ts"],"names":[],"mappings":";;;AAaA;;;;GAIG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAAgB;IAEhB,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE;QACpD,IAAI;YACF,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;YACzD,OAAO,iBAAiB,CAAC,OAAO,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;YAC3D,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,wDAaC;AAED,SAAgB,aAAa,CAAC,OAAgB;;IAC5C,MAAM,UAAU,GAAe;QAC7B,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC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