예제 #1
0
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 = [
        [
            {
예제 #2
0
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
예제 #3
0
파일: echo.py 프로젝트: shahrooz1397/GapBot
def _update_handler(bot: Gap, update):  # bot: Methods;
    if update['type'] == 'text':
        bot.send_text(chat_id=update['chat_id'], text=update['data'])
예제 #4
0
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()
예제 #5
0
파일: echo.py 프로젝트: shahrooz1397/GapBot
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;
예제 #6
0
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
예제 #7
0
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
예제 #8
0
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
예제 #9
0
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;