An introduction to async programming - Writing a Telegram Antispam Bot in Python
summary
Quick intro to async concepts (event loop, coroutines, async/await, asyncio.create_task and asyncio.sleep) followed by a concrete Telegram antispam bot built with Pyrogram and released at https://github.com/eGenix/egenix-telegram-antispam-bot. Bot runs in production since April, bans 390 spam sign-ups from a ~150-member group, saves an estimated ~13 hours of manual moderation, uses async I/O with fallbacks to threads for blocking libraries, and demonstrably works.
AI-written summary · about
chapters (13)
- 0:00Start
- 1:03Motivation: Writing a Telegram Antispam Bot
- 5:36Python: Global Interpreter Lock (GIL)
- 7:05Python: Threaded code on multiple cores/threads
- 8:01Python: Threaded code - a closer look
- 8:22Python: Asynchronous to saturate a single core/thread
- 9:22Asynchronous programming in Python
- 10:38async+ await: Example
- 11:59The asyncio module: a closer look
- 14:02Running async: the Event Loop
- 16:21Async eco system: Low level
- 17:52Async eco system: High level
- 19:11Implementation of the Bot
related talks
01h 21mTUTORIAL: Async Python, Good it is
31mA Really Gentle Introduction to Asyncio
58mA gentle introduction to asyncio
01h 29mStandardised Coroutine Concurrency in Python 3
41mCoroutines, Async/Await, Asyncio and the Pulsar Library
23mPractical usage of asyncio
37mTaking Asynchronous Python to the Next Level Using Trio
57mFear and Awaiting in Async: A Savage Journey to the Heart of the Coroutine Dream
