Skip to content

Instantly share code, notes, and snippets.

@trezy
Created March 6, 2022 05:29
Show Gist options
  • Save trezy/a3697cc674fa2bcb22e1f662b60caae5 to your computer and use it in GitHub Desktop.
Save trezy/a3697cc674fa2bcb22e1f662b60caae5 to your computer and use it in GitHub Desktop.
// Module imports
import { MessageEmbed } from 'discord.js'
// Local imports
import { Command } from '../structures/Command.js'
const fortunes = [
{
body: 'There is no glory unless you put yourself on the line.',
luckyNumbers: [50, 47, 10, 7, 33, 15],
},
{
body: 'There is no reference for beauty.',
luckyNumbers: [37, 50, 30, 33, 53, 52],
},
{
body: 'Truth is an unpopular subject, because it is unquestionably correct.',
luckyNumbers: [22, 44, 41, 53, 1, 16],
},
]
export default new Command({
// Meta
name: 'fortune',
description: 'Get a fortune from Trezy\'s jar!',
// Functionality
execute: async interaction => {
const fortuneIndex = Math.floor(Math.random() * fortunes.length)
const fortune = fortunes[fortuneIndex] || {}
const response = new MessageEmbed
response.setTitle(`🥠 ${fortune.body}`)
response.addFields({
name: 'Lucky Numbers',
value: fortune.luckyNumbers.join(', '),
inline: true,
})
response.addFields({
name: 'Opened',
value: fortune.originallyOpened || 'Before 04 March, 2022',
inline: true,
})
await interaction.reply({
embeds: [response],
})
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment