Quick bugfix

This commit is contained in:
2018-10-21 19:19:25 +11:00
parent c18f189ab7
commit a3278df6b2

View File

@@ -18,11 +18,17 @@ exports.SendPublicMessage = function(client, user, channel, message, typingDelay
//handle user strings //handle user strings
if (typeof(user) === "string") { if (typeof(user) === "string") {
user = client.users.find(item => item.username === user); user = client.users.find(item => item.username === user);
if (!user) {
throw "Can't find that user";
}
} }
//handle channel strings //handle channel strings
if (typeof(channel) === "string") { if (typeof(channel) === "string") {
channel = client.channels.find(item => item.name === channel); channel = client.channels.find(item => item.name === channel);
if (!channel) {
throw "Can't find that channel";
}
} }
//Utility trick: @user //Utility trick: @user