Update cowebsite script map

This commit is contained in:
Alexis Faizeau 2021-10-25 18:59:52 +02:00
parent fb7fe0dc0a
commit 4538f6d915

View File

@ -63,7 +63,7 @@ async function openCoWebsite(args) {
return; return;
} }
await WA.nav.openCoWebsite(args[0]).then(() => { await WA.nav.openCoWebSite(args[0]).then(() => {
wookaSendMessage('Co-website has been opened !'); wookaSendMessage('Co-website has been opened !');
}).catch((error) => { }).catch((error) => {
wookaSendMessage(`Something wrong happen during co-website opening: ${error.message}`); wookaSendMessage(`Something wrong happen during co-website opening: ${error.message}`);
@ -76,17 +76,17 @@ async function closeCoWebsite(args) {
return; return;
} }
const coWebsites = await WA.nav.getCoWebSites();
// All // All
if (args[0] === "all" || args[0] === "*") { if (args[0] === "all" || args[0] === "*") {
WA.nav.closeCoWebsites().then(() => { coWebsites.forEach(coWebsite => {
wookaSendMessage('All co-websites has been closed !'); coWebsite.close();
}).catch((error) => {
wookaSendMessage(`Something wrong happen during co-websites closing: ${error.message}`);
}); });
wookaSendMessage('All co-websites has been closed !');
return; return;
} }
const coWebsites = await WA.nav.getCoWebsites();
const position = parseInt(args[0]); const position = parseInt(args[0]);
// By ID or Position // By ID or Position
@ -100,7 +100,7 @@ async function closeCoWebsite(args) {
return; return;
} }
await WA.nav.closeCoWebsite(coWebsite.id).then(() => { await coWebsite.close().then(() => {
wookaSendMessage('This co-websites has been closed !'); wookaSendMessage('This co-websites has been closed !');
}).catch((error) => { }).catch((error) => {
wookaSendMessage(`Something wrong happen during co-website closing: ${error.message}`); wookaSendMessage(`Something wrong happen during co-website closing: ${error.message}`);