mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-10 03:55:29 +01:00
Don't try to connect to channel if already connected
This commit is contained in:
parent
3408c7a0c2
commit
260d5d2d73
|
@ -10,6 +10,7 @@ import {parse, toSeconds} from 'iso8601-duration';
|
||||||
import {TYPES} from '../types';
|
import {TYPES} from '../types';
|
||||||
import {inject, injectable} from 'inversify';
|
import {inject, injectable} from 'inversify';
|
||||||
import {QueuedSong, QueuedPlaylist} from '../services/queue';
|
import {QueuedSong, QueuedPlaylist} from '../services/queue';
|
||||||
|
import {STATUS} from '../services/player';
|
||||||
import QueueManager from '../managers/queue';
|
import QueueManager from '../managers/queue';
|
||||||
import PlayerManager from '../managers/player';
|
import PlayerManager from '../managers/player';
|
||||||
import {getMostPopularVoiceChannel} from '../utils/channels';
|
import {getMostPopularVoiceChannel} from '../utils/channels';
|
||||||
|
@ -214,11 +215,12 @@ export default class implements Command {
|
||||||
// TODO: better response
|
// TODO: better response
|
||||||
await res.stop('song(s) queued');
|
await res.stop('song(s) queued');
|
||||||
|
|
||||||
const channel = getMostPopularVoiceChannel(msg.guild!);
|
if (this.playerManager.get(msg.guild!.id).status === STATUS.DISCONNECTED) {
|
||||||
|
const channel = getMostPopularVoiceChannel(msg.guild!);
|
||||||
|
|
||||||
// TODO: don't connect if already connected.
|
await this.playerManager.get(msg.guild!.id).connect(channel);
|
||||||
await this.playerManager.get(msg.guild!.id).connect(channel);
|
|
||||||
|
|
||||||
await this.playerManager.get(msg.guild!.id).play();
|
await this.playerManager.get(msg.guild!.id).play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue