Removed getUser, no double error message logged

This commit is contained in:
Neko Life 2021-05-24 13:41:47 +00:00
parent 94808a55d7
commit 0b0fcf916b

View file

@ -45,7 +45,7 @@ async function errLog(theError, msg, client, sendTheError, errorMessage, notify)
if (msg && msg.guild && msg.guild.id === "823815890285756447") { if (msg && msg.guild && msg.guild.id === "823815890285756447") {
logThis = ""; logThis = "";
} }
const sendAt = await client.channels.cache.get(defaultErrorLogChannel); const sendAt = client.channels.cache.get(defaultErrorLogChannel);
sendAt.send(logThis + inLogChannel.trim(),{split:true}); sendAt.send(logThis + inLogChannel.trim(),{split:true});
} catch (errmes) { } catch (errmes) {
errLog(errmes, msg); errLog(errmes, msg);
@ -81,31 +81,10 @@ async function getChannelMessage(client, msg, MainID, SecondID) {
const meschannel = client.channels.cache.get(MainID); const meschannel = client.channels.cache.get(MainID);
return await meschannel.messages.fetch(SecondID); return await meschannel.messages.fetch(SecondID);
} catch (theError) { } catch (theError) {
return errLog(theError, msg, client); return
} }
} }
return await msg.channel.messages.fetch(MainID).catch(e => {return errLog(e, msg, client)}); return await msg.channel.messages.fetch(MainID).catch(e => {return});
}
/**
* Get user object
* @param {Client} client - This client (this.client)
* @param {String} MainID - User ID | User Mention
* @returns {Promise<User>} User object
* @example const user = getUser(this.client, args[0]);
*/
async function getUser(client, msg, MainID) {
if (MainID.startsWith('<') && MainID.endsWith('>')) {
MainID = MainID.slice(2, -1);
}
if (MainID.startsWith('!')) {
MainID = (MainID.slice(1));
}
try {
return await client.users.fetch(MainID);
} catch (theError) {
return errLog(theError, msg, client);
}
} }
function execCB(error, stdout, stderr) { function execCB(error, stdout, stderr) {
@ -117,7 +96,7 @@ function execCB(error, stdout, stderr) {
console.log('stderr:\n'+stderr); console.log('stderr:\n'+stderr);
} }
async function ranLog(msg, cmd, addition) { async function ranLog(msg, cmd, addition) { return /*
let errLogPath; let errLogPath;
if (msg.guild) { if (msg.guild) {
errLogPath = `../Guilds/${msg.guild.id}/Log/`; errLogPath = `../Guilds/${msg.guild.id}/Log/`;
@ -126,7 +105,7 @@ async function ranLog(msg, cmd, addition) {
} }
let add = '\n'+addition; let add = '\n'+addition;
const b = new Date().toUTCString(); const b = new Date().toUTCString();
return //console.log(inLog); return //console.log(inLog); */
} }
/** /**
@ -441,7 +420,6 @@ module.exports = {
cleanMentionID, cleanMentionID,
multipleMembersFound, multipleRolesFound, multipleChannelsFound, multipleMembersFound, multipleRolesFound, multipleChannelsFound,
findMemberRegEx, findChannelRegEx, findRoleRegEx, findMemberRegEx, findChannelRegEx, findRoleRegEx,
getUser,
getChannelMessage, errLog, getChannelMessage, errLog,
execCB, ranLog, noPerm, execCB, ranLog, noPerm,
trySend, tryDelete, tryReact, trySend, tryDelete, tryReact,