import { getConfig } from "./configHandler.mjs"; class PresenceManager { /** * Creates an instance of PresenceManager. * @param {import('discord.js').Client} client - The Discord client instance. */ constructor(client) { this.client = client; this.defaultStatus = "online"; this.defaultActivityType = "LISTENING"; this.defaultActivityName = "for your commands"; this.defaultUrl = null; } /** * Set the bot's presence. * @param {"online"|"idle"|"dnd"} status - The status of the bot (online, idle, dnd). * @param {"PLAYING"|"STREAMING"|"LISTENING"|"WATCHING"|"COMPETING"} activityType - The type of activity. * @param {string} activityName - The name of the activity. * @param {string} [url=null] - The URL for STREAMING activity type (optional). */ setPresence(status, activityType, activityName, url = null) { const activityOptions = { type: activityType.toUpperCase(), name: activityName, }; if (activityType.toUpperCase() === "STREAMING" && url) { activityOptions.url = url; } this.client.user.setPresence({ status: status, activities: [activityOptions], }); } /** * Reset the bot's presence to the default state. */ resetToDefault() { const defaultPresence = getConfig("presence"); console.log("Default Presence:", defaultPresence); // Update your bot's presence using this configuration this.client.user.setPresence(defaultPresence); } } export default PresenceManager;