debug selection messages
This commit is contained in:
parent
22b884044f
commit
94f86eeb7b
1 changed files with 13 additions and 2 deletions
|
@ -2,6 +2,8 @@ const {Collection} = require("@projectdysnomia/dysnomia");
|
||||||
const murmurhash = require("murmurhash").v3;
|
const murmurhash = require("murmurhash").v3;
|
||||||
const {tinycolor} = require("@ctrl/tinycolor");
|
const {tinycolor} = require("@ctrl/tinycolor");
|
||||||
|
|
||||||
|
const logger = require("../lib/logger.js");
|
||||||
|
|
||||||
function pastelize(id) {
|
function pastelize(id) {
|
||||||
const hue = murmurhash(id) % 360;
|
const hue = murmurhash(id) % 360;
|
||||||
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
|
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
|
||||||
|
@ -207,7 +209,14 @@ async function selectionMessage(
|
||||||
data.content += `\n\nDisplaying 25/${options.length} results`;
|
data.content += `\n\nDisplaying 25/${options.length} results`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayMessage = await msg.channel.createMessage(data);
|
const displayMessage = await msg.channel
|
||||||
|
.createMessage(data)
|
||||||
|
.catch((err) =>
|
||||||
|
logger.error(
|
||||||
|
"selectionMessage",
|
||||||
|
"Failed to create selection message: " + err
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
function listener(interaction) {
|
function listener(interaction) {
|
||||||
|
@ -310,7 +319,9 @@ async function lookupUser(msg, str, filter) {
|
||||||
selection.push({
|
selection.push({
|
||||||
value: user,
|
value: user,
|
||||||
key: user.id,
|
key: user.id,
|
||||||
display: `${user.username}#${user.discriminator}${user.nick ? ` (${user.nick})` : ""}`,
|
display: `${user.username}#${user.discriminator}${
|
||||||
|
user.nick ? ` (${user.nick})` : ""
|
||||||
|
}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue