Introduces a new server mode configuration system (Federation/Standalone) with associated command changes, dynamic status rotation for the bot, and adds new commands and features. Replit-Commit-Author: Agent Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: b08e6ba5-7498-4b9f-b1c9-7dc11b362ddd Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/R9PkDi8 Replit-Helium-Checkpoint-Created: true
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
|
const { getServerMode, getEmbedColor } = require('../utils/modeHelper');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('coinflip')
|
|
.setDescription('Flip a coin')
|
|
.addStringOption(option =>
|
|
option.setName('call')
|
|
.setDescription('Call heads or tails before the flip')
|
|
.setRequired(false)
|
|
.addChoices(
|
|
{ name: 'Heads', value: 'heads' },
|
|
{ name: 'Tails', value: 'tails' }
|
|
)
|
|
),
|
|
|
|
async execute(interaction, supabase, client) {
|
|
const call = interaction.options.getString('call');
|
|
const result = Math.random() < 0.5 ? 'heads' : 'tails';
|
|
const emoji = result === 'heads' ? '🪙' : '💿';
|
|
|
|
const mode = await getServerMode(supabase, interaction.guildId);
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor(getEmbedColor(mode))
|
|
.setTitle(`${emoji} Coin Flip`)
|
|
.setDescription(`The coin landed on **${result.toUpperCase()}**!`)
|
|
.setTimestamp();
|
|
|
|
if (call) {
|
|
const won = call === result;
|
|
embed.addFields({
|
|
name: won ? '🎉 Result' : '😔 Result',
|
|
value: won ? `You called it! You win!` : `You called ${call}, better luck next time!`
|
|
});
|
|
embed.setColor(won ? 0x22C55E : 0xEF4444);
|
|
}
|
|
|
|
embed.setFooter({ text: `Flipped by ${interaction.user.username}` });
|
|
|
|
await interaction.reply({ embeds: [embed] });
|
|
},
|
|
};
|