diff --git a/src/commands/fun/subcommands/eco-bet.ts b/src/commands/fun/subcommands/eco-bet.ts index 68087c2..ca8d455 100644 --- a/src/commands/fun/subcommands/eco-bet.ts +++ b/src/commands/fun/subcommands/eco-bet.ts @@ -96,8 +96,8 @@ export const BetCommand = new Command({ sender.money -= amount; receiver.money -= amount; // Very hacky solution for persistence but better than no solution, backup returns runs during the bot's setup code. - sender.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled += amount; - receiver.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled += amount; + sender.ecoBetInsurance += amount; + receiver.ecoBetInsurance += amount; Storage.save(); // Notify both users. @@ -141,8 +141,8 @@ export const BetCommand = new Command({ receiver.money += amount; channel.send(`By the people's votes, <@${target.id}> couldn't be determined to have won or lost the bet that <@${author.id}> had sent them.`); } - sender.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled -= amount; - receiver.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled -= amount; + sender.ecoBetInsurance -= amount; + receiver.ecoBetInsurance -= amount; Storage.save(); }); }, duration); diff --git a/src/core/structures.ts b/src/core/structures.ts index 6a4aa94..e302196 100644 --- a/src/core/structures.ts +++ b/src/core/structures.ts @@ -26,7 +26,7 @@ class User { public lastMonday: number; public timezone: number | null; // This is for the standard timezone only, not the daylight savings timezone public daylightSavingsRegion: "na" | "eu" | "sh" | null; - public quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled: number; + public ecoBetInsurance: number; constructor(data?: GenericJSON) { this.money = select(data?.money, 0, Number); @@ -36,7 +36,7 @@ class User { this.daylightSavingsRegion = /^((na)|(eu)|(sh))$/.test(data?.daylightSavingsRegion) ? data?.daylightSavingsRegion : null; - this.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled = select(data?.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled, 0, Number); + this.ecoBetInsurance = select(data?.ecoBetInsurance, 0, Number); } } diff --git a/src/events/ready.ts b/src/events/ready.ts index 561d33a..e74d3fe 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -19,10 +19,10 @@ export default new Event<"ready">({ for (const id in Storage.users) { const user = Storage.users[id]; - if(user.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled > 0) { - client.users.cache.get(id)?.send(`Because my system either crashed or restarted while you had a pending bet, the total amount of money that you bet, which was \`${user.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled}\`, has been restored.`); - user.money += user.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled; - user.quoteUnquoteSoCalledInsuranceForEcoBetIfItEvenCanBeSoCalled = 0; + if(user.ecoBetInsurance > 0) { + client.users.cache.get(id)?.send(`Because my system either crashed or restarted while you had a pending bet, the total amount of money that you bet, which was \`${user.ecoBetInsurance}\`, has been restored.`); + user.money += user.ecoBetInsurance; + user.ecoBetInsurance = 0; } } Storage.save();