Example #1
0
def send_message(message, peer, notify_off=0):
    r = post("messages.send",
             secret=secret,
             v="5.103",
             access_token=token,
             peer_id=peer,
             random_id=-random.randint(100000000, 999999999),
             message=message,
             disable_mentions=notify_off)
Example #2
0
def typing():
    while typing_active:
        r = post("messages.setActivity",
                 secret=secret,
                 access_token=token,
                 peer_id=chat_peer,
                 group_id=192889258,
                 type="audiomessage")
        #print(r.json())
        time.sleep(4.5)
Example #3
0
def send_with_keyboard(message, peer, keyboard, notify_off=0):  # no using more
    r = post("messages.send",
             secret=secret,
             v="5.103",
             access_token=token,
             peer_id=peer,
             random_id=-random.randint(100000000, 999999999),
             message=message,
             keyboard=keyboard,
             disable_mentions=notify_off)
Example #4
0
def update_keys(data, w):
    print("Обновляю ключи")
    r = post("groups.getLongPollServer",
             secret=secret,
             access_token=token,
             group_id=group_id).json()['response']
    wait = data[2]
    base.delete_all("settings")
    base.append("settings", r['server'], r['key'], wait, r['ts'])
    return get_update(wait=w)
Example #5
0
def send_cancel_button(message, payload, peer):
    cancel = Keyboard.Button.text(label="Отмена",
                                  payload=payload,
                                  color='negative')
    keyboard = Keyboard.create([cancel], inline=True)
    r = post("messages.send",
             secret=secret,
             v="5.103",
             access_token=token,
             peer_id=chat_peer,
             random_id=-random.randint(100000000, 999999999),
             message=message,
             keyboard=keyboard)