Skip to main content

Библиотека для удобного и многофункционального(в будущем) использования.

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.4:

  • Убран StatesRegExp
  • Оптимизирована работа кода
  • Добавлено больше аннотации
  • Добавлено логирование
  • Исправлена система в state
  • Добавлен класс state.FSMContext для удобного взаимодействия со state-ами
  • Убрана позорная функция CheckDict

Что добавить ещё?

Связаться:

  • 📞💌Telegram channel: Channel

Project details


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.4.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easygram-0.0.4-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file easygram-0.0.4.tar.gz.

File metadata

  • Download URL: easygram-0.0.4.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.0

File hashes

Hashes for easygram-0.0.4.tar.gz
Algorithm Hash digest
SHA256 623ffb432205f952b6c49e808f91e66baf6b51feebc911f0a442a44f971a8a1d
MD5 e3bf98d3057ac4a824ee9045705cc4f7
BLAKE2b-256 759cc3af1f430bc9b7453bcd7eb48de4823d6a0b4e0d8213400de74e852a0be8

See more details on using hashes here.

File details

Details for the file easygram-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: easygram-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.0

File hashes

Hashes for easygram-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5200367acbddab439b97be3c1ca3a9f210591014ca25102cae52e5d5e433cdd5
MD5 f32d6bbcf7ffef6d749c22e86a0c64e6
BLAKE2b-256 58fca1433bac912b5d04b58eea299facf44ef54d82693821f2dcb8363acb47f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page