mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-23 01:05:30 +01:00
Update README and add "Now playing" Command (#589)
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com> Co-authored-by: Max Isom <hi@maxisom.me>
This commit is contained in:
parent
346a6c6eee
commit
60376d4f57
|
@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Added a `/now-playing` command to show the current track without the full queue embed
|
||||||
|
|
||||||
## [1.6.2] - 2022-03-17
|
## [1.6.2] - 2022-03-17
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -77,7 +77,9 @@ services:
|
||||||
|
|
||||||
### Node.js
|
### Node.js
|
||||||
|
|
||||||
**Prerequisites**: Node.js, ffmpeg
|
**Prerequisites**:
|
||||||
|
* Node.js (16.x is recommended because it's the current LTS version)
|
||||||
|
* ffmpeg
|
||||||
|
|
||||||
1. `git clone https://github.com/codetheweb/muse.git && cd muse`
|
1. `git clone https://github.com/codetheweb/muse.git && cd muse`
|
||||||
2. Copy `.env.example` to `.env` and populate with values
|
2. Copy `.env.example` to `.env` and populate with values
|
||||||
|
|
32
src/commands/now-playing.ts
Normal file
32
src/commands/now-playing.ts
Normal file
|
@ -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)],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import Config from './commands/config.js';
|
||||||
import Disconnect from './commands/disconnect.js';
|
import Disconnect from './commands/disconnect.js';
|
||||||
import Favorites from './commands/favorites.js';
|
import Favorites from './commands/favorites.js';
|
||||||
import ForwardSeek from './commands/fseek.js';
|
import ForwardSeek from './commands/fseek.js';
|
||||||
|
import NowPlaying from './commands/now-playing.js';
|
||||||
import Pause from './commands/pause.js';
|
import Pause from './commands/pause.js';
|
||||||
import Play from './commands/play.js';
|
import Play from './commands/play.js';
|
||||||
import QueueCommand from './commands/queue.js';
|
import QueueCommand from './commands/queue.js';
|
||||||
|
@ -65,6 +66,7 @@ container.bind<SpotifyAPI>(TYPES.Services.SpotifyAPI).to(SpotifyAPI).inSingleton
|
||||||
Disconnect,
|
Disconnect,
|
||||||
Favorites,
|
Favorites,
|
||||||
ForwardSeek,
|
ForwardSeek,
|
||||||
|
NowPlaying,
|
||||||
Pause,
|
Pause,
|
||||||
Play,
|
Play,
|
||||||
QueueCommand,
|
QueueCommand,
|
||||||
|
|
|
@ -61,8 +61,8 @@ export const buildPlayingMessageEmbed = (player: Player): MessageEmbed => {
|
||||||
const message = new MessageEmbed();
|
const message = new MessageEmbed();
|
||||||
|
|
||||||
message
|
message
|
||||||
.setColor('DARK_GREEN')
|
.setColor(player.status === STATUS.PLAYING ? 'DARK_GREEN' : 'DARK_RED')
|
||||||
.setTitle('Now Playing')
|
.setTitle(player.status === STATUS.PLAYING ? 'Now Playing' : 'Paused')
|
||||||
.setDescription(`
|
.setDescription(`
|
||||||
**${getSongTitle(currentlyPlaying)}**
|
**${getSongTitle(currentlyPlaying)}**
|
||||||
Requested by: <@${requestedBy}>\n
|
Requested by: <@${requestedBy}>\n
|
||||||
|
|
Loading…
Reference in a new issue