Shared library can now search for IDs

This commit is contained in:
2018-10-22 17:51:37 +11:00
parent 3f06204ff5
commit c82bb6d65b
4 changed files with 18 additions and 18 deletions

View File

@@ -78,7 +78,7 @@ exports.FormatMSS = function(s){
exports.IsAdmin = function(client, user) {
//handle user strings
if (typeof(user) === "string") {
user = client.users.find(item => item.username === user);
user = client.users.find(item => item.username === user || item.id === user);
}
let guild = client.guilds.get(process.env.SANCTUM_ID);
@@ -107,14 +107,14 @@ exports.CheckValidDisplay = function(client, member, channel, checkRole) { //See
//handle member strings
if (typeof(member) === "string") {
//get the member
let user = client.users.find(item => item.username === member);
let user = client.users.find(item => item.username === member || item.id === member);
let guild = client.guilds.get(process.env.SANCTUM_ID);
member = guild.members.get(user.id);
}
//handle channel strings
if (typeof(channel) === "string") {
channel = client.channels.find(item => item.name === channel);
channel = client.channels.find(item => item.name === channel || item.id === channel);
}
switch(client.user.username) {