chore: format

This commit is contained in:
Pihkaal
2025-07-28 22:19:23 +02:00
parent 7a70894b8b
commit 81cffc28c8
3 changed files with 21 additions and 15 deletions

View File

@@ -9,15 +9,15 @@ export const initAccounts = async (): Promise<void> => {
}; };
export const getAccountBalance = async (playerId: string): Promise<number> => { export const getAccountBalance = async (playerId: string): Promise<number> => {
console.log("getAccountBalance") console.log("getAccountBalance");
const accounts: Record<string, number> = await Accounts.json(); const accounts: Record<string, number> = await Accounts.json();
console.log("getAccountBalance :: next") console.log("getAccountBalance :: next");
if (accounts[playerId]) return accounts[playerId]; if (accounts[playerId]) return accounts[playerId];
accounts[playerId] = 0; accounts[playerId] = 0;
console.log("getAccountBalance :: next") console.log("getAccountBalance :: next");
await Accounts.write(JSON.stringify(accounts)); await Accounts.write(JSON.stringify(accounts));
console.log("getAccountBalance :: next") console.log("getAccountBalance :: next");
return 0; return 0;
}; };
@@ -26,11 +26,11 @@ export const setAccountBalance = async (
playerId: string, playerId: string,
balance: number, balance: number,
): Promise<void> => { ): Promise<void> => {
console.log("setAccountBalance") console.log("setAccountBalance");
const accounts: Record<string, number> = await Accounts.json(); const accounts: Record<string, number> = await Accounts.json();
console.log("setAccountBalance :: next") console.log("setAccountBalance :: next");
accounts[playerId] = balance; accounts[playerId] = balance;
await Accounts.write(JSON.stringify(accounts)); await Accounts.write(JSON.stringify(accounts));
console.log("setAccountBalance :: next") console.log("setAccountBalance :: next");
}; };

View File

@@ -112,7 +112,10 @@ const askForGrinders = async (quest: QuestResult) => {
.split(",") .split(",")
.map((x) => x.trim()) .map((x) => x.trim())
.filter(Boolean); .filter(Boolean);
const embed = await makeResultEmbed(quest, [...env.QUEST_EXCLUDE, ...exclude]); const embed = await makeResultEmbed(quest, [
...env.QUEST_EXCLUDE,
...exclude,
]);
const rewardChannel = await client.channels.fetch( const rewardChannel = await client.channels.fetch(
env.DISCORD_REWARDS_CHANNEL, env.DISCORD_REWARDS_CHANNEL,
); );
@@ -169,22 +172,25 @@ client.on("messageCreate", async (message) => {
`'${args[0]}' n'est pas dans le clan (la honte). **Attention les majuscules sont importantes**`, `'${args[0]}' n'est pas dans le clan (la honte). **Attention les majuscules sont importantes**`,
); );
} else { } else {
if(args.length === 2) { if (args.length === 2) {
if ( if (
(args[1][0] !== "+" && args[1][0] !== "-") || (args[1][0] !== "+" && args[1][0] !== "-") ||
!args[1] || !args[1] ||
isNaN(Number(args[1].substring(1))) isNaN(Number(args[1].substring(1)))
) { ) {
await message.reply( await message.reply(
`Format: \`@LBF gemmes <pseudo> <+GEMMES|-GEMMES>\`.\nExemple:\`@LBF gemmes Yuno -10000\`. **Attention les majuscules sont importantes**`, `Format: \`@LBF gemmes <pseudo> <+GEMMES|-GEMMES>\`.\nExemple:\`@LBF gemmes Yuno -10000\`. **Attention les majuscules sont importantes**`,
); );
return; return;
} }
const mult = args[1][0] === '+' ? 1 : -1; const mult = args[1][0] === "+" ? 1 : -1;
const delta = Number(args[1].substring(1)) * mult; const delta = Number(args[1].substring(1)) * mult;
const balance = await getAccountBalance(clanMember.playerId); const balance = await getAccountBalance(clanMember.playerId);
await setAccountBalance(clanMember.playerId, Math.max(0, balance + delta)); await setAccountBalance(
clanMember.playerId,
Math.max(0, balance + delta),
);
} }
const balance = await getAccountBalance(clanMember.playerId); const balance = await getAccountBalance(clanMember.playerId);

View File

@@ -36,7 +36,7 @@ export const checkForNewQuest = async (): Promise<QuestResult | null> => {
await mkdir(".cache", { recursive: true }); await mkdir(".cache", { recursive: true });
if (await cacheFile.exists()) { if (await cacheFile.exists()) {
const cachedQuestId = await cacheFile.text(); const cachedQuestId = await cacheFile.text();
if(cachedQuestId === lastId || cachedQuestId === "IGNORE") { if (cachedQuestId === lastId || cachedQuestId === "IGNORE") {
return null; return null;
} }
} }