abul4fia / teletolo

Telegram To Logseq
19 stars 1 forks source link

Some questions #3

Open edshamis opened 1 year ago

edshamis commented 1 year ago

Hi @abul4fia. Thanks for this project, it looks exactly what I wanted for my workflow with logseq. I just tested it and thought about making some customizations, can you please clarify a few things:

  1. What is the difference between your approach with the telegram app vs bot? advantages and disadvantages?

  2. There's a 7 days limit for pulling the messages. Is it telegram's limitation or something that can be configured?

  3. Can the utility pull messages from a private group or only from a channel?

  4. Is it feasible to define several channels/groups to pull messages from, appending channel/group name as a tag?

Thank you in advance 🙏

abul4fia commented 1 year ago

Hi @edshamis!

Glad this tool is useful for you.

What is the difference between your approach with the telegram app vs bot? advantages and disadvantages?

The main advantage of my approach is that no bots are involved :-) Running a bot requires to set up a machine which is always on, in which the bot can be run, or to deploy the bot on a third-party provider (I don't even know if there are providers for this, my only experience with bots involved deploying them in my own server). Also, the interaction with the bot is usually a bit more convoluted, since you have to "tell" the bot what you want to do, and then connect the bot with logseq in some way.

With my approach you don't need to install anything in telegram. You simply send your content to the channel of your choice. You don't need a plugin for logseq either, you simply run my script and put the results in logseq's folder.

There's a 7 days limit for pulling the messages. Is it telegram's limitation or something that can be configured?

It is a parameter for the script. Specify --days_back 15 for example if you want to retrieve older messages. (write --help to see other options). You can also make that default value "permanent" by adding it to teletolo.ini

Can the utility pull messages from a private group or only from a channel?

Never used it in a private group, but in theory, as long as you can get the id of the group from the URL (as explained in the README for channels) it should work, I think. If you try and run in any problem let me know how can I replicate the problem.

Is it feasible to define several channels/groups to pull messages from, appending channel/group name as a tag?

It is an interesting idea. It should be doable, but unfortunately not by me in the short term. I'll open an issue as "enhancement" and come to it later, when I have time.

Regards!

edshamis commented 1 year ago

Thanks a lot for the clarifications! So basically your approach is like running telegram app from cli, right?

Do you accept PR if I come to implement the multichannel functionality?

abul4fia commented 1 year ago

Teletolo is a client for the Telegram API, which connects to it in your name (i.e: using your credentials) and retrieves messsages, so, yes, I guess that you can see it as a kind of Telegram for cli. This is why you don't need to register it as a bot using Botfather (which is another advantage of this approach).

And of course PR are welcome. Implementing multi-channel can be a bit tricky, for the reasons I wrote in #4

edshamis commented 1 year ago

One more question please:

What is the workflow for multiple devices with the same logseq graph? I understand that there's an option to delete processed messages from telegram. But what if I don't want to delete them and still avoid duplicates?

abul4fia commented 1 year ago

That use case is not contemplated. In fact, I wrote this tool for my own use case, which is to be able to quickly "send to logseq" any thought, link, audio note, or image while I'm on my mobile, without needing to install Logseq on my mobile. I use a dedicated Telegram channel to send my content as a kind of "mobile inbox", and then, when at my desktop, I empty that inbox into logseq.

The "no delete" feature was added mainly for testing without the risk of accidentally deleting messages.

However, I think that it should not be difficult to modify Teletolo so that it stores in the filesystem the timestamp of the last time it downloaded content from Telegram. This way, a new option --only-new could be easily added, which downloads only the messages that have a timestamp more recent than the one stored in the file.

I don't understand, however, how this has anything to do with "multiple devices". I use Logseq on multiple devices, but the "Telegram dump" is performed only on one of them, and then the other instances of Logseq are synced by other means (I use Git, but perhaps Dropbox can be used, or the paid Sync feature recently introduced).

edshamis commented 1 year ago

I use git for sync as well, including on mobile. Each time logseq is launched or closed autosync is triggered and I want to add teletolo to the sync script. I like your proposal since personally I prefer not to delete messages. And as far as I understand the timestamps file can be a part of the repo, then any device can can pull the messages any time.

Btw I noticed the -c, --channel_id option already exists, so the multi channel functionality can be implement in the sync script by launching teletolo multiple times over a list of channels. Is it correct?