Giter Club home page Giter Club logo

beancount-bot-tg's People

Contributors

dependabot[bot] avatar lucabernstein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

beancount-bot-tg's Issues

Add command to control suggestions

/suggestions -> Lists help of secondary commands to specify

/suggestions list <type>
/suggestions add <type> <value>
/suggestions rm <type> <value>
/suggestions rm <type>

Suggestions for usability improvements

Few suggestions to improve usability :)

  • Specifying the type of suggestion you want to remove shouldn't be necessary. From the user's perspective, the suggestions accounts should be unique anyway (and are not confusable with a description?)
  • Brackets [] to remove accounts seems counterintuitive (Why necessary to remove but not to add?) --> Fix inconsistency :D
  • List suggestions with /suggestions list w/o parameters (prints a list with all suggestions for accTo, accFrom and txDesc)
  • I don't think there is a need for a suggested date? (Please provide use case :D)
  • Last date used in simple tx does not need to become a suggestion for next simple tx

/suggestions rm does not remove item from list

Describe the bug
/suggestions rm accTo [Expenses:Test] does not remove the suggestion from the list

To Reproduce
Steps to reproduce the behavior:

  1. Add multiple accounts as suggestions
  2. List the accounts
  3. Remove account from the list
  4. Account still appears in suggestions

Expected behavior
Expenses:Test is removed from the suggestions

Screenshots
Screen Shot 2021-11-23 at 8 41 58 PM

Default date today for simple transactions

/simple transactions do not ask for date but take today as default.

If user wants to specify date though, this can be done in the initial /simple [date] call like /simple 2021-11-24

Simplify suggestion control

From @Fawerki on #21

List suggestions with /suggestions list w/o parameters (prints a list with all suggestions for accTo, accFrom and txDesc)

Change /suggestions list to /suggestions_list or add additional command. Do not require account type but list all (as table).

Idea: Use inline buttons

  • Also add for delete in the same way

Show archived transactions

/list archived shows all archived transactions

Help text: Are you missing transactions? You might want to check '/list archived'

Allow simple calculations in amount field

Allow inputs like 3.50+4.20+3,80 ('+' operator) and 3.80*10 ('*' operator)

Use case: On the christmas market drinking multiple beverages it might be easier to use telegram's draft mode and let the bot calculate the sum.

See #75

  • Send service notification to users if feature is available

Add /config command directive to control bot settings

  • currency
  • vacation mode: set tag to use by default on all transactions
  • generate comments tags on templated transactions
    • only add comments tags on /list on the fly. Do not hard-code, but use metadata instead.
  • Reminders for open transactions: Let user define schedule (daily, weekly (+ time?)) to be reminded by bot for open (not deleted or archived)
    • Be reminded for transactions that are open for longer than x hours

Add Prometheus Monitoring Endpoint

  • Export log stats in last 24 hours
    • warning, error and up count
  • number of open, archived transactions
  • user count
  • number of cache entries
  • job stats (last run, next run, run count) (not done yet)

Add i18n

  • As comands are valid for each user, there are multiple ways on how to implement this
    • Bind commands in multiple languages simultaneously
    • Only use .OnText binding, check user language (cached?), lookup command and execute. Might require a custom command handler, we might even be able to reuse the subcommands handler.

  • Check for possible library to use, e.g. https://github.com/nicksnyder/go-i18n
  • translation files in an i18n/translations directory
  • Translate existing project (extract EN)
  • Check that everything works for one langauge
  • Add another language (DE)
  • Make configurable in /config
    • e.g. /config lang [de|en|...]
  • implement PoC regarding handling translated commands for both possibilities suggested above
    • decide for one possibility
  • implement decided solution, write tests

Add service notifications to users

  • Add admin user flag
  • Add additional commands for sending notifications for all users (broadcast) / to some user directly
  • (Optional): User can subscribe to notification channel (service, release, ...)
  • Template sending info about new version

Bot backend crashes when user sends "Hi" command (while not being in a tx)

bc_tg_bot | 2021/11/03 20:28:27 runtime error: index out of range [5] with length 5
bc_tg_bot | gopkg.in/tucnak/telebot%2ev2.(*Bot).debug
bc_tg_bot | 	/go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:14
bc_tg_bot | gopkg.in/tucnak/telebot%2ev2.(*Bot).deferDebug
bc_tg_bot | 	/go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:25
bc_tg_bot | runtime.gopanic
bc_tg_bot | 	/usr/local/go/src/runtime/panic.go:1038
bc_tg_bot | runtime.goPanicIndex
bc_tg_bot | 	/usr/local/go/src/runtime/panic.go:90
bc_tg_bot | github.com/LucaBernstein/beancount-bot-tg/bot.(*SimpleTx).Input
bc_tg_bot | 	/src/bot/transactionBuilder.go:120
bc_tg_bot | github.com/LucaBernstein/beancount-bot-tg/bot.(*BotController).handleTextState
bc_tg_bot | 	/src/bot/controller.go:146
bc_tg_bot | gopkg.in/tucnak/telebot%2ev2.(*Bot).handle.func1
bc_tg_bot | 	/go/pkg/mod/gopkg.in/tucnak/[email protected]/bot.go:569
bc_tg_bot | gopkg.in/tucnak/telebot%2ev2.(*Bot).runHandler.func1
bc_tg_bot | 	/go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:35
bc_tg_bot | runtime.goexit
bc_tg_bot | 	/usr/local/go/src/runtime/asm_amd64.s:1581

Test against real (test) db

  • (Nightly or on manual trigger: build test db with data filled)
  • Spin up a db in GH Actions step
  • Write and run tests against this db
  • Spin down

Batch adding of suggestions

Followup of #15

Example message history:

/suggestions add accFrom
Assets:Cash
Assets:Depot:Example1

Functioning

  • CHange generic text handling to use different states
  • Use interface{} and a type switch to route the handling

Create API to control beancount bot

  • Remove email field from db (unless needed, bc. password for web can be set so that email and tg auth login work?)
    • No passwords though, at max token to Telegram
  • #83
  • Add configuration map to read config / settings
  • Add configuration map to write config / settings
  • List transactions (with metadata)
  • delete single and all transactions
  • admin section: error logs and warnings with filters for level, from and to
  • add tests

Improve and align logging

  • Add database table to log errors to
  • Add log levels (following best practises)
  • Use existing logging framework?
  • Add chatID and userID from tb.Message to every log entry (pass message, if != nil, add to message at front)
  • Use custom logger and replace existing logs to log.Print, ...

Build PoC of numpad input for amount

  • Add numpad keyboard and show on amount
  • If user uses numpad keyboard, add sth. like amount: ____,__ to last sent message.
  • Update on numpad input
  • if user (then) uses keyboard to enter amount, remove display in message and use value instead.
  • DIsallow custom units (?)
  • Build PoC on branch, present to @Fawerki and discuss.

Investigate: Text formatting or use emojis

  • Emoji: <insert package to use>
  • Markdown: Pass tb.ModeMarkdown as additional send option to bot.Send()
    • Needs some more testing though, as formatting seems to sometimes silently fail (depending on message content?)
    • tb.ModeMarkdownV2 somehow did not work at all. Maybe RCA is needed here, possibly an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.