Skip to content

Commit

Permalink
fix(commands/divorce): use correct delete on db
Browse files Browse the repository at this point in the history
- use correct delete on db
- move payment below DB query
  • Loading branch information
Mitchell3514 committed Feb 19, 2024
1 parent 176c41f commit 7861c50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/commands/social/divorce.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ async function divorce_accepted(msg, toDivorceId, user, toDivorceUser) {
);
}

await DB.relationships.findByIdAndDelete(marriage._id);
await ECO.pay(msg.author.id, 2500, "divorce");
await ECO.pay(toDivorceId, 2500, "divorce");
await DB.relationships.delete(marriage._id);

await msg.channel.send(
`The ending of a story: <@${msg.author.id}> and **${toDivorceUser.username}** are now divorced. :broken_heart:`
Expand Down Expand Up @@ -201,8 +201,8 @@ async function rejectFlow(user, msg, partner, marriage) {
return;
}

await DB.relationships.findByIdAndDelete(marriage._id);
await ECO.pay(msg.author.id, 5000, "divorce.lawyer");
await DB.relationships.delete(marriage._id);

await msg.channel.send(
`Happy loner: <@${msg.author.id}> has paid ${_emoji(
Expand Down

0 comments on commit 7861c50

Please sign in to comment.