anime-crossing / man-chan

A collaborative effort between friends. Multipurpose Discord Bot written in Python.
MIT License
2 stars 1 forks source link

Money ledger system #10

Open furlongi opened 2 years ago

furlongi commented 2 years ago

As friends, we tend to owe money to each other after eating out and stuff. Having a way to keep track will be nice

A db is needed.

Commands should list what you owe to who, who owes you what, and ability to "pay" (reduce amount owe after money sent)

Up to you to figure out the design. But here are some recommendations:

ssumachai commented 1 year ago

Probably gonna start working on this soon

ssumachai commented 1 year ago

Initial Embed Creation is done, as well as primitive implementation of both bill and form

Created UID Generator in utils folder. Takes in a int and generates a UID of that length using alphanumeric characters excluding vowels

ssumachai commented 1 year ago

bc, billc, billcollection displays your invoices from others

bi displays your latest invoice, but can be refined to search for a specific one given you have the right code

pay allows you to pay the most recent one, as well as specify. Likewise, doing bi will also allow you to pay

ssumachai commented 1 year ago

Addressed issue where people would be able to bill themselves. I was gonna address it later but someone decided to charge themselves 10000000.

Re-factored code that was being re-used. Such as creating the confirmation buttons in a util file rather than each implementation. However, each functions usage of the confirm button is different, so each function has it's own confirm_button callback, so that it can do it's own unique actions:

Future commands such as remove_charge would also use this feature.

Dynamic Timestamps added to anything that uses them! Hovering over the date or clicking on it will tell you exactly when the bill was created or paid.

ssumachai commented 1 year ago

Started working on billmultiple feature. This one is most likely gonna take the longest but mainly because of how data needs to be parsed and obtained. Once data is obtained though, it's relatively easy as only one Invoice Entry needs to be created, and then one Invoice_Participant entry for each participant.

Database design is as follows:

Invoice | ID | Payer_ID| Amount | Timestamp |

Invoice Particpants | ID | Invoice_ID (Above) | Payee_ID || Amount | Paid? | Paid Timestamp

The mindset of this though, is that since bi queries the participant database with id=participant_id only their respective bills will come up

I can bill Manny for $12.12 and Ivan for $15.12 in the same invoice with say key GJ1M. If Manny bi it will show his bill, and if Ivan bi it will show his bill respectively. This way, the invoice can still exist, but others can pay.

Future updates and implementations will allow owners of invoice to see which members have yet to pay!

ssumachai commented 1 year ago

Split Transactions from Multi-Bill are live and live in the billmultiple command. More aliases may come in the future while developing.

Important issues to still address would be how to split a bill, or how to fundamentally store a bill. For example, as of right now:

The Split Evenly feature works as follows:

The potential confusion in this lies in the fact that the bills "total" is fundamentally displayed as $300, but only $200 dollars needs to be collected. May need further discussion on how to fully implement.

If anything, this can be a quick statement in the bill description saying that owner has already paid x amount