/telega.el

GNU Emacs telegram client (unofficial)

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

telega.el Join the chat at https://t.me/emacs_telega

telega.el is an unofficial client for Telegram platform for GNU Emacs.

telega.el is in its very alpha stages and it is actively developed. For this reason, many features are not implemented, or they are present just as skeleton for future implementation. However, the core parts of this major-mode are mature enough so that it is possible to use telega.el for basic chat.

Features

  • Listing chats, reordering chats according to internal Telegram order
  • Expressive ibuffer-like chats filtering
  • Getting info about users, groups and supergroups
  • Joining chats by invitation link M-x telega-chat-join-by-link RET
  • Fetching chat history, sending messages, replies, edits, deleting
  • Forwarding messages (see zevlg#36)
  • D-Bus notifications on incoming messages in chats with enabled notifications
  • Downloading files from the cloud
  • Uploading files/media to the cloud
  • Emoji support (only in GNU Emacs with surrogate pairs support, see Bug#24784)
  • Display chat actions, such as "@user is typing..."
  • Emoji input via :<emoji>: syntax with completions
  • Username completions for fast mentions
  • Secret chats
  • Online searching chats/messages
  • Avatars, photos
  • Stickers
  • Animated GIF
  • Special messages such as location/live location, voice/video messages, etc
  • ReplyMarkup (inline keyboard buttons) in the messages
  • InstantView for web pages
  • Client side messages filtering

Screenshots

Chat buffer and combination of root buffer/chat buffer running under iOS terminal blink:

screen0

screen1

telega.el running under GUI version of Emacs:

screen2

Installation

Being in active development, telega.el is not ready to be distributed on archives such as MELPA. At the moment, the only way to use is from this git repository. This involves few simple steps described below.

telega.el is built on top of the official library provided by Telegram tdlib. Most of the distributions do not package this libary, so it has to be build from source.

Dependences

  • GNU Emacs
  • GNU make
  • GNU gperf
  • CMake

make is found in most of the modern machines. The other packages can be download with the system package manager (such as apt for Debian-based distributions, dnf for Fedora or pacman for Arch-based).

Building tdlib

tdlib is the backed used to communicate with the servers. It requires a large amount of memory to be built.

To get the source:

$ git clone https://github.com/tdlib/td.git

Move into the folder with cd td

Prepare a folder for building the library:

$ mkdir build && cd build && cmake ../

Build the sources:

$ make -jN

with N number of cores that should be used for the compilation (the optimal value is the number of physical cores on the machine).

Finally, to install the library system-wide:

$ sudo make install

Now that the library is set-up, it is time to install telega.el. The first step consists in building telega-server, which is a C interface to the tdlib.

Building telega-server

To get the source:

$ git clone https://github.com/zevlg/telega.el

Moving into the folder with cd telega.el, it is possible to build the telega-server executable and move into the $HOME/.telega with:

$ make && make install

This command does not require superuser privileges.

Start with M-x telega RET and follow instructions

Installing telega.el

Now it is time to install telega.el on GNU Emacs.

This can be done with use-package:

(use-package telega
  :load-path  "~/telega.el"
  :commands (telega)
  :defer t)

Or with:

(add-to-list 'load-path "~/telega.el")
(require 'telega)

The code should be put in the configuration file for Emacs, which usually is init.el, or emacs.el.

Fire up telega.el

telega.el can now be started with M-x telega RET. The first time it ask for the phone number to login to the Telegram network.

Enabling D-Bus notifications

telega.el ships with support for D-Bus notifications, but they are disabled by default. To enable notifications add next code to your init.el:

(add-hook 'telega-root-mode-hook (lambda () (telega-notifications-mode 1)))

Configuring client side messages filtering

In official telegram clients all messages in group chats are displayed even if message has been sent by blocked user. telega.el has client side message filtering feature implemented. Ignoring messages can be done via installing special functions into telega-chat-pre-message-hook which could mark message as ignored, for example, to ignore messages from particular user with id=12345 you could add next code:

(defun my-telega-ignore-12345-user (msg &rest notused)
  (when (= (plist-get msg :sender_user_id) 12345)
    (telega-msg-ignore msg)))

(add-hook 'telega-chat-pre-message-hook 'my-telega-ignore-12345-user)

Or to ignore messages from blocked users, just add:

(add-hook 'telega-chat-pre-message-hook 'telega-msg-ignore-blocked-sender)

To view recent messages that has been ignored use M-x telega-ignored-messages RET command.

How to contribute

Join our Telegram group to discuss the development of telega.el.

License

telega.el is licensed under GNU GPL version 3.

FAQ

Q: I got the error after M-x telega RET

Status: telega-server: exited abnormally with code 127
/home/user/.telega/telega-server: error while loading shared libraries:
libtdjson.so: cannot open shared object file: No such file or directory

A: Add /usr/local/lib into library loading path using next:

# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
# ldconfig

Q: I'm from Russia, does telega.el has proxy support?

A: Yes, use telega-socks5-proxy custom variable, for example:

(setq telega-socks5-proxy
      '(:server "1.2.3.4" :port 88 :username "rkn" :password "jopa"))

Since tdlib 1.3.0 and telega 0.2.4 please use:

(setq telega-proxies
      (list
       '(:server "1.2.3.4" :port 88 :enable t
                 :type (:@type "proxyTypeSocks5"
                               :username "rkn" :password "jopa"))))

See C-h v telega-proxies RET for full range of proxy types.

Q: No glyphs for some unicode characters.

A: Please install fonts-symbola package