discord-mudlet-map
Version:
This little library helps with Discord bot configuration to provide small Mudlet map fragment images with given location.
15 lines • 419 B
JavaScript
let hashCache;
export function hashOrIdSearch(matches, reader) {
const raw = matches[1];
if (!Number.isNaN(parseInt(raw, 10)))
return raw;
if (!hashCache) {
hashCache = {};
for (const room of reader.getRooms()) {
if (room.hash)
hashCache[room.hash] = room.id;
}
}
return hashCache[raw] ?? -1;
}
//# sourceMappingURL=search-functions.js.map