Библиотека для удобного и многофункционального(в будущем) использования.
Project description
Установить:
pip install EasyGram
Быстрый старт
Эхо бот(синхронный)
from EasyGram import SyncBot, types
bot = SyncBot('Token here')
@bot.message(content_types='text')
def echo_bot(message: types.Message):
message.answer(message.text)
bot.polling()
Эхо бот(асинхронный)
from EasyGram.Async import AsyncBot, types
bot = AsyncBot('Token here')
@bot.message(content_types='text')
async def echo_bot(message: types.Message):
await message.answer(message.text)
bot.executor()
Бот рандомайзер(синхронный):
from EasyGram import SyncBot, types
from random import randint
bot = SyncBot('Token here')
@bot.message(commands='start')
def start(message: types.Message):
#Делаем маленькую кнопку
button = types.ReplyKeyboardMarkup(resize_keyboard=True)
button.add('От 1 до 10')
message.answer('Привет!', reply_markup=button)
@bot.message(lambda message: message.text == 'От 1 до 10')
def random_number(message: types.Message):
message.answer(f'Тебе выпало: {randint(1, 10)}!')
bot.polling()
Бот рандомайзер(асинхронный)
from EasyGram.Async import AsyncBot, types
from random import randint
bot = AsyncBot('Token here')
@bot.message(commands='start')
async def start(message: types.Message):
#Делаем маленькую кнопку
button = types.ReplyKeyboardMarkup(resize_keyboard=True)
button.add('От 1 до 10')
await message.answer('Привет!', reply_markup=button)
@bot.message(lambda message: message.text == 'От 1 до 10')
async def random_number(message: types.Message):
await message.answer(f'Тебе выпало: {randint(1, 10)}!')
bot.executor()
Что нового?
С новой версии 0.0.3 добавилось:
- Добавились комментарии к методам
- Исправлена ошибка в Async.types.Message.reply
Что добавить ещё?
Связаться:
- 📞💌Telegram channel: Channel
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
easygram-0.0.3b3.tar.gz
(21.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easygram-0.0.3b3.tar.gz.
File metadata
- Download URL: easygram-0.0.3b3.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dc202d1ce7262eef04907e636cea1c809f85ad498bcb5820974c826fffb1c33
|
|
| MD5 |
edd70a8d7389eff384c71fb205e188eb
|
|
| BLAKE2b-256 |
1e0f127e84eb8e42235b58df6e0b02ed6fa4ffa62fb90a25b56fd65df66eed42
|
File details
Details for the file EasyGram-0.0.3b3-py3-none-any.whl.
File metadata
- Download URL: EasyGram-0.0.3b3-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c187749f6396f2728be5be33e4fcfdf50a85ae9b6819be724ebca17f6ea9c838
|
|
| MD5 |
f54eb515fe3c266a6df498985cf395fa
|
|
| BLAKE2b-256 |
91711a8720d1c1a64a3ae787217f5fff28267f2c56e7bfd2cc826595c4becafa
|