@satorijs/adapter-discord 3.8.4 → 3.8.5

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/index.js CHANGED
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
@@ -26,6 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  mod
27
28
  ));
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => {
31
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ return value;
33
+ };
29
34
 
30
35
  // satori/adapters/discord/src/index.ts
31
36
  var src_exports = {};
@@ -1471,26 +1476,23 @@ var _State = class _State {
1471
1476
  // forward: send the first message and create a thread
1472
1477
  constructor(type) {
1473
1478
  this.type = type;
1474
- this.author = {};
1475
- this.quote = {};
1476
- this.channel = {};
1477
- this.fakeMessageMap = {};
1478
- // [userInput] = discord messages
1479
- this.threadCreated = false;
1480
1479
  }
1480
+ author = {};
1481
+ quote = {};
1482
+ channel = {};
1483
+ fakeMessageMap = {};
1484
+ // [userInput] = discord messages
1485
+ threadCreated = false;
1481
1486
  };
1482
1487
  __name(_State, "State");
1483
1488
  var State = _State;
1484
1489
  var _DiscordMessageEncoder = class _DiscordMessageEncoder extends import_satori3.MessageEncoder {
1485
- constructor() {
1486
- super(...arguments);
1487
- this.stack = [new State("message")];
1488
- this.buffer = "";
1489
- this.addition = {};
1490
- this.figure = null;
1491
- this.mode = "default";
1492
- this.listType = null;
1493
- }
1490
+ stack = [new State("message")];
1491
+ buffer = "";
1492
+ addition = {};
1493
+ figure = null;
1494
+ mode = "default";
1495
+ listType = null;
1494
1496
  async getUrl() {
1495
1497
  var _a, _b, _c, _d;
1496
1498
  const input = (_b = (_a = this.options) == null ? void 0 : _a.session) == null ? void 0 : _b.discord;
@@ -1801,11 +1803,10 @@ var DiscordMessageEncoder = _DiscordMessageEncoder;
1801
1803
  var import_satori4 = require("@satorijs/satori");
1802
1804
  var logger2 = new import_satori4.Logger("discord");
1803
1805
  var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
1804
- constructor() {
1805
- super(...arguments);
1806
- this._d = 0;
1807
- this._sessionId = "";
1808
- }
1806
+ _d = 0;
1807
+ _ping;
1808
+ _sessionId = "";
1809
+ _resumeUrl;
1809
1810
  async prepare() {
1810
1811
  if (this._resumeUrl) {
1811
1812
  return this.bot.http.ws(this._resumeUrl + "/?v=10&encoding=json");
@@ -1870,10 +1871,8 @@ var _WsClient = class _WsClient extends import_satori4.Adapter.WsClient {
1870
1871
  if (parsed.t === "READY") {
1871
1872
  this._sessionId = parsed.d.session_id;
1872
1873
  this._resumeUrl = parsed.d.resume_gateway_url;
1873
- const self = decodeUser(parsed.d.user);
1874
- self.selfId = self.userId;
1875
- delete self.userId;
1876
- Object.assign(this.bot, self);
1874
+ const user = decodeUser(parsed.d.user);
1875
+ Object.assign(this.bot, user);
1877
1876
  logger2.debug("session_id " + this._sessionId);
1878
1877
  return this.bot.online();
1879
1878
  }
@@ -1910,11 +1909,14 @@ var WsClient = _WsClient;
1910
1909
  var import_package = require("../package.json");
1911
1910
  var logger3 = new import_satori5.Logger("discord");
1912
1911
  var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
1912
+ http;
1913
+ internal;
1914
+ webhooks = {};
1915
+ webhookLock = {};
1916
+ commands = [];
1913
1917
  constructor(ctx, config) {
1914
1918
  super(ctx, config);
1915
- this.webhooks = {};
1916
- this.webhookLock = {};
1917
- this.commands = [];
1919
+ this.platform = "discord";
1918
1920
  this.http = ctx.http.extend({
1919
1921
  ...config,
1920
1922
  headers: {
@@ -2084,7 +2086,7 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
2084
2086
  }
2085
2087
  };
2086
2088
  __name(_DiscordBot, "DiscordBot");
2087
- _DiscordBot.MessageEncoder = DiscordMessageEncoder;
2089
+ __publicField(_DiscordBot, "MessageEncoder", DiscordMessageEncoder);
2088
2090
  var DiscordBot = _DiscordBot;
2089
2091
  function shapeEqual(a, b, strict = false) {
2090
2092
  if (a === b)
@@ -2117,7 +2119,6 @@ __name(shapeEqual, "shapeEqual");
2117
2119
  import_satori5.Quester.createConfig("https://discord.com/api/v10")
2118
2120
  ]);
2119
2121
  })(DiscordBot || (DiscordBot = {}));
2120
- DiscordBot.prototype.platform = "discord";
2121
2122
 
2122
2123
  // satori/adapters/discord/src/index.ts
2123
2124
  var src_default = DiscordBot;