Examples
This page contains example scripts to show you how Electrogram looks like.
Every script is working right away (provided you correctly set up your credentials), meaning you can simply copy-paste and run. The only things you have to change are session names and target chats, where applicable.
The examples listed below can be treated as building blocks for your own applications and are meant to be simple enough to give you a basic idea.
Example |
Description |
---|---|
Demonstration of basic API usage |
|
Echo every private text message |
|
The Welcome Bot in @ElectrogramChat |
|
Get the full message history of a chat |
|
Get all the members of a chat |
|
Get all of your dialog chats |
|
Handle callback queries (as bot) coming from inline button presses |
|
Handle inline queries (as bot) and answer with results |
|
Query an inline bot (as user) and send a result to a chat |
|
Send normal and inline keyboards using regular bots |
|
Handle raw updates (old, should be avoided) |
For more advanced examples, see https://snippets.pyrogram.org.