mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-28 01:32:42 +02:00
Require user to be in voice channel
This commit is contained in:
parent
362ce89987
commit
4659717e5f
12 changed files with 42 additions and 9 deletions
11
src/bot.ts
11
src/bot.ts
|
@ -8,6 +8,8 @@ import debug from './utils/debug';
|
|||
import NaturalLanguage from './services/natural-language-commands';
|
||||
import handleGuildCreate from './events/guild-create';
|
||||
import handleVoiceStateUpdate from './events/voice-state-update';
|
||||
import errorMsg from './utils/error-msg';
|
||||
import {isUserInVoice} from './utils/channels';
|
||||
|
||||
@injectable()
|
||||
export default class {
|
||||
|
@ -81,10 +83,15 @@ export default class {
|
|||
}
|
||||
|
||||
try {
|
||||
handler.execute(msg, args);
|
||||
if (handler.requiresVC && !isUserInVoice(msg.guild, msg.author)) {
|
||||
await msg.channel.send(errorMsg('gotta be in a voice channel'));
|
||||
return;
|
||||
}
|
||||
|
||||
await handler.execute(msg, args);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
msg.reply('there was an error trying to execute that command!');
|
||||
await msg.channel.send(errorMsg('¯\\_(ツ)_/¯'));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue