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 +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.js +35 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -26
- 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,13 @@ 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
|
+
*/
|
|
643
|
+
get isOwner() {
|
|
644
|
+
var _a;
|
|
645
|
+
return this.id === ((_a = this.client.user) == null ? void 0 : _a.owner);
|
|
646
|
+
}
|
|
640
647
|
/**
|
|
641
648
|
* Gets the creation timestamp of the user in milliseconds.
|
|
642
649
|
*
|
|
@@ -999,12 +1006,13 @@ var Attachment = class extends Base {
|
|
|
999
1006
|
};
|
|
1000
1007
|
|
|
1001
1008
|
// src/struct/presence.ts
|
|
1002
|
-
var Status = /* @__PURE__ */ ((
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
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;
|
|
1008
1016
|
})(Status || {});
|
|
1009
1017
|
var Presence = class extends Base {
|
|
1010
1018
|
constructor() {
|
|
@@ -1012,7 +1020,7 @@ var Presence = class extends Base {
|
|
|
1012
1020
|
/** The custom status text of the user, or `null` if none is set. */
|
|
1013
1021
|
this.text = null;
|
|
1014
1022
|
/** The current status of the user (e.g., Online, Idle, Busy, Invisible). */
|
|
1015
|
-
this.status = "
|
|
1023
|
+
this.status = "Invisible" /* Invisible */;
|
|
1016
1024
|
}
|
|
1017
1025
|
};
|
|
1018
1026
|
|
|
@@ -3157,7 +3165,7 @@ import { EventEmitter } from "node:events";
|
|
|
3157
3165
|
import { AxiosError } from "axios";
|
|
3158
3166
|
|
|
3159
3167
|
// package.json
|
|
3160
|
-
var version = "0.1.
|
|
3168
|
+
var version = "0.1.3";
|
|
3161
3169
|
|
|
3162
3170
|
// src/rest/restUtils/rateLimitQueue.ts
|
|
3163
3171
|
import axios3 from "axios";
|
|
@@ -4054,10 +4062,14 @@ _events = new WeakMap();
|
|
|
4054
4062
|
|
|
4055
4063
|
// src/struct/clientUser.ts
|
|
4056
4064
|
var ClientUser = class extends User {
|
|
4057
|
-
constructor() {
|
|
4058
|
-
|
|
4065
|
+
constructor(client3, data) {
|
|
4066
|
+
var _a;
|
|
4067
|
+
super(client3, data);
|
|
4059
4068
|
/** The notes channel associated with the client user, if any. */
|
|
4060
4069
|
this.notes = null;
|
|
4070
|
+
this.owner = null;
|
|
4071
|
+
this._patch(data);
|
|
4072
|
+
this.owner = ((_a = data.bot) == null ? void 0 : _a.owner) || null;
|
|
4061
4073
|
}
|
|
4062
4074
|
/**
|
|
4063
4075
|
* Updates the username of the client user.
|
|
@@ -4082,22 +4094,19 @@ var ClientUser = class extends User {
|
|
|
4082
4094
|
});
|
|
4083
4095
|
});
|
|
4084
4096
|
}
|
|
4085
|
-
/**
|
|
4086
|
-
* Updates the status of the client user.
|
|
4087
|
-
*
|
|
4088
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
4089
|
-
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
4090
|
-
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
4091
|
-
*
|
|
4092
|
-
* @example
|
|
4093
|
-
* ```typescript
|
|
4094
|
-
* await clientUser.setStatus("Available", "online");
|
|
4095
|
-
* ```
|
|
4096
|
-
*/
|
|
4097
4097
|
setStatus(text, presence) {
|
|
4098
4098
|
return __async(this, null, function* () {
|
|
4099
|
-
|
|
4100
|
-
|
|
4099
|
+
var _a, _b, _c;
|
|
4100
|
+
if (typeof text === "string" && text in Status) {
|
|
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 }
|
|
4101
4110
|
});
|
|
4102
4111
|
});
|
|
4103
4112
|
}
|