revbot.js 0.1.1 → 0.1.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.
package/dist/index.d.mts CHANGED
@@ -601,6 +601,10 @@ declare class User extends Base {
601
601
  * @returns {Date} The date when the user was created.
602
602
  */
603
603
  get createdAt(): Date;
604
+ /**
605
+ * checks if the user is the owner of the bot.
606
+ */
607
+ get isOwner(): boolean;
604
608
  /**
605
609
  * Gets the creation timestamp of the user in milliseconds.
606
610
  *
@@ -868,10 +872,11 @@ declare class Attachment extends Base {
868
872
  * Enum representing the possible presence statuses of a user.
869
873
  */
870
874
  declare enum Status {
871
- Online = "ONLINE",
872
- Idle = "IDLE",
873
- Busy = "DND",
874
- Invisible = "OFFLINE"
875
+ Online = "Online",
876
+ Idle = "Idle",
877
+ Focus = "Focus",
878
+ Busy = "Busy",
879
+ Invisible = "Invisible"
875
880
  }
876
881
  /**
877
882
  * Represents the presence of a user, including their status and custom text.
@@ -2048,6 +2053,8 @@ declare class UserManager extends BaseManager<User, User$1> {
2048
2053
  declare class ClientUser extends User {
2049
2054
  /** The notes channel associated with the client user, if any. */
2050
2055
  notes: NotesChannel | null;
2056
+ owner: string | null;
2057
+ constructor(client: client, data: User$1);
2051
2058
  /**
2052
2059
  * Updates the username of the client user.
2053
2060
  *
@@ -2071,10 +2078,12 @@ declare class ClientUser extends User {
2071
2078
  *
2072
2079
  * @example
2073
2080
  * ```typescript
2074
- * await clientUser.setStatus("Available", "online");
2081
+ * await clientUser.setStatus("Available", "Online");
2075
2082
  * ```
2076
2083
  */
2077
- setStatus(text: string | null, presence?: Status): Promise<void>;
2084
+ setStatus(text?: string | null): Promise<void>;
2085
+ setStatus(presence?: Status): Promise<void>;
2086
+ setStatus(text?: string | null, presence?: keyof typeof Status): Promise<void>;
2078
2087
  }
2079
2088
 
2080
2089
  /**
package/dist/index.d.ts CHANGED
@@ -601,6 +601,10 @@ declare class User extends Base {
601
601
  * @returns {Date} The date when the user was created.
602
602
  */
603
603
  get createdAt(): Date;
604
+ /**
605
+ * checks if the user is the owner of the bot.
606
+ */
607
+ get isOwner(): boolean;
604
608
  /**
605
609
  * Gets the creation timestamp of the user in milliseconds.
606
610
  *
@@ -868,10 +872,11 @@ declare class Attachment extends Base {
868
872
  * Enum representing the possible presence statuses of a user.
869
873
  */
870
874
  declare enum Status {
871
- Online = "ONLINE",
872
- Idle = "IDLE",
873
- Busy = "DND",
874
- Invisible = "OFFLINE"
875
+ Online = "Online",
876
+ Idle = "Idle",
877
+ Focus = "Focus",
878
+ Busy = "Busy",
879
+ Invisible = "Invisible"
875
880
  }
876
881
  /**
877
882
  * Represents the presence of a user, including their status and custom text.
@@ -2048,6 +2053,8 @@ declare class UserManager extends BaseManager<User, User$1> {
2048
2053
  declare class ClientUser extends User {
2049
2054
  /** The notes channel associated with the client user, if any. */
2050
2055
  notes: NotesChannel | null;
2056
+ owner: string | null;
2057
+ constructor(client: client, data: User$1);
2051
2058
  /**
2052
2059
  * Updates the username of the client user.
2053
2060
  *
@@ -2071,10 +2078,12 @@ declare class ClientUser extends User {
2071
2078
  *
2072
2079
  * @example
2073
2080
  * ```typescript
2074
- * await clientUser.setStatus("Available", "online");
2081
+ * await clientUser.setStatus("Available", "Online");
2075
2082
  * ```
2076
2083
  */
2077
- setStatus(text: string | null, presence?: Status): Promise<void>;
2084
+ setStatus(text?: string | null): Promise<void>;
2085
+ setStatus(presence?: Status): Promise<void>;
2086
+ setStatus(text?: string | null, presence?: keyof typeof Status): Promise<void>;
2078
2087
  }
2079
2088
 
2080
2089
  /**
package/dist/index.js CHANGED
@@ -697,13 +697,13 @@ var User = class extends Base {
697
697
  this.avatar = new Attachment(this.client, data.avatar);
698
698
  }
699
699
  if (data.status) {
700
- this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "OFFLINE" /* Invisible */ : "OFFLINE" /* Invisible */;
700
+ this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "Invisible" /* Invisible */ : "Invisible" /* Invisible */;
701
701
  this.presence.text = (_b = data.status.text) != null ? _b : null;
702
702
  }
703
703
  for (const field of clear) {
704
704
  if (field === "Avatar") this.avatar = null;
705
705
  if (field === "StatusText") this.presence.text = null;
706
- if (field === "StatusPresence") this.presence.status = "OFFLINE" /* Invisible */;
706
+ if (field === "StatusPresence") this.presence.status = "Invisible" /* Invisible */;
707
707
  }
708
708
  return this;
709
709
  }
@@ -715,6 +715,13 @@ var User = class extends Base {
715
715
  get createdAt() {
716
716
  return UUID.timestampOf(this.id);
717
717
  }
718
+ /**
719
+ * checks if the user is the owner of the bot.
720
+ */
721
+ get isOwner() {
722
+ var _a;
723
+ return this.id === ((_a = this.client.user) == null ? void 0 : _a.owner);
724
+ }
718
725
  /**
719
726
  * Gets the creation timestamp of the user in milliseconds.
720
727
  *
@@ -1077,12 +1084,13 @@ var Attachment = class extends Base {
1077
1084
  };
1078
1085
 
1079
1086
  // src/struct/presence.ts
1080
- var Status = /* @__PURE__ */ ((Status3) => {
1081
- Status3["Online"] = "ONLINE";
1082
- Status3["Idle"] = "IDLE";
1083
- Status3["Busy"] = "DND";
1084
- Status3["Invisible"] = "OFFLINE";
1085
- return Status3;
1087
+ var Status = /* @__PURE__ */ ((Status2) => {
1088
+ Status2["Online"] = "Online";
1089
+ Status2["Idle"] = "Idle";
1090
+ Status2["Focus"] = "Focus";
1091
+ Status2["Busy"] = "Busy";
1092
+ Status2["Invisible"] = "Invisible";
1093
+ return Status2;
1086
1094
  })(Status || {});
1087
1095
  var Presence = class extends Base {
1088
1096
  constructor() {
@@ -1090,7 +1098,7 @@ var Presence = class extends Base {
1090
1098
  /** The custom status text of the user, or `null` if none is set. */
1091
1099
  this.text = null;
1092
1100
  /** The current status of the user (e.g., Online, Idle, Busy, Invisible). */
1093
- this.status = "OFFLINE" /* Invisible */;
1101
+ this.status = "Invisible" /* Invisible */;
1094
1102
  }
1095
1103
  };
1096
1104
 
@@ -3235,7 +3243,7 @@ var import_node_events = require("events");
3235
3243
  var import_axios4 = require("axios");
3236
3244
 
3237
3245
  // package.json
3238
- var version = "0.1.1";
3246
+ var version = "0.1.3";
3239
3247
 
3240
3248
  // src/rest/restUtils/rateLimitQueue.ts
3241
3249
  var import_axios3 = __toESM(require("axios"));
@@ -4132,10 +4140,14 @@ _events = new WeakMap();
4132
4140
 
4133
4141
  // src/struct/clientUser.ts
4134
4142
  var ClientUser = class extends User {
4135
- constructor() {
4136
- super(...arguments);
4143
+ constructor(client3, data) {
4144
+ var _a;
4145
+ super(client3, data);
4137
4146
  /** The notes channel associated with the client user, if any. */
4138
4147
  this.notes = null;
4148
+ this.owner = null;
4149
+ this._patch(data);
4150
+ this.owner = ((_a = data.bot) == null ? void 0 : _a.owner) || null;
4139
4151
  }
4140
4152
  /**
4141
4153
  * Updates the username of the client user.
@@ -4160,22 +4172,19 @@ var ClientUser = class extends User {
4160
4172
  });
4161
4173
  });
4162
4174
  }
4163
- /**
4164
- * Updates the status of the client user.
4165
- *
4166
- * @param {string | null} text - The status text to set, or `null` to clear the status.
4167
- * @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
4168
- * @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
4169
- *
4170
- * @example
4171
- * ```typescript
4172
- * await clientUser.setStatus("Available", "online");
4173
- * ```
4174
- */
4175
4175
  setStatus(text, presence) {
4176
4176
  return __async(this, null, function* () {
4177
- yield this.client.api.patch("/users/@me", {
4178
- body: { status: { text, presence } }
4177
+ var _a, _b, _c;
4178
+ if (typeof text === "string" && text in Status) {
4179
+ presence = text;
4180
+ text = void 0;
4181
+ }
4182
+ const status = {
4183
+ text: text != null ? text : (_a = this.client.user) == null ? void 0 : _a.presence.text,
4184
+ presence: presence != null ? presence : (_b = this.client.user) == null ? void 0 : _b.presence.status
4185
+ };
4186
+ yield this.client.api.patch(`/users/${(_c = this.client.user) == null ? void 0 : _c.id}`, {
4187
+ body: { status }
4179
4188
  });
4180
4189
  });
4181
4190
  }