<reponame>TG0123/apigram
import apigram

bot = apigram.session('123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11')
api = apigram.get_api(bot)

#bot is follow for all updates at server
for event in bot.listen():
    #is it message?
    if 'message' in event:
        #is message have a text?
        if 'text' in event['message']:
            #is it a command?
            if event['message']['text'] == '/test' or event['message']['text'] == f'/test@{<EMAIL>}':
                name = event['message']['from']['first_name']
                text = f'<i>Keyboard test</i>, {name}'

                # Creating a keyboard
                kb = apigram.keyboard.inline_keyboard()
                kb.add_button(apigram.keyboard.inline_keyboard_button('test')())
                kb.add_button(apigram.keyboard.inline_keyboard_button('test 2')())
                kb.add_line()
                kb.add_button(apigram.keyboard.inline_keyboard_button('test 3')())
                
                # Sending a message
                api.sendMessage(
                    chat_id = event['message']['chat']['id'], 
                    parse_mode = 'HTML', # for HTML tags <i>Keyboard test</i>
                    text = text, 
                    reply_markup = kb())

import apigram

bot = apigram.session('123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11')
api = apigram.get_api(bot)

#bot is follow for all updates at server
for event in bot.listen():
    #is it message?
    if 'message' in event:
        #is message have a text?
        if 'text' in event['message']:
            #is it a command?
            if event['message']['text'] == '/test' or event['message']['text'] == f'/test@{<EMAIL>}':
                name = event['message']['from']['first_name']
                text = f'<i>Keyboard test</i>, {name}'

                # Creating a keyboard
                kb = apigram.keyboard.inline_keyboard()
                kb.add_button(apigram.keyboard.inline_keyboard_button('test')())
                kb.add_button(apigram.keyboard.inline_keyboard_button('test 2')())
                kb.add_line()
                kb.add_button(apigram.keyboard.inline_keyboard_button('test 3')())
                
                # Sending a message
                api.sendMessage(
                    chat_id = event['message']['chat']['id'], 
                    parse_mode = 'HTML', # for HTML tags <i>Keyboard test</i>
                    text = text, 
                    reply_markup = kb())
#bot is follow for all updates at server #is it message? #is message have a text? #is it a command? # Creating a keyboard # Sending a message # for HTML tags <i>Keyboard test</i>