Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- import tools
- import time
- vk = vk_api.VkApi(token="PUT TOKEN HERE")
- values = {"out": 0,"count": 100,"time_offset": 60}
- def write_message(uid,s):
- vk.method("messages.send", {"user_id":uid,"message":s})
- def parse(s):
- try:
- switch = {
- "1": lambda: test(),
- }
- write_message(item[u"user_id"],u"Message: {}".format(s))
- except Exception:
- write_message(item[u"user_id"],u"Я тебя не понимаю!")
- while True:
- response = vk.method("messages.get",values)
- if response["items"]:
- values["last_message_id"] = response["items"][0]["id"]
- for item in response["items"]:
- reply = response["items"][0]["body"]
- parse(reply)
- time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement