@rehpic/vcli 0.1.0-beta.92.1 → 0.1.0-beta.94.1
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.js +65 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4980,6 +4980,71 @@ statusCommand.command("reset [slug]").action(async (slug, _options, command) =>
|
|
|
4980
4980
|
);
|
|
4981
4981
|
printOutput(result ?? { success: true }, runtime.json);
|
|
4982
4982
|
});
|
|
4983
|
+
var presenceCommand = program.command("presence").description("User presence and custom status (Discord-like)");
|
|
4984
|
+
presenceCommand.command("get").action(async (_options, command) => {
|
|
4985
|
+
const { client, runtime } = await getClient(command);
|
|
4986
|
+
const result = await runQuery(client, api.status.getCurrentUserStatus, {});
|
|
4987
|
+
printOutput(result ?? { presence: "online" }, runtime.json);
|
|
4988
|
+
});
|
|
4989
|
+
presenceCommand.command("set <presence>").description("Set presence: online, idle, dnd, invisible").action(async (presence, _options, command) => {
|
|
4990
|
+
const valid = ["online", "idle", "dnd", "invisible"];
|
|
4991
|
+
if (!valid.includes(presence)) {
|
|
4992
|
+
throw new Error(
|
|
4993
|
+
`Invalid presence "${presence}". Must be one of: ${valid.join(", ")}`
|
|
4994
|
+
);
|
|
4995
|
+
}
|
|
4996
|
+
const { client, runtime } = await getClient(command);
|
|
4997
|
+
await runMutation(client, api.status.setPresence, {
|
|
4998
|
+
presence
|
|
4999
|
+
});
|
|
5000
|
+
printOutput({ ok: true, presence }, runtime.json);
|
|
5001
|
+
});
|
|
5002
|
+
presenceCommand.command("custom").description("Set a custom status with emoji and text").option("--emoji <emoji>", "Status emoji").option("--text <text>", "Status text").option(
|
|
5003
|
+
"--clear-after <duration>",
|
|
5004
|
+
"Auto-clear: 30m, 1h, 4h, today, or never (default)"
|
|
5005
|
+
).action(async (options, command) => {
|
|
5006
|
+
const emoji = options.emoji?.trim();
|
|
5007
|
+
const text2 = options.text?.trim();
|
|
5008
|
+
const clearAfterRaw = options.clearAfter;
|
|
5009
|
+
if (!emoji && !text2) {
|
|
5010
|
+
throw new Error("At least --emoji or --text is required.");
|
|
5011
|
+
}
|
|
5012
|
+
let clearsAt;
|
|
5013
|
+
if (clearAfterRaw) {
|
|
5014
|
+
const durations = {
|
|
5015
|
+
"30m": 30 * 60 * 1e3,
|
|
5016
|
+
"1h": 60 * 60 * 1e3,
|
|
5017
|
+
"4h": 4 * 60 * 60 * 1e3,
|
|
5018
|
+
today: "today",
|
|
5019
|
+
never: 0
|
|
5020
|
+
};
|
|
5021
|
+
const dur = durations[clearAfterRaw];
|
|
5022
|
+
if (dur === void 0) {
|
|
5023
|
+
throw new Error(
|
|
5024
|
+
`Invalid --clear-after "${clearAfterRaw}". Must be one of: 30m, 1h, 4h, today, never`
|
|
5025
|
+
);
|
|
5026
|
+
}
|
|
5027
|
+
if (dur === "today") {
|
|
5028
|
+
const end = /* @__PURE__ */ new Date();
|
|
5029
|
+
end.setHours(23, 59, 59, 999);
|
|
5030
|
+
clearsAt = end.getTime();
|
|
5031
|
+
} else if (dur > 0) {
|
|
5032
|
+
clearsAt = Date.now() + dur;
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
const { client, runtime } = await getClient(command);
|
|
5036
|
+
await runMutation(client, api.status.setCustomStatus, {
|
|
5037
|
+
customEmoji: emoji,
|
|
5038
|
+
customText: text2,
|
|
5039
|
+
clearsAt
|
|
5040
|
+
});
|
|
5041
|
+
printOutput({ ok: true, emoji, text: text2, clearsAt }, runtime.json);
|
|
5042
|
+
});
|
|
5043
|
+
presenceCommand.command("clear").description("Clear custom status").action(async (_options, command) => {
|
|
5044
|
+
const { client, runtime } = await getClient(command);
|
|
5045
|
+
await runMutation(client, api.status.clearCustomStatus, {});
|
|
5046
|
+
printOutput({ ok: true }, runtime.json);
|
|
5047
|
+
});
|
|
4983
5048
|
var adminCommand = program.command("admin").description("Platform admin");
|
|
4984
5049
|
adminCommand.command("branding").action(async (_options, command) => {
|
|
4985
5050
|
const { client, runtime } = await getClient(command);
|