|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#######
#
# E-scripts on telega.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
# (find-eev-quick-intro)
# http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/telega.e>
# or at <http://angg.twu.net/e/telega.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/.emacs[.html]>,
# <http://angg.twu.net/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
# «.tdlib» (to "tdlib")
# «.server» (to "server")
# «.emacsconf2021» (to "emacsconf2021")
# «.tme» (to "tme")
# «.telega-msg-copy-dwim» (to "telega-msg-copy-dwim")
# «.telega-use-images» (to "telega-use-images")
# «.copy-text» (to "copy-text")
# «.prev-and-next» (to "prev-and-next")
# «.search-by-date» (to "search-by-date")
TODO: move several sections from
(find-es "telegram")
to here...
# (find-epackage-links 'telega "telega" t)
# (find-epackage 'telega)
# (code-c-d "telega" "~/.emacs.d/elpa/telega-20221015.1120/")
# (find-telegafile "")
#####
#
# tdlib
# 2022jan26
#
#####
# «tdlib» (to ".tdlib")
# (find-angg ".emacs" "telega")
# https://github.com/zevlg/telega.el
# https://github.com/zevlg/telega.el/blob/master/README.md
# https://zevlg.github.io/telega.el/ Telega Manual
# https://zevlg.github.io/telega.el/#building-tdlib
#
# https://core.telegram.org/tdlib
# https://core.telegram.org/tdlib/getting-started
# https://github.com/tdlib/td
# https://tdlib.github.io/td/build.html?language=C
# https://tdlib.github.io/td/build.html?language=C%2B%2B
# (find-telegachat "1487862914#237695" "-j2 might still help quite a bit")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install make git zlib1g-dev libssl-dev gperf php-cli cmake g++
# (find-git-links "https://github.com/tdlib/td.git" "td")
* (eepitch-shell3)
* (eepitch-kill)
* (eepitch-shell3)
# rm -Rfv ~/usrc/td/
cd ~/usrc/
git clone https://github.com/tdlib/td.git
cd ~/usrc/td/
git pull
git clean -dfx
git reset --hard
# (find-fline "~/usrc/")
# (find-fline "~/usrc/td/")
# (find-gitk "~/usrc/td/")
# (code-c-d "td" "~/usrc/td/")
# (find-tdfile "")
# (find-tdfile "build/")
# (find-tdfile "build/ocm2")
# (find-tdfile "build/ocm2" "usrc/td/build/../tdlib/")
# (find-tdfile "tdlib/")
# (find-tdsh "find * | sort")
# (find-tdsh "find * | sort | grep tdjson")
# (find-tdsh "find * | sort | grep tdjson.pc")
# (find-tdsh "find tdlib | sort")
# (find-tdfile "tdlib/lib/pkgconfig/tdjson.pc")
* (eepitch-shell3)
* (eepitch-kill)
* (eepitch-shell3)
cd ~/usrc/td/
# git checkout v1.8.0
git checkout master
rm -rf build/
mkdir build/
cd build/
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib .. |& tee ocm1
cmake --build . --target install |& tee ocm2
cd ..
cd ..
ls -l td/tdlib
# mkdir -p build/bld && cd build && cmake -DCMAKE_INSTALL_PREFIX=$PWD/bld ..
# user-error: TDLib is not installed into "/usr/local". Set
# ‘telega-server-libs-prefix’ to the TDLib installion path
# (find-evardescr 'telega-server-libs-prefix)
# (find-evariable 'telega-server-libs-prefix)
(setq telega-server-libs-prefix "/usr/local")
(setq telega-server-libs-prefix "/home/edrx/usrc/td/tdlib")
#####
#
# server
# 2022oct23
#
#####
# «server» (to ".server")
# (find-telegafile "")
# (find-telegafile "server/")
# (find-telegafile "server/Makefile")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/.emacs.d/elpa/telega-20221015.1120/
cd ~/.emacs.d/elpa/telega-20221015.1120/server/
# (find-tdsh "find * | sort | grep tdjson")
# (find-tdsh "find * | sort | grep tdjson.pc")
# (find-tdfile "tdlib/lib/pkgconfig/tdjson.pc")
# (find-fline "~/usrc/td/tdlib/lib/pkgconfig/tdjson.pc")
make clean |& tee omc
make LIBS_PREFIX=$HOME/usrc/td/tdlib |& tee om
make install |& tee omi
#####
#
# emacsconf2021
# 2022oct23
#
#####
# «emacsconf2021» (to ".emacsconf2021")
# https://emacsconf.org/2021/talks/telega/
# https://media.emacsconf.org/2021/emacsconf-2021-telega--telega-el-and-the-emacs-community-on-telegram--gabriele-bozolla--main.webm
# https://media.emacsconf.org/2021/emacsconf-2021-telega--telega-el-and-the-emacs-community-on-telegram--gabriele-bozolla--main.vtt
# (code-video "telegavideo" "$S/https/media.emacsconf.org/2021/emacsconf-2021-telega--telega-el-and-the-emacs-community-on-telegram--gabriele-bozolla--main.webm")
# (find-telegavideo)
# (find-telegavideo "0:00")
#####
#
# tme
# 2022oct23
#
#####
# «tme» (to ".tme")
# (find-efunctiondescr 'telega-chatbuf--name)
# (find-efunction 'telega-chatbuf--name)
# (find-efunctiondescr 'telega-chatbuf--chat)
# (find-efunction 'telega-chatbuf--chat)
# (find-efunctiondescr 'telega-chat-username)
# (find-efunction 'telega-chat-username)
# (find-efunctiondescr 'telega-chat-title-with-brackets)
# (find-efunction 'telega-chat-title-with-brackets)
# (find-efunctiondescr 'telega-chat-title)
# (find-efunction 'telega-chat-title)
# (find-efunctiondescr 'telega-tme-internal-link-to)
# (find-efunction 'telega-tme-internal-link-to)
# (find-efunctiondescr 'telega-tme-open-tg)
# (find-efunction 'telega-tme-open-tg)
# (find-efunctiondescr 'telega-msg-copy-link)
# (find-efunction 'telega-msg-copy-link)
# (find-efunctiondescr 'telega-tme--post-msg-id)
# (find-efunction 'telega-tme--post-msg-id)
# (find-efunctiondescr 'telega-tl-str)
# (find-efunction 'telega-tl-str)
# (find-ebuffer "◀[telega.el@emacs_telega]")
(setq tcbuf "◀[telega.el@emacs_telega]")
(setq tcchat (with-current-buffer tcbuf telega-chatbuf--chat))
(telega-chat-username tcchat)
(telega-chat-title tcchat)
(find-eppp tcchat)
(plist-get tcchat :chat_id)
(plist-get tcchat :title)
(plist-get tcchat :id)
(plist-get chat-or-msg :chat_id)
(telega-tme-internal-link-to tcchat)
# (find-efunction 'find-telegachat)
# (find-efunction 'find-telegachat-links)
# (find-telegachat "@emacs_telega" "telega.el")
# (find-telegachat "@emacs_telega:37219" "telega.el")
# (find-telegachat "@emacs_telega#37219" "telega.el")
# (find-telegachat "@emacs_posts" "Emacs News and Posts")
# (find-telegachat "@hackernewslive" "Hacker News")
# (find-telegachat "@hacker_news_feed" "Hacker News")
https://t.me/emacs_telega/37219
(telega-tme-open-tg ,url)
(telega-tme-open-tg "https://t.me/emacs_telega")
(telega-tme-open-tg "https://t.me/emacs_telega/37219")
(telega-tme-open-tg "tg:telega:@emacs_telega")
(telega-tme-open-tg "tg:telega:@emacs_telega")
JFYI: to get strings it is better to use telega-tl-str instead of
plist-get, i.e. correctly get chat's title is to call
(telega-tl-str <chat> :title) instead of (plist-get <chat> :title)
#####
#
# telega-msg-copy-dwim
# 2023dec18
#
#####
# «telega-msg-copy-dwim» (to ".telega-msg-copy-dwim")
# (find-telegachat "-1001179424883#43591" "To copy text from message use c")
# (find-telegachat "@emacs_telega#43594" "(let* ((m (telega-msg-for-interactive))")
# (find-efunction 'telega-msg-copy-dwim)
# (find-eapropos "telega.*map")
# (find-eapropos "telega.*map$")
# (find-ekeymapdescr telega-msg-button-map)
# (find-ekeymapdescr telega-msg-button-map "telega-msg-copy-dwim")
# (find-evariable 'telega-msg-button-map)
# (find-evariable 'telega-msg-button-map "telega-msg-copy-dwim")
# (find-efunction 'telega-msg-for-interactive)
(setq m (telega-msg-for-interactive))
(find-epp m)
(find-eppp m)
(plist-get :content m)
(plist-get m :content)
(plist-get (plist-get m :content) :text)
(plist-get (plist-get (plist-get m :content) :text) :text)
(let* ((m (telega-msg-for-interactive))
(mc (plist-get m :content))
(mct (plist-get mc :text))
(mctt (plist-get mct :text)))
mctt)
# (find-efunction 'ee-find-telegachat-links)
#####
#
# telega-use-images
# 2024mar10
#
#####
# «telega-use-images» (to ".telega-use-images")
# (find-eaproposv "telega.*image")
# (find-evardescr 'telega-use-images)
# (setq telega-use-images '(scale rotate90))
# (setq telega-use-images nil)
#####
#
# copy-text
# 2024mar10
#
#####
# «copy-text» (to ".copy-text")
# (find-efunction 'telega-msg-copy-text)
# (defun tct () (interactive) (telega-msg-copy-text (telega-msg-for-interactive) 'no-props))
(find-telegachat "272098718#231063")
#####
#
# prev-and-next
# 2024mar10
#
#####
# «prev-and-next» (to ".prev-and-next")
# (find-elocus-links "<tab>" 'telega-msg-button-map)
# (find-elocus-links "<backtab>" 'telega-msg-button-map)
# (find-efunction 'telega-button-forward)
# (find-efunction 'telega-button-backward)
#####
#
# search-by-date
# 2024jul13
#
#####
# «search-by-date» (to ".search-by-date")
# (find-es "emacs" "format-time-string")
# (find-telegachat "@emacs_telega#45490")
# (find-telegachat "@emacs_telega#45490" "Try M-g d in a chatbuf")
# (find-elocus-links "M-g d" 'telega-chat-mode-map)
# (find-ekeymapdescr telega-chat-mode-map)
# (find-hkeymap-links 'telega-chat-mode-map)
# (find-ekeymapdescr telega-chat-mode-map "M-g d" "telega-chatbuf-goto-date")
# (find-hkeymap-links 'telega-chat-mode-map 2 "M-g d" "telega-chatbuf-goto-date")
# (find-efunction 'telega-chatbuf-goto-date)
# (find-efunction 'telega-read-timestamp)
# (find-efunction 'org-read-date)
# (setq mytime (telega-read-timestamp "History at" 'only-date))
> Evgeny Zajcev:
Try M-g d in a chatbuf
> Evgeny Zajcev:
See https://zevlg.github.io/telega.el/#chatbuf-fast-navigation for fast navigation commands
```
(defun find-telegachatdate (idn datestr &rest rest)
(let* ((decodedtime (parse-time-string datestr))
(timestamp (encode-time decodedtime))
(seconds (time-convert timestamp 'integer)))
(find-telegachat idn)
(telega-chatbuf-goto-date seconds)))
;; Ok: (find-telegachat "@eduardoochs")
;; Ok: (find-telegachatdate "@eduardoochs" "2023-10-10 23:59:28")
;; Error: (find-telegachatdate "@eduardoochs" "2023-10-10")
;; -> let*: Wrong type argument: fixnump, nil
```
(parse-time-string "2023-10-10 23:59:28")
(parse-time-string "2023-10-10")
(encode-time (parse-time-string "2023-10-10 23:59:28"))
(encode-time (parse-time-string "2023-10-10"))
https://www.youtube.com/watch?v=Py5xBdGqM0I
https://www.youtube.com/watch?v=myWi03zB87E
https://www.youtube.com/shorts/eAvyW7_eyl0
https://www.youtube.com/watch?v=Wm1jkaVztqY
https://www.youtube.com/shorts/XESDBlwkb1U
https://en.wikipedia.org/wiki/Sternalis_muscle
https://www.brasildefato.com.br/2024/07/11/como-pensa-a-extrema-direita-dossie-revela-metodo-de-curso-criado-por-eduardo-bolsonaro
# (find-fline "~/.telega/" "db.sqlite")
# (find-telegachat "-1001179424883#46181" "sqlite" "about 0.5 seconds")
# Local Variables:
# coding: utf-8-unix
# End: