Answer the question
In order to leave comments, you need to log in
What could be wrong in the code?
error in console:
return self._send_api_request('set', params=data)
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\vkcoin\vkcoin.py", line 28, in _send_api_request
raise Exception(response['error']['message'])
Exception: TOO_MANY_REQUEST_FOR_THIS_METHOD
from colorama import init, Fore, Back, Style
import vk_api, json
from vk_api.longpoll import VkLongPoll, VkEventType
import vkcoin
import json
import datetime
init()
now = datetime.datetime.now()
timeA = now.hour
merchant = vkcoin.VKCoin(user_id=57xxxxx, key='Zn&w]u-lidxxxxxxxxxx')
rez = merchant.get_balance(578382301)
vk_session = vk_api.VkApi(token = "5fa6dxxxxxxxxxxxxxxxxxxxxxxxx")
vk = vk_session.get_api()
longpol = VkLongPoll(vk_session)
print(Style.BRIGHT + Fore.GREEN +"vk-бот запущен")
print("[YES]")
data = {}
m = 0
def construct(id,name,money):
p = {}
p["name"] = name
p["money"] = money
p["messegNumb"] = 0
data[str(id)] = p
return "normal"
def savelink():
filee = open("config.json","w")
data2="""{
"sez": 1,
"mon": "200.000",
"bank": """ + str(rez['57xxxxx']) + """,
"link": """ + link + """
}"""
datass = filee.write(data2)
filee.close()
def savebd():
with open("value.txt", "w") as file:
for i in data:
p = str(i) + " " +str(data[i]["name"]) +" " +str(data[i]["money"])+ " " +str(data[i]["messegNumb"])
file.write(p + '\n')
rez = 0
def loadbd():
file = open("value.txt","r")
datas= file.read()
datas = datas.splitlines()
file.close()
data = {}
for i in datas:
i = i.split()
if len(i)>3:
data[str(i[0])] = {}
data[str(i[0])]["name"] = i[1]
data[str(i[0])]["money"] = i[2]
data[str(i[0])]["messegNumb"] = i[3]
return(data)
data = loadbd()
for event in longpol.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
rez = merchant.get_balance(5783xxxxx)
id = event.user_id
body = event.text
n = 0
for i in data:
if str(id) == i :
n = 1
if n == 0:
construct(id , id , 0,)
merchant.set_shop_name(name="max")
link=merchant.get_payment_url(amount=200000000, payload=78xxx, free_amount=False)
print("hjj")
savelink()
savebd()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question