Skip to content

Commit

Permalink
Made >artemis facts work using the tetris shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
yusu-banana committed Jan 6, 2024
1 parent 6daeb14 commit 8f7a26c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/commands/chatters/artemis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Discord, SimpleCommand, SimpleCommandMessage, SimpleCommandOption, SimpleCommandOptionType } from 'discordx'
import { shuffleArray } from '../../utils/Helpers'

@Discord()
class Artemis {
Expand Down Expand Up @@ -47,13 +48,24 @@ class Artemis {
'There was a copy of all three books on set at all times during filming.',
]

protected shuffledBag: string[] = []

private getFact(): string | undefined {
if (!this.shuffledBag.length) {
this.shuffledBag = [...this.facts]
shuffleArray(this.shuffledBag)
}

return this.shuffledBag.shift()
}

@SimpleCommand({ name: 'artemis', description: 'Artemis' })
async simple(
@SimpleCommandOption({ name: 'text', type: SimpleCommandOptionType.String }) text: string | undefined,
command: SimpleCommandMessage
) {
await command.message.channel.send({
content: this.facts[Math.floor(Math.random() * this.facts.length)],
content: this.getFact(),
})
return
}
Expand Down

0 comments on commit 8f7a26c

Please sign in to comment.