Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request
- import requests
- import time
- import re
- token = "0" #токен от вк.
- chat_id = 78
- app = Flask(__name__)
- last_request_time = 99999999999
- report = " "
- total = 0
- @app.route('/')
- def query_example():
- nick = request.args.get("nickname")
- lvl = request.args.get("lvl")
- hours = request.args.get("hours")
- hours_all = request.args.get("hours_all")
- money = request.args.get("money")
- pid = request.args.get("id")
- global last_request_time
- last_request_time = int(time.time())
- print(str(last_request_time) + " last")
- global report
- global total
- total = total + int(money)
- report = report + ("{}[{}] {}lvl {}\{} {}$ \n".format(nick, pid, lvl, hours, hours_all, money))
- return re.sub("\n", "<br/>", report)
- if __name__ == "__main__":
- app.run(debug=True, host="0.0.0.0")
- while True:
- if ( (int(time.time() - last_request_time)) > 60 & last_request_time!=-1):
- requests.get("https://api.vk.com/method/messages.send?access_token={token}}&chat_id={chat_id}&message={report}".format(token=token, chat_id=chat_id, report=(report+"\n" + str(total) + "$")))
- report = ""
- last_request_time = -1
- time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment