utils.selectionMenu: Collection.remove -> Collection.delete

This commit is contained in:
Cynthia Foxwell 2022-10-09 12:53:55 -06:00
parent f5170034d2
commit 16cc64219a

View file

@ -2,8 +2,6 @@ const {Collection} = require("oceanic.js");
const murmurhash = require("murmurhash").v3;
const {tinycolor} = require("@ctrl/tinycolor");
const logger = require("./logger.js");
function pastelize(id) {
const hue = murmurhash(id) % 360;
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
@ -223,7 +221,7 @@ async function selectionMessage(
if (interaction.data.custom_id == "cancel") {
hf.events.remove("interactionCreate", `selection.${msg.id}`);
clearTimeout(hf.selectionMessages.get(msg.id));
hf.selectionMessages.remove(msg.id);
hf.selectionMessages.delete(msg.id);
interaction.deferUpdate();
@ -233,7 +231,7 @@ async function selectionMessage(
} else {
hf.events.remove("interactionCreate", `selection.${msg.id}`);
clearTimeout(hf.selectionMessages.get(msg.id));
hf.selectionMessages.remove(msg.id);
hf.selectionMessages.delete(msg.id);
interaction.deferUpdate();
@ -269,7 +267,6 @@ async function selectionMessage(
}
async function lookupUser(msg, str, filter) {
logger.debug("hf:utils:lookupUser", "starting lookup", msg, str, filter);
if (/[0-9]{17,21}/.test(str)) {
return await hf.bot.rest.authRequest({
method: "GET",
@ -328,14 +325,12 @@ async function lookupUser(msg, str, filter) {
selection.splice(20);
try {
logger.debug("hf:utils:lookupUser", "sending selection message");
return await selectionMessage(
msg,
"Multiple users found, please pick from this list:",
selection
);
} catch (out) {
logger.debug("hf:utils:lookupUser", "selection message failed:", out);
return out;
}
}