Civil / github2telegram

Bot that can send notification of new releases to Telegram
Apache License 2.0
47 stars 11 forks source link

I wanted to clarify how to add repositories to config.yaml #13

Open timurgum opened 11 months ago

timurgum commented 11 months ago
---
listen: ":6060"
logger:
- logger: ''
  file: stdout
  level: debug
  encoding: json
  encoding_time: iso8601
  encoding_duration: seconds
database_type: sqlite3
database_url: "./github2telegram.sqlite3"
database_login: ''
database_password: ''
admin_username: "your_telegram_nick"
polling_interval: "30m"
endpoints:
  telegram:
    token: "YOUR_TOKEN_GOES_HERE"
    type: telegram
Civil commented 11 months ago

You can't. Currently you need to add repositories only through commands to bot (that is why admin username is important - that is the user that will always be able to do that, otherwise it is limited to admins of a channel) or directly inserting them into sqlite.

timurgum commented 11 months ago

Please tell me how to add them directly to sqlite then

timurgum commented 11 months ago

If you add directly through a bot, I understand there through /new and /subscribe. Well, if you restart the container, all the added repositories will disappear?

Civil commented 11 months ago

If you add directly through a bot, I understand there through /new and /subscribe. Well, if you restart the container, all the added repositories will disappear?

Well, you should keep sqlite database on a persistent store, as usual with any kind of state for any other application.

Please tell me how to add them directly to sqlite then

I'd suggest to look into the code, as SQL queries to do that are there: https://github.com/Civil/github2telegram/blob/master/db/sqlite.go#L214

But that shouldn't be used as a replacement for persistent storage on every restart.