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

  • 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.2.tar.gz (25.5 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.2-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easygram-0.0.4.2.tar.gz
  • Upload date:
  • Size: 25.5 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.2.tar.gz
Algorithm Hash digest
SHA256 d7f03d480535295ae22d7ab6cba4174344f6955e0122ce77a47449e73823f531
MD5 f74e49ccf92a29f50cb9deeeb68e3752
BLAKE2b-256 ee99cb12e78331e1fb112f4c4d667f4cc7e5957d70a98830b1f0c67d08850d5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easygram-0.0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32a96f3708d081b1f68c7e1b188c7fb94819b04e6dbb528dbe54af3bd5fa0a0c
MD5 2028b9d6ee90f2b1d32acb2cf2f14d6c
BLAKE2b-256 0935f9c924642ef0c853d0c08a481d30c8de62c5bd06416b8661ffcdafe97f1a

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