mirror of
https://github.com/MinazukiAmane/Tinasha-Bot.git
synced 2025-03-15 12:55:59 +08:00
handle custom presence status
still not tested yet
This commit is contained in:
parent
520395167f
commit
0590081849
@ -128,8 +128,8 @@ module.exports = {
|
||||
PRESENCE: {
|
||||
ENABLED: true, // Whether or not the bot should update its status
|
||||
STATUS: "online", // The bot's status [online, idle, dnd, invisible]
|
||||
TYPE: "LISTENING", // Status type for the bot [PLAYING | LISTENING | WATCHING | COMPETING]
|
||||
MESSAGE: "/play with {members} members in {servers} servers", // Your bot status message
|
||||
TYPE: "LISTENING", // Status type for the bot [ CUSTOM | PLAYING | LISTENING | WATCHING | COMPETING ]
|
||||
MESSAGE: "/play with {members} members in {servers} servers", // Your bot status message (note: in custom status type you won't have "Playing", "Listening", "Competing" prefix)
|
||||
},
|
||||
|
||||
STATS: {
|
||||
|
@ -11,7 +11,9 @@ function updatePresence(client) {
|
||||
}
|
||||
|
||||
if (message.includes("{members}")) {
|
||||
const members = client.guilds.cache.map((g) => g.memberCount).reduce((partial_sum, a) => partial_sum + a, 0);
|
||||
const members = client.guilds.cache
|
||||
.map((g) => g.memberCount)
|
||||
.reduce((partial_sum, a) => partial_sum + a, 0);
|
||||
message = message.replaceAll("{members}", members);
|
||||
}
|
||||
|
||||
@ -28,18 +30,34 @@ function updatePresence(client) {
|
||||
|
||||
case "WATCHING":
|
||||
return ActivityType.Watching;
|
||||
|
||||
case "CUSTOM":
|
||||
return ActivityType.Custom;
|
||||
}
|
||||
};
|
||||
|
||||
client.user.setPresence({
|
||||
status: client.config.PRESENCE.STATUS,
|
||||
activities: [
|
||||
{
|
||||
name: message,
|
||||
type: getType(client.config.PRESENCE.TYPE),
|
||||
},
|
||||
],
|
||||
});
|
||||
if(client.config.PRESENCE.TYPE === "CUSTOM") {
|
||||
client.user.setPresence({
|
||||
status: client.config.PRESENCE.STATUS,
|
||||
activities: [
|
||||
{
|
||||
name: message,
|
||||
state: message,
|
||||
type: getType(client.config.PRESENCE.TYPE),
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
client.user.setPresence({
|
||||
status: client.config.PRESENCE.STATUS,
|
||||
activities: [
|
||||
{
|
||||
name: message,
|
||||
type: getType(client.config.PRESENCE.TYPE),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function handlePresence(client) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user