telega.el
is full featured unofficial client for
Telegram platform for GNU
Emacs.
telega.el
is actively developed, for this reason, some features are
not implemented, or they are present just as skeleton for future
implementation. However, the core parts are mature enough so that it
is possible to use telega.el
for basic chat.
In some random order:
- Listing chats, reordering chats according to internal Telegram order
- 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
- Resend failed messages (see TDLib#166)
- Creating new groups, upgrading basicgroup to supergroup
- Forwarding messages
- D-Bus notifications on incoming messages in chats with enabled notifications
- VoIP calls, including D-Bus call notification
- Downloading files from the cloud
- Uploading files/media (also pasting images from clipboard) to the cloud
- Display chat actions, such as "@user is typing..."
- Display/Update chat's draft message
- Company backends for emoji (
:<emoji>
syntax), usernames, hashtags, bot commands completions - Secret chats
- Online global searching chats/contacts/messages
- Avatars, Photos, Stickers
- Animated GIF, via ffplay
- Special messages such as location/live location, voice/video messages, contacts, etc (PARTLY)
- Poll messages, Poll creation
- Handling local links, such as "tg:" or "https://t.me/xxx" (PARTLY)
- ReplyMarkup (inline keyboard buttons) in the messages (PARTLY)
- InstantView for web pages
- Blocking/Unblocking users, listing blocked users
- Inline bots requests, via "@bot query"
- Searching for messages in chat
- Shared media
- Traffic control, see telega#62
- TranslationsPlatform support
- Delayed messages, see TDLib#695
- Cloud themes, see TDLib#691
- Expressive
ibuffer
-like chats filtering - Custom order for chats (some chats on top, some chats on bottom, etc)
- Labeled chats, you can assign custom label to chat
- Client side messages filtering
- Get diff for the message edits, see screenshot
Channels only chats filtered in root buffer:
Chat in @emacs_en group:
Attaching funny cat sticker:
telega.el
depends on visual-fill-column
package. This dependency
automatically installs if you install telega from MELPA. Otherwise
you need to install this package by hand.
telega.el
is built on top of the official library provided by
Telegram TDLib 1.5.0. Most
of the distributions do not package this libary, so it has to be build
from source.
GNU Emacs
(at least 26.1 is required)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).
-
If you are using Emacs For Mac OS X, or you installed Emacs by running
brew cask install emacs
, your Emacs lacks svg support, so you cannot use telega. Please switch to emacs-plus -
If you are using Emacs-mac, or you installed Emacs by running
brew install emacs-mac
orbrew cask install emacs-mac
, your Emacs has bug dealing with complex svg, which leads to Emacs hangup. Until the bug is fixed, consider switching to emacs-plus -
emacs-plus is the best choice to run telega.
telega.el
requires at least GNU Emacs 26.1 with imagemagick
and
svg
support.
TDLib is the library for building Telegram clients. It requires a large amount of memory to be built. Make sure you are using 1.5.0 TDLib version.
On MacOS you can install pre-build tdlib
package using homebrew from
brew.sh. Just run:
$ brew install tdlib
On Linux you need build tdlib
from sources.
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
It will install headers to /usr/local/include
and library itself
into /usr/local/lib
. These paths are hardcoded in telega.el
.
VoIP support in telega.el
is optional, if you don't need VoIP, just
ignore this section.
libtgvoip is the
VoIP library for telegram clients. This is the fork from
original library with patches
needed by telega.el
.
To get the source:
$ git clone https://github.com/zevlg/libtgvoip.git
Move into the folder with cd libtgvoip
Prepare a folder for building the library:
$ autoreconf --force --install && ./configure && make
Install the library system-wide:
$ sudo make install
It will also install headers to /usr/local/include
and library into
/usr/local/lib
.
telega.el
already in MELPA, so you can install
it from there as usual package. This method is preferable, because it
will handle all dependencies. After installing telega.el
from MELPA
you can skip to Fire up telega.el
section.
Or you could use git repository or this melpa-style recipe:
(:fetcher github
:repo "zevlg/telega.el"
:branch "master"
:files (:defaults "etc" "server" "Makefile"))
Now that the TDLib
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
, or just let telega
ask you at
the first start and do the job.
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 && make test
If you want VoIP support in telega.el
and libtgvoip
is installed,
then use this instead:
$ make WITH_VOIP=t && make WITH_VOIP=t install && make WITH_VOIP=t test
This command does not require superuser privileges.
Start with M-x telega RET
and follow instructions
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
.
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.
Minor mode to display telega status in modeline. To enable it use
(telega-mode-line-mode 1)
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
:
(telega-notifications-mode 1)
Emoji completions with :<EMOJI-NAME>:
syntax, uses nice
company-mode. It provides
telega-company-emoji
company backend. So you need to add it to
company-backends
, maybe along with other backends in
telega-chat-mode-hook
, for example:
(add-hook 'telega-chat-mode-hook
(lambda ()
(set (make-local-variable 'company-backends)
(append '(telega-company-emoji
telega-company-username
telega-company-hashtag)
(when (telega-chat-bot-p telega-chatbuf--chat)
'(telega-company-botcmd))))
(company-mode 1)))
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.
Join our Telegram group
to discuss the development of telega.el
.
Submitting issues is exceptionally helpful.
telega.el
is licensed under GNU GPL version 3.
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've got the error installing telega
Cannot open load file: No such file or directory, visual-fill-column
A: telega.el
depends on visual-fill-column
package, please
install it first. This package is available from
MELPA
Q: I've got error, while running telega
(error "Invalid image type ‘svg’")
and/or
(error "Invalid image type ‘imagemagick’")
A: telega.el
requires Emacs with SVG and ImageMagick support.
SVG support in Emacs is done using librsvg
library. As to
imagemagick, you will need libmagickcore-dev
and libmagickwand-dev
packages installed. But unfortunately Emacs recently disabled
imagemagick support by default (see
https://lists.gnu.org/r/emacs-devel/2018-12/msg00036.html). So you
need to compile Emacs by hand, specifying --with-imagemagick
flag to
./configure
script.
Telega won't depend on imagemagick
in future, since required image
features has been added to newer Emacs, see
https://lists.gnu.org/r/emacs-devel/2019-06/msg00242.html
Q: I'm from Russia, does telega.el
has proxy support?
A: Yes, use telega-proxies
custom variable, for example:
(setq telega-proxies
(list
'(:server "1.2.3.4" :port 8080 :enable :false
:type (:@type "proxyTypeSocks5"
:username "rkn" :password "jopa"))
'(:server "2.3.4.5" :port 8088 :enable t
:type (:@type "proxyTypeSocks5"
:username "rkn" :password "jopa"))
))
See C-h v telega-proxies RET
for full range of proxy types.
Q: Stickers are not shown.
A: Make sure you have imagemagick
support and please install webp
package
Q: No glyphs for some unicode characters.
A: Please install fonts-symbola
package
Q: There is some formatting issues when some unicode characters are used. Is there way to fix it up?
A: Yes, partly. If character has full width of multiple ordinary chars you can tweak char-width-table
. Add code like this to your init.el:
(setq telega-symbol-unread "🄌")
(defun my-telega-load ()
;; 🄌 occupies two full chars, but (string-width "🄌") returns 1
;; so we install custom widths to `char-width-table'
(telega-symbol-set-width telega-symbol-unread 2)
;; ... other code
)
(add-hook 'telega-load-hook 'my-telega-load)
There is also telega-symbol-widths
custom variable, you might want
to modify it.
Q: Is there erc-like chats tracking functionality?
A: Yes, set telega-use-tracking
to non-nil.
Take into account that telega tracks only opened chats with enabled notifications.
Q: Is it possible to use telega.el
in tty-only Emacs (aka
emacs-nox)?
A: Yes, set telega-use-images
to nil
, before start.