1
0
Fork 0
out-of-your-element-fork-th.../d2m/converters/pins-to-list.js

20 lines
466 B
JavaScript
Raw Permalink Normal View History

2023-10-10 04:41:53 +00:00
// @ts-check
const {select} = require("../../passthrough")
/**
* @param {import("discord-api-types/v10").RESTGetAPIChannelPinsResult} pins
*/
function pinsToList(pins) {
/** @type {string[]} */
const result = []
for (const message of pins) {
const eventID = select("event_message", "event_id", {message_id: message.id, part: 0}).pluck().get()
if (eventID) result.push(eventID)
}
2024-01-16 03:02:31 +00:00
result.reverse()
2023-10-10 04:41:53 +00:00
return result
}
module.exports.pinsToList = pinsToList