Skip to main content

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

Project description

Установить:

pip install git+https://github.com/flexyyyapk/EasyGram.git

Быстрый старт

Эхо бот(синхронный)

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()

Бот для профиля(синхронный)

from EasyGram import SyncBot, types
from EasyGram.state import State, StatesGroup, StateRegExp

bot = SyncBot('Token here')

class States(StatesGroup):
	name = State()
	age = State()
	last_name = State()
	room = State()

@bot.message(commands='start')
def start(message: types.Message):
	States.room.set_state(message.chat.id, message.from_user.id, 'Get name')

bot.polling()

Что нового?

С новой версии 0.0.4.1:

  • Снова исправлен AsyncBot

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

Связаться:

  • 📞💌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.1b1.tar.gz (25.4 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.1b1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file easygram-0.0.4.1b1.tar.gz.

File metadata

  • Download URL: easygram-0.0.4.1b1.tar.gz
  • Upload date:
  • Size: 25.4 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.1b1.tar.gz
Algorithm Hash digest
SHA256 dbdfb676dde097a0b90fa141110556d554a87cc42ff396fa3ebe42174487160e
MD5 85579d3e8b16c6ba37877ea1d618985b
BLAKE2b-256 221ca46a7c465bb809574352aa52d791d05871a57e02f7c59f68a1189eba20e2

See more details on using hashes here.

File details

Details for the file easygram-0.0.4.1b1-py3-none-any.whl.

File metadata

  • Download URL: easygram-0.0.4.1b1-py3-none-any.whl
  • Upload date:
  • Size: 29.1 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.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c47ff8e9eda29742202756fad053cc6d9395b15be672b2b73b325b871168e4c
MD5 81d4f383685d03d386cba0eff440b1e4
BLAKE2b-256 7a4fcd3fe2c75ef64af024363dd79d11818de899c1c63b2139e66751a70e5245

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