aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-15 15:04:46 -0500
committerMax Isom <[email protected]>2020-03-15 15:04:46 -0500
commit260d5d2d73edb91e0ace0efd2e9f21b628f34b58 (patch)
treeb7e594b9aaf40018303c18faeba3836588d39724 /src
parent3408c7a0c2ee35fc9a47c37b94b9ed789314f4cc (diff)
downloadmuse-260d5d2d73edb91e0ace0efd2e9f21b628f34b58.tar.xz
muse-260d5d2d73edb91e0ace0efd2e9f21b628f34b58.zip
Don't try to connect to channel if already connected
Diffstat (limited to 'src')
-rw-r--r--src/commands/play.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/commands/play.ts b/src/commands/play.ts
index 84703da..03992d7 100644
--- a/src/commands/play.ts
+++ b/src/commands/play.ts
@@ -10,6 +10,7 @@ import {parse, toSeconds} from 'iso8601-duration';
import {TYPES} from '../types';
import {inject, injectable} from 'inversify';
import {QueuedSong, QueuedPlaylist} from '../services/queue';
+import {STATUS} from '../services/player';
import QueueManager from '../managers/queue';
import PlayerManager from '../managers/player';
import {getMostPopularVoiceChannel} from '../utils/channels';
@@ -214,11 +215,12 @@ export default class implements Command {
// TODO: better response
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();
+ }
}
}