from gapbot import Gap # import library; app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; if __name__ == '__main__': # If you are running this module as the main program; target_id = 000000 # whose to be send text to him; text = "GapBot SendText" reply_keyboard = { "keyboard": [ [{ "row1-btn1": "خط اول-دکمه اول" }, { "row1-btn2": "خط اول-دکمه دوم" }], [{ "row2-btn1": "خط دوم-دکمه اول" }], [ { "$contact": "تلفن" }, # to get target's phone number; { "$location": "لوکیشن" } # to get target's location; ], ], } inline_keyboard = [ [ {
from gapbot import Gap # import library; from platform import system app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; if __name__ == '__main__': # If you are running this module as the main program; target_id = 000000 # whose to be send text to him; if system().lower() == 'windows': # Windows users file_path = r'C:\Users\GapUser\Gap.txt' else: # Gnu/linux users and others (not windows) file_path = r'/home/GapUser/Gap.txt' app.send_file(chat_id=target_id, path=file_path, caption='Gap Caption') # https://developer.gap.im/doc/botplatform#method-send-file
def _update_handler(bot: Gap, update): # bot: Methods; if update['type'] == 'text': bot.send_text(chat_id=update['chat_id'], text=update['data'])
from gapbot import Gap app = Gap() @app.on_update def _update_handler(bot, update): if update['type'] == 'file': f = open("links.txt", "a") f.write(update['data']['path'] + "\n") f.close() if __name__ == '__main__': app.run()
from gapbot import Gap # import library; app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; @app.on_update # decorator for get updates; Now you can set just one handler; def _update_handler(bot: Gap, update): # bot: Methods; if update['type'] == 'text': bot.send_text(chat_id=update['chat_id'], text=update['data']) if __name__ == '__main__': # If you are running this module as the main program; app.run() # start handler's works;
from gapbot import Gap # import library; app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; if __name__ == '__main__': # If you are running this module as the main program; target_id = 000000 # whose to be send text to him; text = "GapBot SendText" new_text = 'GapBot SendEditedText' msg = app.send_text( chat_id= target_id, # https://developer.gap.im/doc/botplatform#chatId-description text=text, ) app.edit_message( chat_id=target_id, message_id=msg.json()['id'], new_text=new_text, ) # https://developer.gap.im/doc/botplatform#method-edit-message
from gapbot import Gap # import library; from platform import system app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; if __name__ == '__main__': # If you are running this module as the main program; target_id = 000000 # whose to be send text to him; app.send_contact(chat_id=target_id, name='Gap', phone='+989123456789', caption='Gap Caption') # https://developer.gap.im/doc/botplatform#method-send-contact
from gapbot import Gap # import library; app = Gap(bot_token='your_bot_token') # instance of Main Class; # if you need use bot parameters you must set bot_token; if __name__ == '__main__': # If you are running this module as the main program; target_id = 000000 # whose to be send text to him; app.send_action(chat_id=target_id) # https://developer.gap.im/doc/botplatform#method-send-action
from gapbot import Gap # import library; app = Gap() # instance of Main Class; # if you just need get update you don't must set bot_token; @app.on_update # decorator for get updates; Now you can set just one handler; def _update_handler(bot: Gap, update): # bot: Methods; print('{}'.format(update)) # Cast Update as dict to string then print it; if __name__ == '__main__': # If you are running this module as the main program; app.run() # start handler's works;