Skip to content

Commit

Permalink
Prevent search without argument
Browse files Browse the repository at this point in the history
  • Loading branch information
eritislami committed Jun 13, 2020
1 parent e5810f3 commit b0077d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/search.js
Expand Up @@ -7,6 +7,8 @@ module.exports = {
name: "search",
description: "Search and select videos to play",
async execute(message, args) {
if (!args.length)
return message.reply(`Usage: ${message.client.prefix}${module.exports.name} <Video Name>`).catch(console.error);
if (message.channel.activeCollector)
return message.reply("A message collector is already active in this channel.");
if (!message.member.voice.channel)
Expand All @@ -33,7 +35,7 @@ module.exports = {
message.channel.activeCollector = true;
const response = await message.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ["time"] });
const choice = resultsEmbed.fields[parseInt(response.first()) - 1].name;

message.channel.activeCollector = false;
message.client.commands.get("play").execute(message, [choice]);
resultsMessage.delete().catch(console.error);
Expand Down

0 comments on commit b0077d2

Please sign in to comment.