@satorijs/adapter-discord 3.8.9 → 3.9.1
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 +3 -5
- package/lib/index.js.map +2 -2
- 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
|
@@ -1876,7 +1876,6 @@ var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
|
|
|
1876
1876
|
return;
|
|
1877
1877
|
this._sessionId = "";
|
|
1878
1878
|
logger2.warn("offline: invalid session");
|
|
1879
|
-
this.bot.offline();
|
|
1880
1879
|
(_a = this.bot.socket) == null ? void 0 : _a.close();
|
|
1881
1880
|
}
|
|
1882
1881
|
if (parsed.op === Gateway.Opcode.DISPATCH) {
|
|
@@ -1897,7 +1896,6 @@ var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
|
|
|
1897
1896
|
this.bot.dispatch(session);
|
|
1898
1897
|
}
|
|
1899
1898
|
if (parsed.op === Gateway.Opcode.RECONNECT) {
|
|
1900
|
-
this.bot.offline();
|
|
1901
1899
|
logger2.warn("offline: discord request reconnect");
|
|
1902
1900
|
(_b = this.bot.socket) == null ? void 0 : _b.close();
|
|
1903
1901
|
}
|
|
@@ -1992,8 +1990,8 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
|
|
|
1992
1990
|
return await decodeMessage(this, data);
|
|
1993
1991
|
}
|
|
1994
1992
|
async getMessageList(channelId, before) {
|
|
1995
|
-
const data =
|
|
1996
|
-
return await Promise.all(data.map((data2) => decodeMessage(this, data2, {}, false)));
|
|
1993
|
+
const data = await this.internal.getChannelMessages(channelId, { before, limit: 100 });
|
|
1994
|
+
return { data: await Promise.all(data.reverse().map((data2) => decodeMessage(this, data2, {}, false))) };
|
|
1997
1995
|
}
|
|
1998
1996
|
async getUser(userId) {
|
|
1999
1997
|
const data = await this.internal.getUser(userId);
|
|
@@ -2001,7 +1999,7 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
|
|
|
2001
1999
|
}
|
|
2002
2000
|
async getGuildMemberList(guildId) {
|
|
2003
2001
|
const data = await this.internal.listGuildMembers(guildId);
|
|
2004
|
-
return data.map((v) => decodeUser(v.user));
|
|
2002
|
+
return { data: data.map((v) => decodeUser(v.user)) };
|
|
2005
2003
|
}
|
|
2006
2004
|
async getChannel(channelId) {
|
|
2007
2005
|
const data = await this.internal.getChannel(channelId);
|