aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-19 17:39:55 -0500
committerMax Isom <[email protected]>2020-03-19 17:39:55 -0500
commit4659717e5f314d061f9748331c79d507df971f7f (patch)
tree8f4f9b0443be9e49cd31feabe13b8f6c6f123a7f /src/commands
parent362ce8998780db67e5775125c6d6e3fc4d63586f (diff)
downloadmuse-4659717e5f314d061f9748331c79d507df971f7f.tar.xz
muse-4659717e5f314d061f9748331c79d507df971f7f.zip
Require user to be in voice channel
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/clear.ts2
-rw-r--r--src/commands/disconnect.ts2
-rw-r--r--src/commands/fseek.ts2
-rw-r--r--src/commands/index.ts1
-rw-r--r--src/commands/pause.ts2
-rw-r--r--src/commands/play.ts9
-rw-r--r--src/commands/seek.ts2
-rw-r--r--src/commands/shuffle.ts2
-rw-r--r--src/commands/skip.ts2
-rw-r--r--src/commands/unskip.ts2
10 files changed, 20 insertions, 6 deletions
diff --git a/src/commands/clear.ts b/src/commands/clear.ts
index d35cc8c..a585af4 100644
--- a/src/commands/clear.ts
+++ b/src/commands/clear.ts
@@ -12,6 +12,8 @@ export default class implements Command {
['clear', 'clears all songs in queue except currently playing']
];
+ public requiresVC = true;
+
private readonly queueManager: QueueManager;
constructor(@inject(TYPES.Managers.Queue) queueManager: QueueManager) {
diff --git a/src/commands/disconnect.ts b/src/commands/disconnect.ts
index 9b271a3..937fc2e 100644
--- a/src/commands/disconnect.ts
+++ b/src/commands/disconnect.ts
@@ -13,6 +13,8 @@ export default class implements Command {
['disconnect', 'pauses and disconnects player']
];
+ public requiresVC = true;
+
private readonly playerManager: PlayerManager;
constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) {
diff --git a/src/commands/fseek.ts b/src/commands/fseek.ts
index 6eecdf3..584c581 100644
--- a/src/commands/fseek.ts
+++ b/src/commands/fseek.ts
@@ -15,6 +15,8 @@ export default class implements Command {
['fseek 10', 'skips forward in current song by 10 seconds']
];
+ public requiresVC = true;
+
private readonly playerManager: PlayerManager;
private readonly queueManager: QueueManager;
diff --git a/src/commands/index.ts b/src/commands/index.ts
index dd16648..a945072 100644
--- a/src/commands/index.ts
+++ b/src/commands/index.ts
@@ -4,5 +4,6 @@ export default interface Command {
name: string;
aliases: string[];
examples: string[][];
+ requiresVC?: boolean;
execute: (msg: Message, args: string[]) => Promise<void>;
}
diff --git a/src/commands/pause.ts b/src/commands/pause.ts
index 406c084..0771e11 100644
--- a/src/commands/pause.ts
+++ b/src/commands/pause.ts
@@ -14,6 +14,8 @@ export default class implements Command {
['pause', 'pauses currently playing song']
];
+ public requiresVC = true;
+
private readonly playerManager: PlayerManager;
constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) {
diff --git a/src/commands/play.ts b/src/commands/play.ts
index eb972a8..629a720 100644
--- a/src/commands/play.ts
+++ b/src/commands/play.ts
@@ -26,6 +26,8 @@ export default class implements Command {
['play https://open.spotify.com/playlist/37i9dQZF1DX94qaYRnkufr?si=r2fOVL_QQjGxFM5MWb84Xw', 'adds all songs from playlist to the queue']
];
+ public requiresVC = true;
+
private readonly queueManager: QueueManager;
private readonly playerManager: PlayerManager;
private readonly getSongs: GetSongs;
@@ -37,16 +39,11 @@ export default class implements Command {
}
public async execute(msg: Message, args: string []): Promise<void> {
- const [targetVoiceChannel, nInChannel] = getMostPopularVoiceChannel(msg.guild!);
+ const [targetVoiceChannel] = getMostPopularVoiceChannel(msg.guild!);
const res = new LoadingMessage(msg.channel as TextChannel);
await res.start();
- if (nInChannel === 0) {
- await res.stop(errorMsg('all voice channels are empty'));
- return;
- }
-
const queue = this.queueManager.get(msg.guild!.id);
const player = this.playerManager.get(msg.guild!.id);
diff --git a/src/commands/seek.ts b/src/commands/seek.ts
index 4a1c62d..24fde7c 100644
--- a/src/commands/seek.ts
+++ b/src/commands/seek.ts
@@ -17,6 +17,8 @@ export default class implements Command {
['seek 1:00:00', 'seeks to 1 hour from beginning of song']
];
+ public requiresVC = true;
+
private readonly playerManager: PlayerManager;
private readonly queueManager: QueueManager;
diff --git a/src/commands/shuffle.ts b/src/commands/shuffle.ts
index 524081e..a100b9b 100644
--- a/src/commands/shuffle.ts
+++ b/src/commands/shuffle.ts
@@ -13,6 +13,8 @@ export default class implements Command {
['shuffle', 'shuffles the current queue']
];
+ public requiresVC = true;
+
private readonly queueManager: QueueManager;
constructor(@inject(TYPES.Managers.Queue) queueManager: QueueManager) {
diff --git a/src/commands/skip.ts b/src/commands/skip.ts
index bdf67b5..cc5c1c4 100644
--- a/src/commands/skip.ts
+++ b/src/commands/skip.ts
@@ -13,6 +13,8 @@ export default class implements Command {
['skip', 'skips the current song']
];
+ public requiresVC = true;
+
private readonly queueManager: QueueManager;
private readonly playerManager: PlayerManager;
diff --git a/src/commands/unskip.ts b/src/commands/unskip.ts
index f5709c0..ff4718a 100644
--- a/src/commands/unskip.ts
+++ b/src/commands/unskip.ts
@@ -14,6 +14,8 @@ export default class implements Command {
['unskip', 'goes back in the queue by one song']
];
+ public requiresVC = true;
+
private readonly queueManager: QueueManager;
private readonly playerManager: PlayerManager;