diff --git a/Shared/messaging.js b/Shared/messaging.js index df12d92..5631efb 100644 --- a/Shared/messaging.js +++ b/Shared/messaging.js @@ -18,11 +18,17 @@ exports.SendPublicMessage = function(client, user, channel, message, typingDelay //handle user strings if (typeof(user) === "string") { user = client.users.find(item => item.username === user); + if (!user) { + throw "Can't find that user"; + } } //handle channel strings if (typeof(channel) === "string") { channel = client.channels.find(item => item.name === channel); + if (!channel) { + throw "Can't find that channel"; + } } //Utility trick: @user