forked from museofficial/muse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README and add "Now playing" Command (museofficial#589)
Co-authored-by: Max Isom <[email protected]> Co-authored-by: Max Isom <[email protected]>
- Loading branch information
1 parent
346a6c6
commit 60376d4
Showing
5 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {CommandInteraction} from 'discord.js'; | ||
import {TYPES} from '../types.js'; | ||
import {inject, injectable} from 'inversify'; | ||
import PlayerManager from '../managers/player.js'; | ||
import Command from '.'; | ||
import {SlashCommandBuilder} from '@discordjs/builders'; | ||
import {buildPlayingMessageEmbed} from '../utils/build-embed.js'; | ||
|
||
@injectable() | ||
export default class implements Command { | ||
public readonly slashCommand = new SlashCommandBuilder() | ||
.setName('now-playing') | ||
.setDescription('shows the currently played song'); | ||
|
||
private readonly playerManager: PlayerManager; | ||
|
||
constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) { | ||
this.playerManager = playerManager; | ||
} | ||
|
||
public async execute(interaction: CommandInteraction): Promise<void> { | ||
const player = this.playerManager.get(interaction.guild!.id); | ||
|
||
if (!player.getCurrent()) { | ||
throw new Error('nothing is currently playing'); | ||
} | ||
|
||
await interaction.reply({ | ||
embeds: [buildPlayingMessageEmbed(player)], | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters