Temprarily disable reply on pagination, made a small optimization to prefix handler
This commit is contained in:
parent
e44f5ba59d
commit
b6f28ece76
2 changed files with 10 additions and 8 deletions
|
@ -16,8 +16,9 @@ module.exports = async (client, cluster, worker, ipc, message) => {
|
|||
|
||||
let prefixCandidate;
|
||||
if (message.channel.guild) {
|
||||
if (collections.prefixCache.has(message.channel.guild.id)) {
|
||||
prefixCandidate = collections.prefixCache.get(message.channel.guild.id);
|
||||
const cachedPrefix = collections.prefixCache.get(message.channel.guild.id);
|
||||
if (cachedPrefix) {
|
||||
prefixCandidate = cachedPrefix;
|
||||
} else {
|
||||
let guildDB = message.channel.guild ? await database.getGuild(message.channel.guild.id) : null;
|
||||
if (message.channel.guild && !(guildDB && guildDB.disabled)) {
|
||||
|
|
|
@ -3,7 +3,7 @@ const MessageCollector = require("./awaitmessages.js");
|
|||
|
||||
module.exports = async (client, message, pages, timeout = 120000) => {
|
||||
const manageMessages = message.channel.guild && message.channel.permissionsOf(client.user.id).has("manageMessages") ? true : false;
|
||||
const options = {
|
||||
/*const options = {
|
||||
messageReference: {
|
||||
channelID: message.channel.id,
|
||||
messageID: message.id,
|
||||
|
@ -13,9 +13,10 @@ module.exports = async (client, message, pages, timeout = 120000) => {
|
|||
allowedMentions: {
|
||||
repliedUser: false
|
||||
}
|
||||
};
|
||||
};*/
|
||||
let page = 0;
|
||||
let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options));
|
||||
//let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options));
|
||||
let currentPage = await client.createMessage(message.channel.id, pages[page]);
|
||||
if (pages.length > 1) {
|
||||
const emojiList = ["◀", "🔢", "▶", "🗑"];
|
||||
for (const emoji of emojiList) {
|
||||
|
@ -27,7 +28,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
|
|||
switch (reaction.name) {
|
||||
case "◀":
|
||||
page = page > 0 ? --page : pages.length - 1;
|
||||
currentPage = await currentPage.edit(Object.assign(pages[page], options));
|
||||
currentPage = await currentPage.edit(pages[page]);
|
||||
if (manageMessages) msg.removeReaction("◀", member.id);
|
||||
break;
|
||||
case "🔢":
|
||||
|
@ -50,7 +51,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
|
|||
if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) askMessage.delete();
|
||||
if (manageMessages) await response.delete();
|
||||
page = Number(response.content) - 1;
|
||||
currentPage = await currentPage.edit(Object.assign(pages[page], options));
|
||||
currentPage = await currentPage.edit(pages[page]);
|
||||
if (manageMessages) msg.removeReaction("🔢", member.id);
|
||||
});
|
||||
}).catch(error => {
|
||||
|
@ -59,7 +60,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
|
|||
break;
|
||||
case "▶":
|
||||
page = page + 1 < pages.length ? ++page : 0;
|
||||
currentPage = await currentPage.edit(Object.assign(pages[page], options));
|
||||
currentPage = await currentPage.edit(pages[page]);
|
||||
if (manageMessages) msg.removeReaction("▶", member.id);
|
||||
break;
|
||||
case "🗑":
|
||||
|
|
Loading…
Reference in a new issue