@satorijs/adapter-discord 3.8.8 → 3.9.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/lib/bot.d.ts +6 -2
- package/lib/index.js +5 -5
- package/lib/index.js.map +2 -2
- package/lib/utils.d.ts +1 -1
- package/package.json +2 -2
package/lib/bot.d.ts
CHANGED
|
@@ -18,9 +18,13 @@ export declare class DiscordBot extends Bot<DiscordBot.Config> {
|
|
|
18
18
|
deleteMessage(channelId: string, messageId: string): Promise<void>;
|
|
19
19
|
editMessage(channelId: string, messageId: string, content: Fragment): Promise<void>;
|
|
20
20
|
getMessage(channelId: string, messageId: string): Promise<Universal.Message>;
|
|
21
|
-
getMessageList(channelId: string, before?: string): Promise<
|
|
21
|
+
getMessageList(channelId: string, before?: string): Promise<{
|
|
22
|
+
data: Universal.Message[];
|
|
23
|
+
}>;
|
|
22
24
|
getUser(userId: string): Promise<Universal.User>;
|
|
23
|
-
getGuildMemberList(guildId: string): Promise<
|
|
25
|
+
getGuildMemberList(guildId: string): Promise<{
|
|
26
|
+
data: Universal.User[];
|
|
27
|
+
}>;
|
|
24
28
|
getChannel(channelId: string): Promise<Universal.Channel>;
|
|
25
29
|
getGuildMember(guildId: string, userId: string): Promise<{
|
|
26
30
|
nickname: string;
|
package/lib/index.js
CHANGED
|
@@ -1215,7 +1215,7 @@ var encodeRole = /* @__PURE__ */ __name((role) => ({
|
|
|
1215
1215
|
...role,
|
|
1216
1216
|
permissions: role.permissions && "" + role.permissions
|
|
1217
1217
|
}), "encodeRole");
|
|
1218
|
-
async function decodeMessage(bot, meta, session = {}) {
|
|
1218
|
+
async function decodeMessage(bot, meta, session = {}, reference = true) {
|
|
1219
1219
|
var _a, _b, _c;
|
|
1220
1220
|
const { platform } = bot;
|
|
1221
1221
|
session.messageId = meta.id;
|
|
@@ -1293,7 +1293,7 @@ async function decodeMessage(bot, meta, session = {}) {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
1295
|
session.elements = import_satori2.h.parse(session.content);
|
|
1296
|
-
if (meta.message_reference) {
|
|
1296
|
+
if (reference && meta.message_reference) {
|
|
1297
1297
|
const { message_id, channel_id } = meta.message_reference;
|
|
1298
1298
|
session.quote = await bot.getMessage(channel_id, message_id);
|
|
1299
1299
|
}
|
|
@@ -1992,8 +1992,8 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
|
|
|
1992
1992
|
return await decodeMessage(this, data);
|
|
1993
1993
|
}
|
|
1994
1994
|
async getMessageList(channelId, before) {
|
|
1995
|
-
const data =
|
|
1996
|
-
return await Promise.all(data.map((data2) => decodeMessage(this, data2)));
|
|
1995
|
+
const data = await this.internal.getChannelMessages(channelId, { before, limit: 100 });
|
|
1996
|
+
return { data: await Promise.all(data.reverse().map((data2) => decodeMessage(this, data2, {}, false))) };
|
|
1997
1997
|
}
|
|
1998
1998
|
async getUser(userId) {
|
|
1999
1999
|
const data = await this.internal.getUser(userId);
|
|
@@ -2001,7 +2001,7 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
async getGuildMemberList(guildId) {
|
|
2003
2003
|
const data = await this.internal.listGuildMembers(guildId);
|
|
2004
|
-
return data.map((v) => decodeUser(v.user));
|
|
2004
|
+
return { data: data.map((v) => decodeUser(v.user)) };
|
|
2005
2005
|
}
|
|
2006
2006
|
async getChannel(channelId) {
|
|
2007
2007
|
const data = await this.internal.getChannel(channelId);
|