Fix some stuff
This commit is contained in:
parent
12fc7ad8b4
commit
d8df28edbc
1 changed files with 48 additions and 48 deletions
|
@ -48,21 +48,6 @@ module.exports = (client) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client.caseNumber = async (client, modlog) {
|
|
||||||
const messages = await modlog.fetchMessages({limit:5});
|
|
||||||
|
|
||||||
const log = messages.filter(m => m.author.id === client.user.id &&
|
|
||||||
m.embeds[0] &&
|
|
||||||
m.embeds[0].type === 'rich' &&
|
|
||||||
m.embeds[0].footer &&
|
|
||||||
m.embeds[0].footer.text.startsWith('Case')
|
|
||||||
).first();
|
|
||||||
|
|
||||||
if (!log) return 1;
|
|
||||||
const thisCase = /Case\s(\d+)/.exec(log.embeds[0].footer.text);
|
|
||||||
return thisCase ? parseInt(thisCase[1]) + 1 : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
client.clean = async (client, text) => {
|
client.clean = async (client, text) => {
|
||||||
if (text && text.constructor.name == "Promise")
|
if (text && text.constructor.name == "Promise")
|
||||||
text = await text;
|
text = await text;
|
||||||
|
@ -346,9 +331,24 @@ module.exports = (client) => {
|
||||||
client.quoteRegex = input => `${input}`.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&');
|
client.quoteRegex = input => `${input}`.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&');
|
||||||
|
|
||||||
client.fetchURL = (url, options = {}) => {
|
client.fetchURL = (url, options = {}) => {
|
||||||
options.headers = options.headers ? { ...options.headers, "User-Agent": client.user } : { "User-Agent": client.user };
|
options.headers = options.headers ? { ...options.headers, "User-Agent": client.user } : { "User-Agent": client.user };
|
||||||
return fetch(url, options, options.type || "json").catch(error => {
|
return fetch(url, options, options.type || "json").catch(error => {
|
||||||
client.Logger.error(error);
|
client.Logger.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.caseNumber = async (client, modlog) => {
|
||||||
|
const messages = await modlog.fetchMessages({limit:5});
|
||||||
|
|
||||||
|
const log = messages.filter(m => m.author.id === client.user.id &&
|
||||||
|
m.embeds[0] &&
|
||||||
|
m.embeds[0].type === 'rich' &&
|
||||||
|
m.embeds[0].footer &&
|
||||||
|
m.embeds[0].footer.text.startsWith('Case')
|
||||||
|
).first();
|
||||||
|
|
||||||
|
if (!log) return 1;
|
||||||
|
const thisCase = /Case\s(\d+)/.exec(log.embeds[0].footer.text);
|
||||||
|
return thisCase ? parseInt(thisCase[1]) + 1 : 1;
|
||||||
|
};
|
||||||
};
|
};
|
Loading…
Reference in a new issue