Categories
Tech

An alternative way to prevent spammers entering Telegram Groups

Telegram is a growing platform of instant messaging which has gained great popularity in the past few years. With its openness and superior user-friendliness, it has attracted a lot of users, along with spammers.

Categories
Tech

Message delivery issues in EFB Telegram Master channel (comparing to generic IM services)

Different from how usually an IM would work, EFB Telegram Master channel (ETM) strongly rely on Telegram Bot platform. This had made ETM more difficult to deal with messages failed to deliver.

This article is first published on ETM Wiki on 20 April, 2019.

Categories
Tech 中文文章 日本語記事

Custom sort order in music libraries: macOS and Android (en, zh-hans, ja)

在 macOS 和 Android 平台实现音乐库中的自定义排序
macOS と Android での音楽ライブラリーのカスタムソート順

Custom sort order in music libraries is a rather rare need. Most major languages use phonograms in their scripts, where the natural sort order is more or less identical to what is seen in Unicode (probably after some normalizations). On the other hand, languages using logograms (logosyllabic scripts, mainly Chinese characters in our context) does not have their characters sorted in their primary natural (usually phonetic) order in Unicode.
This causes a problem where a list of text sorted in Unicode code point order can be odd and difficult to look up from in these languages. Custom sort order in music libraries is thus useful when you have songs in one of these languages, or even a mix of them.

As this article involves mainly with concepts common among Chinese and Japanese language users, this article is also written in zh-hans and ja.
本文末尾附有中文版。
この記事の最後には日本語バージョンがあります。

Categories
Tech 中文文章

Simple automated interactions with Telegram Bots using MTProto (Pyrogram)

Telegram is a popular IM platform that is famous for its openness. A lot of applications are being discovered with their public Bot API and User API. Exposed as an HTTP interface, the Bot API is more popular on Telegram, but to interact with a bot, we still need to expose its User API, which is using an original protocol named MTProto. Below is my simple code snipped that sends a message to a bot and mark its first reply as read, using Pyrogram — a Python wrapping of MTProto.

Categories
Tech

Write to Repeater Fields of Ultimate Fields with WordPress REST API

Ultimate Fields is a WordPress plugin that add custom fields to existing post types, both built-in and custom. It’s the only free plugin I found that can add a repeating field (field with arbitrary number of items. However, this plugin has not been updated for almost a year, and there’s a bug where repeater fields cannot be written using REST API.

Categories
Tech

Translate README files in reStructuredText with Sphinx

reStructuredText (reST) is a markup language that is popular in the Python developers community. reST is the standard markup language for docutils, Sphinx documentation generator, and the Python Package Index (PyPI). However, reST by now is still not popular enough. Most translation platforms, including Crowdin which I’m using now for EH Forwarder Bot, have no support to reST documents.

Sphinx has provided a plug-in sphinx-intl, which extract strings from reST documents and compile into GNU gettext message catalog template (.pot) files, and build new documents with translated strings in other languages. GNU gettext formats are widely accepted by translation platforms, making our life much easier. This would work out-of-box if you are generating HTML or PDF documentations, but not so simple if you want a reST output.

Categories
Tech

Splitting a Large Class and Multiple Inheritance in Python

When I started refactoring EFB Telegram Master Channel (ETM) for 2.0 updates, I was investigating ways to organize code into different files in a decent manner. In this article I’d like to talk about the strategy I used, comparing to another codebase I was reading back then, itchat.

Categories
Tech

RWG: an Experiment on Semi-Automated AI (?) Agent for Genkai Shiritori Mobile

Few days ago, a new game, Genkai Shiritori Mobile (GSM), was released by Baton Co., Ltd. and a web media and YouTubers team QuizKnock. Shiritori is a traditional Japanese word game where each player says a new word that starts with the last letter (or rather kana) of the previous word. Genkai Shiritori is a game originated from QuizKnock where they added a few new rules on top of the simple Shiritori game, including:

  • Including a random factor of playing cards: the next player must say a word with the number of kanas on the card drawn.
  • Time limit: each player has a total of 5 minutes of time per game

After the Genkai Shiritori video series has gain popularity on YouTube, QuizKnock then modified the rules further and made into a mobile game. This article is introducing my analysis, attempts and thoughts on building a semi-automated AI (?) agent, which I later named it as Random Word Generator.

Categories
Tech

What’s so new in EH Forwarder Bot 2 (and its modules)

EH Forwarder Bot is an extensible chat tunneling framework that allow users to send and receive messages from multiple IM platforms at one stop, and ultimately manage their accounts remotely.
https://github.com/blueset/ehForwarderBot

After almost a whole year, EH Forwarder Bot 2 has finally more or less finalized its features and structures. Most of the modules have also entered beta stage together with the framework. This update will be a lot different from the previous version, and as suggested by the semantic versioning, it will not be compatible with the previous version.

So, I think it should be the time to introduce about the new features in EFB v2.

Categories
Tech

Obfuscate PDF Text: Scramble Copied Text with Crafted CMap

Notice

  • This does not prevent your PDF from being copied. OCR nowadays is pretty advanced.
  • Backup your document before you do anything.
  • The author does not encourage plagiarism in any form.