seyfert 2.1.1-dev-12469676992.0 → 2.1.1-dev-12485652015.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.
@@ -16,8 +16,8 @@ export declare class MemoryAdapter<T> implements Adapter {
16
16
  get(keys: string): unknown;
17
17
  bulkSet(keys: [string, any][]): void;
18
18
  set(key: string, data: any): void;
19
- bulkPatch(updateOnly: boolean, keys: [string, any][]): void;
20
- patch(updateOnly: boolean, keys: string, data: any): void;
19
+ bulkPatch(keys: [string, any][]): void;
20
+ patch(keys: string, data: any): void;
21
21
  values(to: string): any[];
22
22
  keys(to: string): string[];
23
23
  count(to: string): number;
@@ -49,20 +49,14 @@ class MemoryAdapter {
49
49
  set(key, data) {
50
50
  this.storage.set(key, this.options.encode(data));
51
51
  }
52
- bulkPatch(updateOnly, keys) {
52
+ bulkPatch(keys) {
53
53
  for (const [key, value] of keys) {
54
54
  const oldData = this.get(key);
55
- if (updateOnly && !oldData) {
56
- continue;
57
- }
58
55
  this.storage.set(key, Array.isArray(value) ? this.options.encode(value) : this.options.encode({ ...(oldData ?? {}), ...value }));
59
56
  }
60
57
  }
61
- patch(updateOnly, keys, data) {
58
+ patch(keys, data) {
62
59
  const oldData = this.get(keys);
63
- if (updateOnly && !oldData) {
64
- return;
65
- }
66
60
  this.storage.set(keys, Array.isArray(data) ? this.options.encode(data) : this.options.encode({ ...(oldData ?? {}), ...data }));
67
61
  }
68
62
  values(to) {
@@ -37,8 +37,8 @@ export declare class LimitedMemoryAdapter<T> implements Adapter {
37
37
  private __set;
38
38
  bulkSet(keys: [string, any][]): void;
39
39
  set(keys: string, data: any): void;
40
- bulkPatch(updateOnly: boolean, keys: [string, any][]): void;
41
- patch(updateOnly: boolean, keys: string, data: any): void;
40
+ bulkPatch(keys: [string, any][]): void;
41
+ patch(keys: string, data: any): void;
42
42
  values(to: string): any[];
43
43
  keys(to: string): string[];
44
44
  count(to: string): number;
@@ -103,20 +103,14 @@ class LimitedMemoryAdapter {
103
103
  set(keys, data) {
104
104
  this.__set(keys, data);
105
105
  }
106
- bulkPatch(updateOnly, keys) {
106
+ bulkPatch(keys) {
107
107
  for (const [key, value] of keys) {
108
108
  const oldData = this.get(key);
109
- if (updateOnly && !oldData) {
110
- continue;
111
- }
112
109
  this.__set(key, Array.isArray(value) ? value : { ...(oldData ?? {}), ...value });
113
110
  }
114
111
  }
115
- patch(updateOnly, keys, data) {
112
+ patch(keys, data) {
116
113
  const oldData = this.get(keys);
117
- if (updateOnly && !oldData) {
118
- return;
119
- }
120
114
  this.__set(keys, Array.isArray(data) ? data : { ...(oldData ?? {}), ...data });
121
115
  }
122
116
  values(to) {
@@ -9,8 +9,8 @@ export interface Adapter {
9
9
  get(keys: string): Awaitable<any | null>;
10
10
  bulkSet(keyValue: [string, any][]): Awaitable<void>;
11
11
  set(id: string, data: any): Awaitable<void>;
12
- bulkPatch(updateOnly: boolean, keyValue: [string, any][]): Awaitable<void>;
13
- patch(updateOnly: boolean, id: string, data: any): Awaitable<void>;
12
+ bulkPatch(keyValue: [string, any][]): Awaitable<void>;
13
+ patch(id: string, data: any): Awaitable<void>;
14
14
  values(to: string): Awaitable<any[]>;
15
15
  keys(to: string): Awaitable<string[]>;
16
16
  count(to: string): Awaitable<number>;
@@ -238,7 +238,7 @@ class Cache {
238
238
  }
239
239
  }
240
240
  await this.adapter.bulkAddToRelationShip(relationshipsData);
241
- await this.adapter.bulkPatch(false, allData);
241
+ await this.adapter.bulkPatch(allData);
242
242
  }
243
243
  async bulkSet(keys) {
244
244
  const allData = [];
@@ -42,7 +42,7 @@ class BaseResource {
42
42
  patch(id, data) {
43
43
  if (!this.filter(data, id))
44
44
  return;
45
- return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(false, this.hashId(id), data));
45
+ return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(this.hashId(id), data));
46
46
  }
47
47
  remove(id) {
48
48
  return (0, common_1.fakePromise)(this.removeToRelationship(id)).then(() => this.adapter.remove(this.hashId(id)));
@@ -19,8 +19,8 @@ export declare class GuildRelatedResource<T = any, S = any> {
19
19
  })[]>;
20
20
  set(__keys: string, guild: string, data: S): ReturnCache<void>;
21
21
  set(__keys: [string, S][], guild: string): ReturnCache<void>;
22
- patch(__keys: string, guild?: string, data?: any): ReturnCache<void>;
23
- patch(__keys: [string, any][], guild?: string): ReturnCache<void>;
22
+ patch(__keys: string, guild: string, data?: any): ReturnCache<void>;
23
+ patch(__keys: [string, any][], guild: string): ReturnCache<void>;
24
24
  remove(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
25
25
  keys(guild: string): ReturnCache<string[]>;
26
26
  values(guild: string): ReturnCache<(T & {
@@ -47,14 +47,9 @@ class GuildRelatedResource {
47
47
  }
48
48
  patch(__keys, guild, data) {
49
49
  const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild));
50
- if (guild) {
51
- return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(false, keys.map(([key, value]) => {
52
- return [this.hashId(key), this.parse(value, key, guild)];
53
- })));
54
- }
55
- return (0, common_1.fakePromise)(this.adapter.bulkPatch(true, keys.map(([key, value]) => {
56
- return [this.hashId(key), value];
57
- }))).then(x => x);
50
+ return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkPatch(keys.map(([key, value]) => {
51
+ return [this.hashId(key), this.parse(value, key, guild)];
52
+ })));
58
53
  }
59
54
  remove(id, guild) {
60
55
  const ids = Array.isArray(id) ? id : [id];
@@ -80,7 +80,7 @@ class CommandContext extends basecontext_1.BaseContext {
80
80
  return this.interaction.fetchResponse();
81
81
  return (this.messageResponse = (await this.messageResponse.fetch()));
82
82
  }
83
- channel(mode = 'cache') {
83
+ channel(mode = 'flow') {
84
84
  if (this.interaction?.channel && mode === 'cache')
85
85
  return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
86
86
  switch (mode) {
@@ -91,7 +91,7 @@ class CommandContext extends basecontext_1.BaseContext {
91
91
  return this.client.channels.fetch(this.channelId, mode === 'rest');
92
92
  }
93
93
  }
94
- me(mode = 'cache') {
94
+ me(mode = 'flow') {
95
95
  if (!this.guildId)
96
96
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
97
97
  switch (mode) {
@@ -102,7 +102,7 @@ class CommandContext extends basecontext_1.BaseContext {
102
102
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
103
103
  }
104
104
  }
105
- guild(mode = 'cache') {
105
+ guild(mode = 'flow') {
106
106
  if (!this.guildId)
107
107
  return (mode === 'cache'
108
108
  ? this.client.cache.adapter.isAsync
@@ -44,12 +44,12 @@ class EntryPointContext extends basecontext_1.BaseContext {
44
44
  fetchResponse() {
45
45
  return this.interaction.fetchResponse();
46
46
  }
47
- channel(mode = 'cache') {
47
+ channel(mode = 'flow') {
48
48
  if (this.interaction.channel && mode === 'cache')
49
49
  return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
50
50
  return this.client.channels.fetch(this.channelId, mode === 'rest');
51
51
  }
52
- me(mode = 'cache') {
52
+ me(mode = 'flow') {
53
53
  if (!this.guildId)
54
54
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
55
55
  switch (mode) {
@@ -59,7 +59,7 @@ class EntryPointContext extends basecontext_1.BaseContext {
59
59
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
60
60
  }
61
61
  }
62
- guild(mode = 'cache') {
62
+ guild(mode = 'flow') {
63
63
  if (!this.guildId)
64
64
  return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
65
65
  switch (mode) {
@@ -59,12 +59,12 @@ class MenuCommandContext extends basecontext_1.BaseContext {
59
59
  fetchResponse() {
60
60
  return this.interaction.fetchResponse();
61
61
  }
62
- channel(mode = 'cache') {
62
+ channel(mode = 'flow') {
63
63
  if (this.interaction?.channel && mode === 'cache')
64
64
  return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
65
65
  return this.client.channels.fetch(this.channelId, mode === 'rest');
66
66
  }
67
- me(mode = 'cache') {
67
+ me(mode = 'flow') {
68
68
  if (!this.guildId)
69
69
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
70
70
  switch (mode) {
@@ -74,7 +74,7 @@ class MenuCommandContext extends basecontext_1.BaseContext {
74
74
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
75
75
  }
76
76
  }
77
- guild(mode = 'cache') {
77
+ guild(mode = 'flow') {
78
78
  if (!this.guildId)
79
79
  return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
80
80
  switch (mode) {
@@ -29,7 +29,7 @@ class ChannelShorter extends base_1.BaseShorter {
29
29
  }
30
30
  }
31
31
  channel = await this.client.proxy.channels(id).get();
32
- await this.client.cache.channels?.patch(id, undefined, channel);
32
+ await this.client.cache.channels?.patch(id, 'guild_id' in channel && channel.guild_id ? channel.guild_id : '@me', channel);
33
33
  return channel;
34
34
  }
35
35
  /**
@@ -94,12 +94,12 @@ class ComponentContext extends basecontext_1.BaseContext {
94
94
  modal(body) {
95
95
  return this.interaction.modal(body);
96
96
  }
97
- channel(mode = 'cache') {
97
+ channel(mode = 'flow') {
98
98
  if (this.interaction?.channel && mode === 'cache')
99
99
  return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
100
100
  return this.client.channels.fetch(this.channelId, mode === 'rest');
101
101
  }
102
- me(mode = 'cache') {
102
+ me(mode = 'flow') {
103
103
  if (!this.guildId)
104
104
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
105
105
  switch (mode) {
@@ -109,7 +109,7 @@ class ComponentContext extends basecontext_1.BaseContext {
109
109
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
110
110
  }
111
111
  }
112
- guild(mode = 'cache') {
112
+ guild(mode = 'flow') {
113
113
  if (!this.guildId)
114
114
  return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
115
115
  switch (mode) {
@@ -82,12 +82,12 @@ class ModalContext extends basecontext_1.BaseContext {
82
82
  //@ts-expect-error
83
83
  return this.interaction.modal(body);
84
84
  }
85
- channel(mode = 'cache') {
85
+ channel(mode = 'flow') {
86
86
  if (this.interaction?.channel && mode === 'cache')
87
87
  return this.client.cache.adapter.isAsync ? Promise.resolve(this.interaction.channel) : this.interaction.channel;
88
88
  return this.client.channels.fetch(this.channelId, mode === 'rest');
89
89
  }
90
- me(mode = 'cache') {
90
+ me(mode = 'flow') {
91
91
  if (!this.guildId)
92
92
  return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve();
93
93
  switch (mode) {
@@ -97,7 +97,7 @@ class ModalContext extends basecontext_1.BaseContext {
97
97
  return this.client.members.fetch(this.guildId, this.client.botId, mode === 'rest');
98
98
  }
99
99
  }
100
- guild(mode = 'cache') {
100
+ guild(mode = 'flow') {
101
101
  if (!this.guildId)
102
102
  return (mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve());
103
103
  switch (mode) {
@@ -1,4 +1,4 @@
1
- import type { ClientUserStructure } from '../client';
1
+ import { type ClientUserStructure } from '../client';
2
2
  import type { UsingClient } from '../commands';
3
3
  import type { GatewayReadyDispatchData, RESTPatchAPICurrentUserJSONBody } from '../types';
4
4
  import { User } from './User';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientUser = void 0;
4
+ const client_1 = require("../client");
4
5
  const User_1 = require("./User");
5
6
  class ClientUser extends User_1.User {
6
7
  application;
@@ -11,11 +12,11 @@ class ClientUser extends User_1.User {
11
12
  }
12
13
  async fetch() {
13
14
  const data = await this.api.users('@me').get();
14
- return new ClientUser(this.client, data, this.application);
15
+ return client_1.Transformers.ClientUser(this.client, data, this.application);
15
16
  }
16
17
  async edit(body) {
17
18
  const data = await this.api.users('@me').patch({ body });
18
- return new ClientUser(this.client, data, this.application);
19
+ return client_1.Transformers.ClientUser(this.client, data, this.application);
19
20
  }
20
21
  }
21
22
  exports.ClientUser = ClientUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.1.1-dev-12469676992.0",
3
+ "version": "2.1.1-dev-12485652015.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",