Better Presence Settings

This commit is contained in:
hirzidevs
2024-08-25 21:34:33 +07:00
parent 86fde40e07
commit 66709c43e2
2 changed files with 27 additions and 24 deletions

View File

@@ -4,6 +4,7 @@
# Bot Configuration
token: "Put Bot Token Here"
presence:
enable: true
text: "Hosting Panel"
type: "watching" # can be 'watching', 'playing', 'listening', or 'competing'. 'streaming' is not working for now
status: "online" # can be 'online', 'idle', 'dnd', or 'invisible'

View File

@@ -51,33 +51,35 @@ async function startGetStatus() {
client.once("ready", () => {
console.log(cliColor.cyanBright("[PteroStats] ") + cliColor.greenBright(`${client.user.tag} is online!`));
if (config.presence.text && config.presence.type) {
switch (config.presence.type.toLowerCase()) {
case "playing":
config.presence.type = ActivityType.Playing;
break;
case "listening":
config.presence.type = ActivityType.Listening;
break;
case "competing":
config.presence.type = ActivityType.Competing;
break;
default:
config.presence.type = ActivityType.Watching;
if (config.presence.enable) {
if (config.presence.text && config.presence.type) {
switch (config.presence.type.toLowerCase()) {
case "playing":
config.presence.type = ActivityType.Playing;
break;
case "listening":
config.presence.type = ActivityType.Listening;
break;
case "competing":
config.presence.type = ActivityType.Competing;
break;
default:
config.presence.type = ActivityType.Watching;
}
client.user.setActivity(config.presence.text, {
type: config.presence.type,
});
}
client.user.setActivity(config.presence.text, {
type: config.presence.type,
});
}
if (config.presence.status) {
if (!["idle", "online", "dnd", "invisible"].includes(
config.presence.status.toLowerCase()
))
config.presence.status = "online";
if (config.presence.status) {
if (!["idle", "online", "dnd", "invisible"].includes(
config.presence.status.toLowerCase()
))
config.presence.status = "online";
client.user.setStatus(config.presence.status);
client.user.setStatus(config.presence.status);
}
}
startGetStatus();