lunibee 0.3.2 → 0.3.3

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.
@@ -227,7 +227,7 @@ class Channel extends BaseStructure {
227
227
  permissionOverwrites;
228
228
  partial;
229
229
  #context;
230
- constructor(data, context, options = {}) {
230
+ constructor(data, context, options) {
231
231
  super(data.id);
232
232
  if (!Number.isInteger(data.type) || data.type < 0)
233
233
  throw new RangeError("A Discord channel requires a valid channel type.");
@@ -240,7 +240,7 @@ class Channel extends BaseStructure {
240
240
  this.rateLimitPerUser = data.rate_limit_per_user;
241
241
  this.position = data.position;
242
242
  this.permissionOverwrites = (data.permission_overwrites ?? []).map((overwrite) => ({ ...overwrite }));
243
- this.partial = options.partial ?? false;
243
+ this.partial = options?.partial ?? false;
244
244
  this.#context = context;
245
245
  }
246
246
  send(options) {
@@ -4983,6 +4983,13 @@ class Collection extends Map {
4983
4983
  }
4984
4984
 
4985
4985
  // packages/managers/src/base.ts
4986
+ function assignFields(into, from) {
4987
+ const target = into;
4988
+ const source = from;
4989
+ for (const key of Object.keys(source))
4990
+ target[key] = source[key];
4991
+ return into;
4992
+ }
4986
4993
  function splitReason(options) {
4987
4994
  const { reason, ...payload } = options;
4988
4995
  return [payload, reason];
@@ -5083,7 +5090,7 @@ class ResourceManager extends Manager {
5083
5090
  const key = this.#key(resource);
5084
5091
  const existing = this.get(key);
5085
5092
  if (existing !== undefined && existing !== resource && typeof existing === "object" && existing !== null) {
5086
- Object.assign(existing, resource);
5093
+ assignFields(existing, resource);
5087
5094
  this.set(key, existing);
5088
5095
  return existing;
5089
5096
  }
@@ -5097,7 +5104,7 @@ class ResourceManager extends Manager {
5097
5104
  // packages/rest/package.json
5098
5105
  var package_default = {
5099
5106
  name: "@lunibee/rest",
5100
- version: "0.3.2",
5107
+ version: "0.3.3",
5101
5108
  type: "module",
5102
5109
  module: "./src/index.ts",
5103
5110
  types: "./src/index.ts",
@@ -6769,7 +6776,7 @@ class MessageManager {
6769
6776
  const existing = this.cache.peek(data.id);
6770
6777
  const message = new Message(data, this.#context);
6771
6778
  if (existing) {
6772
- Object.assign(existing, message);
6779
+ assignFields(existing, message);
6773
6780
  return existing;
6774
6781
  }
6775
6782
  if (this.#caching)
@@ -6946,7 +6953,7 @@ class EmojiManager extends Manager {
6946
6953
  #merge(key, emoji) {
6947
6954
  const existing = this.get(key);
6948
6955
  if (existing) {
6949
- Object.assign(existing, emoji);
6956
+ assignFields(existing, emoji);
6950
6957
  return existing;
6951
6958
  }
6952
6959
  this.set(key, emoji);
@@ -7780,7 +7787,7 @@ class ChannelManager extends Manager {
7780
7787
  #merge(channel) {
7781
7788
  const existing = this.get(channel.id);
7782
7789
  if (existing && existing.type === channel.type) {
7783
- Object.assign(existing, channel);
7790
+ assignFields(existing, channel);
7784
7791
  return existing;
7785
7792
  }
7786
7793
  this.set(channel.id, channel);
@@ -7790,9 +7797,14 @@ class ChannelManager extends Manager {
7790
7797
  return this.set(channel.id, channel);
7791
7798
  }
7792
7799
  deleteGuildChannels(guildId) {
7800
+ const ids = [];
7801
+ this.cache.forEach((channel, id) => {
7802
+ if (channel.guildId === guildId)
7803
+ ids.push(id);
7804
+ });
7793
7805
  let removed = 0;
7794
- for (const channel of this.values())
7795
- if (channel.guildId === guildId && this.delete(channel.id))
7806
+ for (const id of ids)
7807
+ if (this.delete(id))
7796
7808
  removed++;
7797
7809
  return removed;
7798
7810
  }
@@ -10118,4 +10130,4 @@ export {
10118
10130
  resolveGatewayIntents
10119
10131
  };
10120
10132
 
10121
- //# debugId=832C8551262CC4D164756E2164756E21
10133
+ //# debugId=36AD9AABCFEDEB0464756E2164756E21