utils.selectionMenu: Collection.remove -> Collection.delete
This commit is contained in:
parent
f5170034d2
commit
16cc64219a
1 changed files with 2 additions and 7 deletions
|
@ -2,8 +2,6 @@ const {Collection} = require("oceanic.js");
|
||||||
const murmurhash = require("murmurhash").v3;
|
const murmurhash = require("murmurhash").v3;
|
||||||
const {tinycolor} = require("@ctrl/tinycolor");
|
const {tinycolor} = require("@ctrl/tinycolor");
|
||||||
|
|
||||||
const logger = require("./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();
|
||||||
|
@ -223,7 +221,7 @@ async function selectionMessage(
|
||||||
if (interaction.data.custom_id == "cancel") {
|
if (interaction.data.custom_id == "cancel") {
|
||||||
hf.events.remove("interactionCreate", `selection.${msg.id}`);
|
hf.events.remove("interactionCreate", `selection.${msg.id}`);
|
||||||
clearTimeout(hf.selectionMessages.get(msg.id));
|
clearTimeout(hf.selectionMessages.get(msg.id));
|
||||||
hf.selectionMessages.remove(msg.id);
|
hf.selectionMessages.delete(msg.id);
|
||||||
|
|
||||||
interaction.deferUpdate();
|
interaction.deferUpdate();
|
||||||
|
|
||||||
|
@ -233,7 +231,7 @@ async function selectionMessage(
|
||||||
} else {
|
} else {
|
||||||
hf.events.remove("interactionCreate", `selection.${msg.id}`);
|
hf.events.remove("interactionCreate", `selection.${msg.id}`);
|
||||||
clearTimeout(hf.selectionMessages.get(msg.id));
|
clearTimeout(hf.selectionMessages.get(msg.id));
|
||||||
hf.selectionMessages.remove(msg.id);
|
hf.selectionMessages.delete(msg.id);
|
||||||
|
|
||||||
interaction.deferUpdate();
|
interaction.deferUpdate();
|
||||||
|
|
||||||
|
@ -269,7 +267,6 @@ async function selectionMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
async function lookupUser(msg, str, filter) {
|
async function lookupUser(msg, str, filter) {
|
||||||
logger.debug("hf:utils:lookupUser", "starting lookup", msg, str, filter);
|
|
||||||
if (/[0-9]{17,21}/.test(str)) {
|
if (/[0-9]{17,21}/.test(str)) {
|
||||||
return await hf.bot.rest.authRequest({
|
return await hf.bot.rest.authRequest({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
@ -328,14 +325,12 @@ async function lookupUser(msg, str, filter) {
|
||||||
selection.splice(20);
|
selection.splice(20);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug("hf:utils:lookupUser", "sending selection message");
|
|
||||||
return await selectionMessage(
|
return await selectionMessage(
|
||||||
msg,
|
msg,
|
||||||
"Multiple users found, please pick from this list:",
|
"Multiple users found, please pick from this list:",
|
||||||
selection
|
selection
|
||||||
);
|
);
|
||||||
} catch (out) {
|
} catch (out) {
|
||||||
logger.debug("hf:utils:lookupUser", "selection message failed:", out);
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue