mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-07 21:33:14 +02:00
Correctly skip song if unavailable
Also lets user know in text channel that song is unavailable after skipping. Fixes #324
This commit is contained in:
parent
81bbdb971d
commit
9a2ef876d3
6 changed files with 66 additions and 19 deletions
|
@ -1,22 +1,25 @@
|
|||
import {inject, injectable} from 'inversify';
|
||||
import {TYPES} from '../types';
|
||||
import Player from '../services/player';
|
||||
import {Client} from 'discord.js';
|
||||
|
||||
@injectable()
|
||||
export default class {
|
||||
private readonly guildPlayers: Map<string, Player>;
|
||||
private readonly cacheDir: string;
|
||||
private readonly discordClient: Client;
|
||||
|
||||
constructor(@inject(TYPES.Config.CACHE_DIR) cacheDir: string) {
|
||||
constructor(@inject(TYPES.Config.CACHE_DIR) cacheDir: string, @inject(TYPES.Client) client: Client) {
|
||||
this.guildPlayers = new Map();
|
||||
this.cacheDir = cacheDir;
|
||||
this.discordClient = client;
|
||||
}
|
||||
|
||||
get(guildId: string): Player {
|
||||
let player = this.guildPlayers.get(guildId);
|
||||
|
||||
if (!player) {
|
||||
player = new Player(this.cacheDir);
|
||||
player = new Player(this.cacheDir, this.discordClient);
|
||||
|
||||
this.guildPlayers.set(guildId, player);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue