revbot.js 0.1.2 → 0.1.4
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 +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -619,13 +619,13 @@ var User = class extends Base {
|
|
|
619
619
|
this.avatar = new Attachment(this.client, data.avatar);
|
|
620
620
|
}
|
|
621
621
|
if (data.status) {
|
|
622
|
-
this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "
|
|
622
|
+
this.presence.status = data.status.presence ? (_a = Status[data.status.presence]) != null ? _a : "Invisible" /* Invisible */ : "Invisible" /* Invisible */;
|
|
623
623
|
this.presence.text = (_b = data.status.text) != null ? _b : null;
|
|
624
624
|
}
|
|
625
625
|
for (const field of clear) {
|
|
626
626
|
if (field === "Avatar") this.avatar = null;
|
|
627
627
|
if (field === "StatusText") this.presence.text = null;
|
|
628
|
-
if (field === "StatusPresence") this.presence.status = "
|
|
628
|
+
if (field === "StatusPresence") this.presence.status = "Invisible" /* Invisible */;
|
|
629
629
|
}
|
|
630
630
|
return this;
|
|
631
631
|
}
|
|
@@ -637,6 +637,9 @@ var User = class extends Base {
|
|
|
637
637
|
get createdAt() {
|
|
638
638
|
return UUID.timestampOf(this.id);
|
|
639
639
|
}
|
|
640
|
+
/**
|
|
641
|
+
* checks if the user is the owner of the bot.
|
|
642
|
+
*/
|
|
640
643
|
get isOwner() {
|
|
641
644
|
var _a;
|
|
642
645
|
return this.id === ((_a = this.client.user) == null ? void 0 : _a.owner);
|
|
@@ -1003,12 +1006,13 @@ var Attachment = class extends Base {
|
|
|
1003
1006
|
};
|
|
1004
1007
|
|
|
1005
1008
|
// src/struct/presence.ts
|
|
1006
|
-
var Status = /* @__PURE__ */ ((
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1009
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
|
1010
|
+
Status2["Online"] = "Online";
|
|
1011
|
+
Status2["Idle"] = "Idle";
|
|
1012
|
+
Status2["Focus"] = "Focus";
|
|
1013
|
+
Status2["Busy"] = "Busy";
|
|
1014
|
+
Status2["Invisible"] = "Invisible";
|
|
1015
|
+
return Status2;
|
|
1012
1016
|
})(Status || {});
|
|
1013
1017
|
var Presence = class extends Base {
|
|
1014
1018
|
constructor() {
|
|
@@ -1016,7 +1020,7 @@ var Presence = class extends Base {
|
|
|
1016
1020
|
/** The custom status text of the user, or `null` if none is set. */
|
|
1017
1021
|
this.text = null;
|
|
1018
1022
|
/** The current status of the user (e.g., Online, Idle, Busy, Invisible). */
|
|
1019
|
-
this.status = "
|
|
1023
|
+
this.status = "Invisible" /* Invisible */;
|
|
1020
1024
|
}
|
|
1021
1025
|
};
|
|
1022
1026
|
|
|
@@ -3161,7 +3165,7 @@ import { EventEmitter } from "node:events";
|
|
|
3161
3165
|
import { AxiosError } from "axios";
|
|
3162
3166
|
|
|
3163
3167
|
// package.json
|
|
3164
|
-
var version = "0.1.
|
|
3168
|
+
var version = "0.1.4";
|
|
3165
3169
|
|
|
3166
3170
|
// src/rest/restUtils/rateLimitQueue.ts
|
|
3167
3171
|
import axios3 from "axios";
|
|
@@ -4090,22 +4094,19 @@ var ClientUser = class extends User {
|
|
|
4090
4094
|
});
|
|
4091
4095
|
});
|
|
4092
4096
|
}
|
|
4093
|
-
/**
|
|
4094
|
-
* Updates the status of the client user.
|
|
4095
|
-
*
|
|
4096
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
4097
|
-
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
4098
|
-
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
4099
|
-
*
|
|
4100
|
-
* @example
|
|
4101
|
-
* ```typescript
|
|
4102
|
-
* await clientUser.setStatus("Available", "online");
|
|
4103
|
-
* ```
|
|
4104
|
-
*/
|
|
4105
4097
|
setStatus(text, presence) {
|
|
4106
4098
|
return __async(this, null, function* () {
|
|
4107
|
-
|
|
4108
|
-
|
|
4099
|
+
var _a, _b, _c;
|
|
4100
|
+
if (typeof text === "string" && text in Status && !presence) {
|
|
4101
|
+
presence = text;
|
|
4102
|
+
text = void 0;
|
|
4103
|
+
}
|
|
4104
|
+
const status = {
|
|
4105
|
+
text: text != null ? text : (_a = this.client.user) == null ? void 0 : _a.presence.text,
|
|
4106
|
+
presence: presence != null ? presence : (_b = this.client.user) == null ? void 0 : _b.presence.status
|
|
4107
|
+
};
|
|
4108
|
+
yield this.client.api.patch(`/users/${(_c = this.client.user) == null ? void 0 : _c.id}`, {
|
|
4109
|
+
body: { status }
|
|
4109
4110
|
});
|
|
4110
4111
|
});
|
|
4111
4112
|
}
|