diff --git a/commands/vote.mjs b/commands/vote.mjs index 87a95bb..37a2f41 100644 --- a/commands/vote.mjs +++ b/commands/vote.mjs @@ -2,7 +2,7 @@ import { CommandBuilder } from "../src/CommandHandler.mjs"; import { EmbedBuilder } from "@fluxerjs/core"; import { getGlobalColor } from "../src/MessageHandler.mjs"; import { Utils } from "../src/Utils.mjs"; -import { FLUXERLIST, buildVoteLink, buildProfileLink } from "../src/constants/API.mjs"; +import { FLUXERLIST, buildVoteLink } from "../src/constants/API.mjs"; // Auto-remove timer for reaction navigation: 60 seconds const EMOJI_REMOVE_TIMEOUT = 60_000; @@ -132,20 +132,28 @@ export async function run(msg, data) { }); } - const voteUrl = buildVoteLink(resolvedType, id); - const profileUrl = buildProfileLink(resolvedType, id); + // Use slug for website links (slugs work on the website; numeric IDs don't) + const slug = resourceId || (resolvedType === "server" ? fluxerlist?.serverSlug : fluxerlist?.botSlug); + const voteUrl = slug ? buildVoteLink(resolvedType, slug) : null; const label = resolvedType === "server" ? "Server" : "Bot"; + const descLines = [ + `Support this ${label.toLowerCase()} by voting on FluxerList!`, + ``, + ]; + + if (voteUrl) { + descLines.push(`**[Vote & View Profile](${voteUrl})**`, ``); + } else { + descLines.push(`Visit [FluxerList](${FLUXERLIST.SITE_URL}) to find and vote for this ${label.toLowerCase()}.`, ``); + } + + descLines.push(`Your votes help this ${label.toLowerCase()} grow and reach more users.`); + const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setTitle(`Vote on FluxerList`) - .setDescription([ - `Support this ${label.toLowerCase()} by voting on FluxerList!`, - ``, - `**[Vote & View Profile](${voteUrl})**`, - ``, - `Your votes help this ${label.toLowerCase()} grow and reach more users.`, - ].join("\n")); + .setDescription(descLines.join("\n")); return msg.reply({ embeds: [embed] }); } diff --git a/config_example.json b/config_example.json index 9e73138..e372b07 100644 --- a/config_example.json +++ b/config_example.json @@ -106,7 +106,9 @@ "Comment": "FluxerList integration: check voters for your server/bot. API keys are allocated by site admins, prefixed with fl_, and visible in your Dashboard. To request access, open a ticket in the Fluxer server.", "apiKey": "fl_your_api_key_here", "serverId": "remix-hq", - "botId": "remix" + "botId": "remix", + "serverSlug": "remix-hq", + "botSlug": "remix" }, "owners": ["user id for owner-only commands", "another user id"], "playerAFKTimeout": 60000, diff --git a/src/FluxerListManager.mjs b/src/FluxerListManager.mjs index 5a09122..4af0162 100644 --- a/src/FluxerListManager.mjs +++ b/src/FluxerListManager.mjs @@ -26,12 +26,16 @@ export class FluxerListManager { * @param {string} [config.apiKey] - FluxerList API key (prefixed with fl_) * @param {string} [config.serverId] - Default server ID or slug for voter queries * @param {string} [config.botId] - Default bot ID or slug for voter queries + * @param {string} [config.serverSlug] - Server URL slug for website links (e.g. "remix-hq") + * @param {string} [config.botSlug] - Bot URL slug for website links (e.g. "remix") */ constructor(config = {}) { - this.apiKey = config?.apiKey ?? ""; - this.serverId = config?.serverId ?? ""; - this.botId = config?.botId ?? ""; - this.enabled = !!this.apiKey; + this.apiKey = config?.apiKey ?? ""; + this.serverId = config?.serverId ?? ""; + this.botId = config?.botId ?? ""; + this.serverSlug = config?.serverSlug ?? config?.serverId ?? ""; + this.botSlug = config?.botSlug ?? config?.botId ?? ""; + this.enabled = !!this.apiKey; // In-memory cache: Map this._cache = new Map(); diff --git a/src/dashboard/Dashboard.mjs b/src/dashboard/Dashboard.mjs index 41c6ceb..67af196 100644 --- a/src/dashboard/Dashboard.mjs +++ b/src/dashboard/Dashboard.mjs @@ -103,7 +103,7 @@ export class Dashboard { if (!this.enabled || !this.redis) return; // Use "fluxer_" as the platform so each bot's Redis messages // are isolated. The dashboard backend must also be configured to match. - this.redis.platform = `fluxer_${botId}`; + this.redis.platform = `fluxer`; } // Dashboard Function Dispatch