Speed telegram api libraly
Project description
bonfire
bonfire this framework for Telegram Bot API built on requests
instaling
git clone https://github.com/Help-urself/bonfire
or
pip install -i https://test.pypi.org/simple/ bonfire-tg
pip install bonfire-tg
Examples
Click
Simple send_message
request
#git clone
import os
import sys
sys.path.append(os.path.abspath('you path to bonfire'))
from bonfire import *
from bonfire.methods import *
token = "TOKEN"
msg = message(token)
@bot.handler(token,command="/start")#command handler
def start():
send_message(token,chat_id=msg.chat_id,text=f"<b>Hello </b> @{msg.author_username}",parse_mode='HTML')#send message
@bot.handler(token,command="/button")#command handler
def test():
global button
button = {
"inline_keyboard": [
[{"text":f"вћЎпёЏ","callback_data":f"button1"}],
[{"text":f"url button","url" : "https://pypi.org/project/bonfire-tg/" }]
]
}#create button
buttons(token,chat_id=msg.chat_id,button=button,text=f'Hello @{msg.author_username},is test bot')#send button
@bot.event(token)#update handler
def update():
buttons = {
"inline_keyboard": [
[{"text":f"в¬…пёЏ","callback_data":f"button5"}]
]
} #create button
callback_edit(bot=token,data="button5",data_json=msg,text=f"Hello @{msg.callback_author_username},is test bot",button=button) #button click handler
callback_edit(bot=token,data="button1",data_json=msg,text="button clicked !",button=buttons)
if __name__ == '__main__':
while True:
if bot.status(token) == "ok": #do not edit everything in startup
bot.start_command(sys.modules[__name__])
bot.end_status(token)
bot.start(token).start()
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
bonfire_tg-1.0.9.tar.gz
(8.4 kB
view hashes)
Built Distribution
bonfire_tg-1.0.9-py3-none-any.whl
(10.9 kB
view hashes)
Close
Hashes for bonfire_tg-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f719d039e046d64af01cc8eee3606f699fa2a7cda3f7e54c0b0b0baa2352c4e7 |
|
MD5 | e3c0054839314434a0efa864a742f515 |
|
BLAKE2b-256 | d1e06d3bdefac8c362a1449a3e53e2412911d40d8942d2b3bfcb2e8c7969b497 |