BUGFIX: Replaced userID with user in messaging.js

This commit is contained in:
2018-10-19 06:25:23 +11:00
parent 9b627d3581
commit 31a13e000d
2 changed files with 6 additions and 6 deletions

View File

@@ -12,16 +12,16 @@ exports.SendPublicMessage = function(client, user, channel, message, typingDelay
if (message === undefined) { if (message === undefined) {
message = channel; message = channel;
channel = user; channel = user;
userID = null; user = null;
} }
//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);
} }
//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);
} }
@@ -48,7 +48,7 @@ exports.SendPublicMessage = function(client, user, channel, message, typingDelay
//message - message to send //message - message to send
exports.SendPrivateMessage = function(client, user, message) { exports.SendPrivateMessage = function(client, user, message) {
//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);
} }

View File

@@ -21,7 +21,7 @@ client.on("disconnect", function() {
client.on("message", function(msg) { client.on("message", function(msg) {
//only react to commands //only react to commands
if (msg.content.slice(0, 1) != "!") { if (msg.content.slice(0, 1) !== process.env.PREFIX) {
return; return;
} }
@@ -39,4 +39,4 @@ client.on("message", function(msg) {
}); });
//actually log in //actually log in
client.login("TOKEN"); client.login(process.env.DEVELOPER_TOKEN);