basic.py¶
1from bale import Bot, Update, Message
2
3client = Bot(token="Your Token")
4
5@client.event
6async def on_ready():
7 print(client.user.username, "is Ready!")
8
9@client.event
10async def on_update(update: Update):
11 print(update.update_id)
12
13@client.event
14async def on_message(message: Message):
15 if message.content == '/start': # to get caption or text of message
16 await message.reply('Hi, from python-bale-bot to everyone!')
17 if message.chat.is_group_chat:
18 await message.reply("It's is a special Hi for groups!") # work when message sent in a group
19
20# See https://docs.python-bale-bot.ir/en/stable/event.html to get more information about events!
21
22client.run()