How to Write Integration Tests for a Telegram Bot

This is my 6th article on Telegram, the IM platform of my preference. In this article I’m going to introduce about how I wrote the integration tests for my EFB Telegram Master channel — a Telegram interface for EFB, using a userbot-like strategy.

To get started, you need to have a bot ready to be tested, and a Telegram client app key that is registered with your account. While alternative tools are available, we will be using Telethon and PyTest in this article.

Telegram Chat Backgrounds/Patterns Extracted

Here is a collection of all extracted chat background/patterns came with Telegram in their original resolution, extracted from Telegram for Android 5.14.0. In Telegram, they are also sometimes called Wallpapers.

This consists of 39 photographs that are there since no long after first Telegram release, 7 patterns in PNG added sometime after that, and 33 patterns in SVG (vector) added recently in 2019. All patterns are monochrome — black drawings and transparent background.

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.

My Telegram mini toolkits (zh-CN)

Abstract

My first submission to “Matrix”, a private product sharing platform built by SSPai (in zh-CN). This article introduces some of my recent bots or project related to Telegram, including the following stuff:

EFB How-to: Send and Receive Messages from WeChat on Telegram (zh-CN)

安装并使用 EFB:在 Telegram 收发微信消息

Banner

Banner

Abstract

This article is a tutorial on how to install EH Forwarder Bot on a VPS server, with Telegram Master Channel and WeChat Slave Channel, alongside with simple exmaples of how to use it. Targeting WeChat power users in China, this article is written in Chinese (zh-CN). For installation manual in English, please visit the documentation.