Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda

This commit is contained in:
TheEssem 2020-12-26 12:17:10 -06:00
parent 7a254a5139
commit 8a2d4e6669
16 changed files with 57 additions and 52 deletions

View file

@ -45,12 +45,14 @@ const getIdeal = () => {
});
if (!serversLeft) {
clearTimeout(timeout);
try {
const server = await chooseServer(idealServers);
resolve(server);
} catch (e) {
reject(e);
}
socket.close(async () => {
try {
const server = await chooseServer(idealServers);
resolve(server);
} catch (e) {
reject(e);
}
});
}
}
});

View file

@ -85,16 +85,10 @@ module.exports = async (cmdMessage) => {
if (result !== false) return result;
// if there aren't any in the current message then check if there's a reply
if (cmdMessage.messageReference) {
const replyGuild = client.guilds.get(cmdMessage.messageReference.guildID);
if (replyGuild) {
const replyChannel = replyGuild.channels.get(cmdMessage.messageReference.channelID);
if (replyChannel) {
const replyMessage = replyChannel.messages.get(cmdMessage.messageReference.messageID);
if (replyMessage) {
const replyResult = await checkImages(replyMessage);
if (replyResult !== false) return replyResult;
}
}
const replyMessage = await client.getMessage(cmdMessage.messageReference.channelID, cmdMessage.messageReference.messageID);
if (replyMessage) {
const replyResult = await checkImages(replyMessage);
if (replyResult !== false) return replyResult;
}
}
// if there aren't any replies then iterate over the last few messages in the channel

View file

@ -47,6 +47,7 @@ exports.connect = async () => {
};
exports.play = async (sound, message, music = false) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).permission.has("voiceConnect") || !message.channel.permissionsOf(client.user.id).has("voiceConnect")) return `${message.author.mention}, I can't join this voice channel!`;
const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID);
@ -148,6 +149,7 @@ exports.nextSong = async (message, connection, track, info, music, voiceChannel,
};
exports.stop = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
if (this.players.get(message.channel.guild.id).host !== message.author.id) return `${message.author.mention}, only the current voice session host can stop the music!`;
@ -160,6 +162,7 @@ exports.stop = async (message) => {
};
exports.skip = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
const player = this.players.get(message.channel.guild.id);
@ -184,6 +187,7 @@ exports.skip = async (message) => {
};
exports.pause = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
if (this.players.get(message.channel.guild.id).host !== message.author.id) return `${message.author.mention}, only the current voice session host can pause/resume the music!`;
@ -193,6 +197,7 @@ exports.pause = async (message) => {
};
exports.playing = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
const player = this.players.get(message.channel.guild.id).player;
@ -227,6 +232,7 @@ exports.playing = async (message) => {
};
exports.queue = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
if (!message.channel.guild.members.get(client.user.id).permission.has("addReactions") && !message.channel.permissionsOf(client.user.id).has("addReactions")) return `${message.author.mention}, I don't have the \`Add Reactions\` permission!`;
@ -274,6 +280,7 @@ exports.queue = async (message) => {
};
exports.loop = async (message) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
if (!message.member.voiceState.channelID) return `${message.author.mention}, you need to be in a voice channel first!`;
if (!message.channel.guild.members.get(client.user.id).voiceState.channelID) return `${message.author.mention}, I'm not in a voice channel!`;
if (this.players.get(message.channel.guild.id).host !== message.author.id) return `${message.author.mention}, only the current voice session host can loop the music!`;