Add correct map path for the forest
This commit is contained in:
1 parent
bac1a5a433
commit
c0d5281234
1 file changed
+1
-10
@@ -83,14 +83,6 @@ function stripHtml(text) {
|
|||||||
return (text || "").replace(/<\/?[^>]+(>|$)/g, "");
|
return (text || "").replace(/<\/?[^>]+(>|$)/g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAP_SITE_PATTERN = /mapgenie\.io/i;
|
|
||||||
|
|
||||||
function findMapLink(results) {
|
|
||||||
if (!results) return null;
|
|
||||||
const hit = results.find((r) => r.url && MAP_SITE_PATTERN.test(r.url));
|
|
||||||
return hit ? hit.url : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadGameMaps() {
|
function loadGameMaps() {
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(fs.readFileSync(MAPS_PATH, "utf8"));
|
const parsed = JSON.parse(fs.readFileSync(MAPS_PATH, "utf8"));
|
||||||
@@ -1674,8 +1666,7 @@ async function handleWiki(message, query) {
|
|||||||
: await askAI(query, history, displayName, allFacts, searchResults);
|
: await askAI(query, history, displayName, allFacts, searchResults);
|
||||||
if (aiReply) {
|
if (aiReply) {
|
||||||
const knownMap = findKnownGameMap(query);
|
const knownMap = findKnownGameMap(query);
|
||||||
const mapLink = findMapLink(searchResults && searchResults.results) ||
|
const mapLink = knownMap ? appendMapSearch(knownMap.url, extractMapSearchTerm(query, knownMap.name)) : null;
|
||||||
(knownMap ? appendMapSearch(knownMap.url, extractMapSearchTerm(query, knownMap.name)) : null);
|
|
||||||
const content = aiReply + "\n\n🗺️ Map: " + (mapLink ? "[mapgenie.io](<" + mapLink + ">)" : "Not found.");
|
const content = aiReply + "\n\n🗺️ Map: " + (mapLink ? "[mapgenie.io](<" + mapLink + ">)" : "Not found.");
|
||||||
await message.reply(content);
|
await message.reply(content);
|
||||||
rememberAiExchange(message.author.id, query, aiReply);
|
rememberAiExchange(message.author.id, query, aiReply);
|
||||||
|
|||||||
Reference in new issue
Block a user