📈 add total users to default status
This commit is contained in:
parent
825ff53878
commit
5bcfafd0ed
3 changed files with 15 additions and 12 deletions
|
@ -13,15 +13,9 @@ export const options: IEventOptions = {
|
|||
};
|
||||
|
||||
export const execute = async (client: Client) => {
|
||||
logger.info("Ready!");
|
||||
logger.info("Discord's API client is ready!");
|
||||
|
||||
await updatePresence(client);
|
||||
await devMode(client);
|
||||
await deployCommands(client);
|
||||
|
||||
client.guilds?.cache.forEach((guild) => {
|
||||
logger.silly(
|
||||
`${client.user?.tag} (${client.user?.id}) is in guild: ${guild.name} (${guild.id}) with member count of ${guild.memberCount}`
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import { token, clientId } from "../config/discord";
|
|||
import { devMode, guildId } from "../config/other";
|
||||
|
||||
import logger from "../logger";
|
||||
import { ApplicationCommandDataResolvable, Client } from "discord.js";
|
||||
import { Client } from "discord.js";
|
||||
import { REST } from "@discordjs/rest";
|
||||
import { Routes } from "discord-api-types/v9";
|
||||
import { RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
|
||||
|
|
|
@ -4,11 +4,20 @@ import logger from "../../logger";
|
|||
|
||||
// Function
|
||||
export default async (client: Client) => {
|
||||
const status = `${client?.guilds?.cache?.size} guilds.`;
|
||||
if (!client?.user) throw new Error("Client's user is undefined.");
|
||||
|
||||
client?.user?.setPresence({
|
||||
activities: [{ type: "WATCHING", name: status }],
|
||||
const { guilds } = client;
|
||||
|
||||
const memberCount = guilds.cache.reduce((a, g) => a + g.memberCount, 0);
|
||||
|
||||
const guildCount = guilds.cache.size;
|
||||
|
||||
const status = `${memberCount} users in ${guildCount} guilds.`;
|
||||
|
||||
client.user.setPresence({
|
||||
activities: [{ type: "LISTENING", name: status }],
|
||||
status: "online",
|
||||
});
|
||||
logger?.debug(`Updated client presence to: ${status}`);
|
||||
|
||||
logger.info(`Client's presence is set to "${status}"`);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue