Jump to content

TeleFred - Chat through Telegram


Recommended Posts

Hey! After 6 Years of Mac abstinence I'm back to OSX and Alfred was a main reason to switch back :D

 

But what Skype was then, Telegram is today and I saw that there is no Workflow for Telegram 😪 - unbearable.

 

So here it is. It's a first rough prototype but it does exactly what it should.

It's a quite decent prototype, still lacking the really cool features, but quite stable - yay.

 

UPDATE: I've switched to delivering a self-compiled version of telegram-cli from a more up-to-date repo, 'treset' should unlock it - but please let me know if it doesn't run. You might have to run "brew install telegram" nonetheless to install all the linked libraries it requires - I can't really test without a second Mac around. If you don't like binary blobs, feel free to build "telegram-cli" yourself from the kenorb-contrib repo and replace it in the workflow's directory.

 

t - write to a user or group, see history 

th - show history with user and send message

tc - Talk to Groups

tr - Quick reply to last user

ta - Activate Telegram with user selected

treset - Delete cache files (should have no effect), remove com.apple.quarantine flag from telegram-cli and start telegram-cli in terminal window, so you can 

 

it requires that you install telegram-cli, which - if you have brew installed - is a mere "brew install telegram" away.

 

Before you can use it, you have to run 'treset' once, to remove the quarantine-flag from telegram-cli and log into telegram! 

 

Telegram session information is stored in /.telegram-cli and not in the workflow directory.

 

= Releases =

0.0.1: Initial Release with commands: t, th

0.0.2: Added tr, tc

0.0.4: Major update: own telegram-cli from different repo (https://github.com/kenorb-contrib/tg, vysheng's seems abandoned, and brew installs the one from vysheng), merged th, tc and t, added ta to activate telegram with a certain user selected

 

= Get It =

https://github.com/xtin/TeleFred/blob/master/TeleFred.alfredworkflow

 

= Wish List =

- tg - Talk to Groups - currently limited because telegram-cli segfaults on the dialog_list command (known bug: https://github.com/vysheng/tg/issues/1580 ) - so we don't know what groups there are.

- tl - show 5 last conversations (likely victim to same bug)

- tr - Quick reply to last user

- tc - Call user

- tclip - Send clipboard to user

- tss - Send last screenshot to user

- Show media in the history

- Load user pics and show them in the preview

 

= If you want to help, that's very welcome! You can also talk to me on Telegram: t.me/raf_ael =

Screenshot 2019-12-21 at 02.33.48.png

Edited by xtin
Link to comment
  • 6 months later...

So the commands are t, tq, ta and treset?

They don't seem to be working for me after installing the workflow

 

~telegram-cli ; exit;

dyld: Library not loaded: /usr/local/opt/lua/lib/liblua.5.3.dylib

  Referenced from: ~/telegram-cli

  Reason: image not found

Abort trap: 6

logout

Edited by ashishb
Link to comment

This is super cool.

 

A couple quick notes for anyone installing this: 

- When you first run `treset` a terminal window will open running telegram-cli.

- If you get an error due to missing packages the correct command for the TelegramCLI is `brew install telegram-cli`

- On success you'll be asked for your telegram phone number. It must be formatted with the country code, area code, and complete number with no punctuation.

- When the phone number is correct the next command is a crytic request for a code. It is looking for the code which should be sent to your Telegram account on another device. Mine was significantly delayed so it took a couple tries to figure it out.

Link to comment
20 hours ago, xtin said:

So telegram-cli isn't able to run, because liblua is missing. Can u check if any liblua.??.dylib file is in the /usr/local/opt/lua/lib/ folder? if you have brew installed, you could try


brew install lua

 

Thank you. This worked. I could enter my phone number and then the code. The terminal confirmed that I was online on telegram.

 

Alfred shortcut now shows my telegram contact

command t Firstname

 

When I select a contact, nothing happens. Is it supposed to open a chat window in the telegram app?

 

ta and tr are working as described

Edited by ashishb
Link to comment

A complete noob here, just got started with Mac and Alfred in general. Firstly, some of the stuff here and on packal is awesome! 

 

Can you guys explain how safe and secure these workflows are ? Is this data of my telegram messages remain local on my laptop or does it leave my computer for some of these advanced alfred integrations to work? (Also had this question regarding the Spotify players and the redirected URL that I have been punching in). 

 

Someone who better understands all this, please let me know. Thanks a ton guys and keep the kickass work going

Link to comment
  • 1 year later...

Hi boulevard,

 

This workflow is using a command line version of a telegram client - it's basically as if Alfred was remote controlling your normal Telegram client. The data is stored locally, you only interact remotely with Telegram servers. 

 

Most Alfred integrations either control a program on your PC or call some remote server for the work to happen. As for security, the code is open, but nothing about them makes them particularly safe - afaik no-one reviews them in this regard. But that's a problem of PCs in general, and not Alfred in particular ;)

Link to comment
  • 1 year later...

Looks like telegram-cli is trying to dynamically link lua or some lua library. The error means that the library was not loaded because it could not be found in any of the locations/ paths the linker would expect it to be. It tried all these locations and then gave up:

  • '/usr/local/opt/lua/lib/liblua.5.3.dylib' (no such file)
  • '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/lua/lib/liblua.5.3.dylib' (no such file)
  • '/usr/local/opt/lua/lib/liblua.5.3.dylib' (no such file)
  • '/usr/local/lib/liblua.5.3.dylib' (no such file)
  • '/usr/lib/liblua.5.3.dylib' (no such file, not in dyld cache)
  • '/usr/local/Cellar/lua/5.4.4_1/lib/liblua.5.3.dylib' (no such file)
  • '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/lua/5.4.4_1/lib/liblua.5.3.dylib' (no such file)
  • '/usr/local/Cellar/lua/5.4.4_1/lib/liblua.5.3.dylib' (no such file)
  • 'usr/local/lib/liblua.5.3.dylib' (no such file),
  • '/usr/lib/liblua.5.3.dylib' (no such file, not in dyld cache)

Perhaps you have to install lua?

brew install lua@5.3

 

If it is installed, perhaps there is a way to add its path to the lookup contingent somehow. Maybe it is as simple as copy-pasting that library into the same folder where the executable is (cf. the Soulver Core workflow where this seems to work fine). I ran into these linking issues once or twice before but never had the patience to really figure them out. Good luck 😅

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...