1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 12:21:00 -05:00

Fix destructure issue in MPModule's webhook

This commit is contained in:
AnxietyisReal 2023-12-27 21:56:38 +11:00
parent ef1b395352
commit 08115380f8

View File

@ -112,8 +112,9 @@ async function multifarmWebhook(client:TClient, server:IServer, webhookId:string
} }
}; };
const getMappedValue =<T>(map:Record<string, T>, key:string, fallback:T):T=>map[key] ?? fallback; const getMappedValue =<T>(map:Record<string, T>, key:string, fallback:T):T=>map[key] ?? fallback;
const {csg} = await requestServerData(client, server); const data = await requestServerData(client, server);
if (!csg) return Logger.console('log', loggingPrefix, 'Couldn\'t get data for webhook'); if (!data) return Logger.console('log', loggingPrefix, 'Couldn\'t get data for webhook');
const {csg} = data;// :tutelBRUH: (https://cdn.discordapp.com/emojis/1155276126176956486.webp)
const fields:Discord.APIEmbedField[] = [ const fields:Discord.APIEmbedField[] = [
{name: 'Seasonal Growth', value: getMappedValue(txtMapping.growthMode, csg?.settings.growthMode, dataUnavailable), inline: true}, {name: 'Seasonal Growth', value: getMappedValue(txtMapping.growthMode, csg?.settings.growthMode, dataUnavailable), inline: true},
{name: 'Crop Destruction', value: getMappedValue(txtMapping.genericBools, csg?.settings.fruitDestruction, dataUnavailable), inline: true}, {name: 'Crop Destruction', value: getMappedValue(txtMapping.genericBools, csg?.settings.fruitDestruction, dataUnavailable), inline: true},