inline_markup.py

 1from bale import Bot, CallbackQuery, Message, InlineKeyboardMarkup, InlineKeyboardButton, MenuKeyboardMarkup, MenuKeyboardButton
 2
 3client = Bot(token="Your Token")
 4
 5@client.event
 6async def on_ready():
 7	print(client.user, "is Ready!")
 8
 9@client.event
10async def on_message(message: Message):
11	if message.content == "/start":
12		reply_markup = InlineKeyboardMarkup()
13		reply_markup.add(InlineKeyboardButton(text="what is python-bale-bot?", callback_data="python-bale-bot:help"))
14		reply_markup.add(InlineKeyboardButton(text="package site", url="https://python-bale-bot.ir"), row=2)
15		reply_markup.add(InlineKeyboardButton(text="package GitHub", url="https://python-bale-bot.ir/github"), row=2)
16		await message.reply(
17			f"*Hi {message.author.first_name}, Welcome to python-bale-bot bot*",
18			components=reply_markup
19		)
20
21	elif message.content == "/keyboard":
22		await message.reply(
23			f"*Hi {message.author.first_name}, Welcome to python-bale-bot bot*",
24			components=MenuKeyboardMarkup().add(MenuKeyboardButton('package site')).add(MenuKeyboardButton('package github'))
25		)
26
27	elif message.content in [
28		'package site',
29		'package github'
30	]:
31		await message.reply(
32			"{} is {}".format(message.content, {"package site": 'https://python-bale-bot.ir', "package github": 'https://python-bale-bot.ir/github'}[message.content]),
33			components=MenuKeyboardMarkup() # to remove menu keyboards
34		)
35
36@client.event
37async def on_callback(callback: CallbackQuery):
38	if callback.data == "python-bale-bot:help":
39		await callback.message.reply(
40			"*python-bale-bot* is a Python library for building bots on the Bale messenger platform. Bale is a messaging app that provides a secure and private messaging experience for users. The python-bale-bot library provides a simple and easy-to-use interface for building bots on the Bale platform, allowing developers to create bots that can send and receive messages, handle events, and perform various actions on behalf of users."
41		)
42
43client.run()