Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 149.38 KB | None | 0 0
  1. yester = 10000000
  2. from threading import Thread
  3. import requests
  4. import vk_api
  5. import schedule
  6. import random
  7. import time
  8. from time import sleep
  9. import datetime
  10. import json
  11. import re
  12. api_access_token = 'киви, делал для теста, позже хочу добавить автодонат' # токен можно получить здесь https://qiwi.com/api
  13. my_login = '' # номер QIWI Кошелька в формате +79991112233
  14. from vk_api.keyboard import VkKeyboard, VkKeyboardColor
  15. from vk_api.utils import get_random_id
  16. vk_session = vk_api.VkApi(token = 'apitoken')
  17. a = 0
  18. from vk_api.longpoll import VkLongPoll, VkEventType
  19. longpoll = VkLongPoll(vk_session)
  20. vk = vk_session.get_api()
  21. last_pend = 0
  22. print(vk_api.__version__)
  23. session = requests.Session()
  24. login, password = 'login', 'password'
  25. vk_session1 = vk_api.VkApi(login, password)
  26. try:
  27.     vk_session1.auth(token_only=True)
  28. except vk_api.AuthError as error_msg:
  29.     print(error_msg)
  30. vk1 = vk_session1.get_api()
  31. idcurr = 1107
  32. daykomis = 0
  33. hel = ['Если бот не отвечает на сообщения, это может значить что он временно выключен либо производит рассылку и ответит на все сообщения немного позже, поэтому не стоит флудить', 'Если вы нашли баг, то гораздо лучше сообщить о нём в обсуждении https://vk.com/topic-187194307_44119500 и получить игровую валюту, чем получить наказание за багоюз','Основная беседа бота находится по ссылке - https://vk.me/join/AJQ1d9fX/hUEYTFwkq81PeWW', 'Полная статья с функционалом бота находится по ссылке - https://vk.cc/arYKYv','О всех багах можно сообщать в обсуждение группы - https://vk.com/topic-187194307_44119500', 'Каждый день в 12:00 в группе проходит автоконкурс за лайк', 'О любых идеях, связанных с ботом вы можете сообщать разработчику - @lionead. Хорошие идеи хорошо оплачиваются игровой валютой😉', 'Все средства с доната идут на развитие группы и конкурсы']
  34. def job():
  35.     print("I'm working...")
  36. with open("konk.txt") as file:
  37.                         array = [row.strip() for row in file]
  38. def group(iterable, count):
  39.     """ Группировка элементов последовательности по count элементов """
  40.     return zip(*[iter(iterable)] * count)
  41. ar = array[0].split(' ')
  42. idcurr = int(ar[0])
  43. daykomis = int(ar[1])
  44. yester = int(ar[2])
  45. schedule.every(10).seconds.do(job)
  46. def grop(ar, N):
  47.     subList = [ar[n:n+N] for n in range(0, len(ar), N)]
  48.     return subList
  49. ###print(grop(hel, 4))
  50. def des(inputInt):
  51.     int(float(str(inputInt)))
  52.     try:
  53.      if not inputInt == 0:
  54.         return str('{0:,}'.format(int(inputInt)).replace(',',"."))
  55.      else:
  56.         return '0'
  57.     except:
  58.         pass
  59. vk.messages.send(user_id=294716376, attachment = 'photo-187194307_457239385', random_id=random.randint(1,999999))
  60. def konkurs():
  61.  try:
  62.   with open("test.txt") as file:
  63.                         array = [row.strip() for row in file]
  64.   global idcurr, daykomis, yester
  65.   all1 = vk1.likes.getList(type = 'post', owner_id = -187194307, item_id = idcurr, filter = 'likes', count = 1000)
  66.   prize = int(yester/int(all1['count']))
  67.   ####print(prize)
  68.   winner = all1['items']
  69.   ####print(winner)
  70.   for elem in array:
  71.      if int(elem.split(' ')[0]) in winner:
  72.       ####print('FFF')
  73.       try:
  74.         try:
  75.                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(prize))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  76.         except:
  77.                                         try:
  78.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(prize))+' '+elem.split(' ')[2]
  79.                                         except:
  80.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(prize))+' 1'
  81.         try:
  82.             vk.messages.send(user_id = elem.split(' ')[0], message = 'Спасибо за участие в конкурсе! Вы получили '+des(prize)+'$', random_id = time.time())
  83.         except:
  84.             pass
  85.       except:
  86.           pass
  87.   ####print('FFFFFFFFFFFF')
  88.   idcurr1 = vk1.wall.post(owner_id = -187194307, from_group = 1, message = 'Ежедневный конкурс! Разыгрывается '+des(daykomis)+'$ между каждым лайкнувшим, т.е. приз будет разделён между всеми людьми!\nИтоги через 24 часа, если у вас закрыто лс - вы не получите приз.', attachment = 'photo-187194307_457239385')
  89.   idcurr = idcurr1['post_id']
  90.   yester = daykomis
  91.   daykomis = 0
  92.   with open("test.txt", "w") as file:
  93.                      for line in array:
  94.                         file.write(str(line)+"\n")
  95.  except Exception as e:
  96.      ####print(e)
  97.      vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  98.  
  99. schedule.every().monday.at('09:00').do(konkurs)
  100. schedule.every().tuesday.at('09:00').do(konkurs)
  101. schedule.every().wednesday.at('09:00').do(konkurs)
  102. schedule.every().thursday.at('09:00').do(konkurs)
  103. schedule.every().friday.at('09:00').do(konkurs)
  104. schedule.every().saturday.at('09:00').do(konkurs)
  105. schedule.every().sunday.at('09:00').do(konkurs)
  106. vip = ['275164129','522095175','478474482','294716376','522858164','405098233', '297476508']
  107. def mone(inputStr):
  108.         return (int(inputStr[1]))
  109. #def f():
  110.  
  111. farms6 = {'RX590':[120000, 9000], 'GTX1660TI':[340000, 21000], 'RTX2080SUPER':[40000000, 1030000]}
  112. def f():
  113.  global idcurr, daykomis, yester, hel, last_pend
  114.  phr = ['🤖 Буп боп. Буп бип?', '🤖 Сложно! Я же просто бот.', '🤖 Моя твоя не понимать.', '🤖 Может когда-то я научусь понимать язык людей...', '🤖 Может уже скажешь мне команду?']
  115.  stickers = [16788, 16935, 18670, 18650, 17629, 8018, 7677, 13897]
  116.  while True:
  117.   try:
  118.    for event in longpoll.listen():
  119.     uu = ''
  120.     ####print('e')
  121.     if event.to_me and event.type == VkEventType.MESSAGE_NEW and event.user_id == 581870894:
  122.         vk.messages.send(user_id=294716376, forward_messages = event.message_id, random_id=random.randint(1,999999))
  123.     if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
  124.  
  125.      if True:
  126.         main_mess = ''
  127.         if 'Бот]' in event.text:
  128.          try:
  129.             main_mess=event.text.casefold().split('бот] ',1)[1]
  130.          except:
  131.             pass
  132.         elif '@' in event.text:
  133.             try:
  134.              main_mess=event.text.casefold().split(' ',1)[1]
  135.             except:
  136.              pass
  137.         else:
  138.             try:
  139.              main_mess=event.text.casefold()
  140.             except:
  141.              pass
  142.         random.seed(time.time())
  143.  
  144.         keyboard = VkKeyboard(inline = True)
  145.         keyboard.add_button('Меню', color=VkKeyboardColor.POSITIVE)
  146.         if not event.user_id == last_pend:
  147.             u = ''
  148.             nick = ''
  149.             with open("test.txt") as file:
  150.                             array = [row.strip() for row in file]
  151.             nick = vk.users.get(user_ids=event.user_id)[0]['first_name']
  152.             for elem in array:
  153.                             if elem.split(' ')[0]==str(event.user_id):
  154.                                 try:
  155.                                     nick = elem.split(' ')[3]
  156.                                 except:
  157.                                     pass
  158.             u = nick+', '
  159.             isnew=False
  160.             with open("test.txt") as file:
  161.                 array = [row.strip() for row in file]
  162.             ####print(array)
  163.             for elem in array:
  164.                     if elem.split(' ')[0]==str(event.user_id):
  165.                       isnew=True
  166.             if isnew==False:
  167.                 with open("test.txt", "a") as file:
  168.                     file.write(str(event.user_id)+' '+str(1000) + ' 1\n')
  169.                 keyboard = VkKeyboard(one_time=False)
  170.                 with open("bonus.txt") as file:
  171.                     array = [row.strip() for row in file]
  172.                 ####print(array)
  173.                 posi = False
  174.                 keyboard.add_button('VIP-Бонус', color=VkKeyboardColor.POSITIVE)
  175.                 keyboard.add_line()
  176.                 for elem in array:
  177.                     if elem.split(' ')[0]==str(event.user_id):
  178.                        flag = True
  179.                        if int(int(elem.split(' ')[1])+86400)<=int(time.time()):
  180.                             keyboard.add_button('Бонус', color=VkKeyboardColor.POSITIVE)
  181.                             keyboard.add_line()
  182.                             posi = True
  183.                 if posi == False:
  184.                     keyboard.add_button('Бонус', color=VkKeyboardColor.NEGATIVE)
  185.                     keyboard.add_line()
  186.                 keyboard.add_button('💰Баланс', color=VkKeyboardColor.POSITIVE)
  187.                 keyboard.add_button('🎰Казино', color=VkKeyboardColor.POSITIVE)
  188.                 keyboard.add_line()
  189.                 keyboard.add_button('🔐Сейф', color=VkKeyboardColor.POSITIVE)
  190.                 keyboard.add_button('&#129371;Стаканчик', color=VkKeyboardColor.POSITIVE)
  191.                 keyboard.add_line()
  192.                 keyboard.add_button('Комиссия', color=VkKeyboardColor.POSITIVE)
  193.                 keyboard.add_line()
  194.  
  195.                 keyboard.add_button('Передать', color=VkKeyboardColor.POSITIVE)
  196.                 keyboard.add_line()
  197.                 keyboard.add_button('&#127380;Узнать мой ID', color=VkKeyboardColor.NEGATIVE)
  198.                 keyboard.add_button('&#127380;Узнать ID по ссылке', color=VkKeyboardColor.NEGATIVE)
  199.                 keyboard.add_line()
  200.                 keyboard.add_button('🔝Топ игроков', color=VkKeyboardColor.NEGATIVE)
  201.                 keyboard.add_button('🔝Топ сейфов', color=VkKeyboardColor.NEGATIVE)
  202.                 keyboard.add_line()
  203.                 keyboard.add_button('&#9881;Настройки', color=VkKeyboardColor.PRIMARY)
  204.                 vk.messages.send  (peer_id = event.peer_id,message = 'Welcome! +1.000$\n\n Приветствуем! Так как вы новый пользователь, вы будете автоматически получать рассылки. Чтобы отключить их, перейдите в меню, а затем в настройки. Желаем удачи!\nКроме того, рекомендуем ознакомиться с полезной статьей для новичков - https://vk.cc/arYKYv', random_id = random.randint(1, 99999999),keyboard=keyboard.get_keyboard(),attachment = 'photo-187194307_457239414')
  205.         if  main_mess== '💰баланс' or main_mess == 'баланс':
  206.             with open("test.txt") as file:
  207.                 array = [row.strip() for row in file]
  208.             for elem in array:
  209.                 if elem.split(' ')[0]==str(event.user_id):
  210.                  keyboard = VkKeyboard(inline = True)
  211.  
  212.                  keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  213.                  vk.messages.send  (peer_id = event.peer_id,message = u+'ваш баланс - ' + des(elem.split(' ')[1])+"$",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  214.         elif main_mess=='🆔узнать мой id':
  215.             keyboard = VkKeyboard(inline=True)
  216.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  217.             vk.messages.send  (peer_id = event.peer_id,message = u+'&#127380;Ваш ID ВКонтакте - '+str(event.user_id),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  218.         elif main_mess=='комиссия':
  219.             keyboard = VkKeyboard(inline=True)
  220.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  221.             vk.messages.send  (peer_id = event.peer_id,message = u+'накоплено за сутки - '+str(des(daykomis))+'$\n\n&#10067;Что такое комиссия? Она копится за счёт казино. Ровно в 12:00 по МСК каждый день проводится автоконкурс со средств комиссии в течение суток, где все лайкнувшие делят между собой приз&#128123;\n&#10036;У людей с VIP-статусом комиссия снижена в 2 раза.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  222.         elif main_mess=='стат':
  223.             with open("test.txt") as file:
  224.                         array = [row.strip() for row in file]
  225.             non_all = 0
  226.             for elem in array:
  227.                 if elem.split(' ')[2] == '0':
  228.                     non_all = non_all + 1
  229.             vk.messages.send(peer_id = event.peer_id, message = 'Количество всех диалогов - '+str(vk.messages.getConversations(offset = 0, count = 0, filter= "all")['count'])+'\nКоличество пользователей, написавших со старта бота - '+str(len(array))+'\nКол-во людей, запретивших рассылки (без учёта закрытого лс) - '+str(non_all)+'\nРазрешивших рассылки - '+str(len(array)-non_all),random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  230.            #2000000000
  231.         elif main_mess=='фермы':
  232.             keyboard = VkKeyboard(inline = True)
  233.             keyboard.add_button('Ферма RX590', color=VkKeyboardColor.POSITIVE)
  234.             keyboard.add_line()
  235.             keyboard.add_button('Ферма GTX1660TI', color=VkKeyboardColor.POSITIVE)
  236.             keyboard.add_line()
  237.             keyboard.add_button('Ферма RTX2080SUPER', color=VkKeyboardColor.POSITIVE)
  238.             vk.messages.send(peer_id = event.peer_id, message = 'Доступные для покупки фермы:\n1. RX590. Цена - 120.000$. Доход - 9.000$/час\n2. GTX1660TI. Цена - 340.000$. Доход - 21.000$/час\n2. RTX2080SUPER. Цена - 40.000.000$. Доход - 1.030.000$/час.\n Купить фермы можно с помощью команды ферма [Точное Название] [Количество]',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  239.         elif main_mess=='ферма':
  240.             with open("test.txt") as file:
  241.                         array = [row.strip() for row in file]
  242.             with open("farms.txt") as file:
  243.                         array1 = [row.strip() for row in file]
  244.             flag = False
  245.             for elem in array1:
  246.                 if elem.split(' ')[0] == str(event.user_id):
  247.                     keyboard = VkKeyboard(inline = True)
  248.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  249.                     keyboard.add_line()
  250.                     keyboard.add_button('Продать фермы', color=VkKeyboardColor.POSITIVE)
  251.                     flag = True
  252.                     farm = elem.split(' ')[1]
  253.                     dohod = farms6[farm][1]
  254.                     cnt = int(elem.split(' ')[2])
  255.                     #datetime.timedelta(seconds = delta)
  256.                     nakop = int((int(time.time())-int(elem.split(' ')[3]))/3600*dohod*cnt)
  257.                     if 3600 - (int(time.time())-int(elem.split(' ')[3]))>=0:
  258.                         vk.messages.send(peer_id = event.peer_id, message = 'Накоплено на ферме - '+str(des(nakop))+'$. Ваша ферма - '+farm+'[x'+str(cnt)+']\nДо вывода осталось '+str(datetime.timedelta(seconds = 3600 - (int(time.time())-int(elem.split(' ')[3]))))+'.',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  259.                     else:
  260.                         keyboard.add_line()
  261.                         keyboard.add_button('Снять деньги', color=VkKeyboardColor.POSITIVE)
  262.                         vk.messages.send(peer_id = event.peer_id, message = 'Накоплено на ферме - '+str(des(nakop))+'$. Ваша ферма - '+farm+'[x'+str(cnt)+']\nМожно совершить вывод!',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  263.             #if not flag:
  264.                 #keyboard = VkKeyboard(inline = True)
  265.                # keyboard.add_button('Фермы', color=VkKeyboardColor.POSITIVE)
  266.                # vk.messages.send(peer_id = event.peer_id, message = 'Биткоин фермы позволяют зарабатывать деньги пассивно! Попробуй:',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  267.  
  268.         elif 'снять деньги' in main_mess:
  269.             with open("test.txt") as file:
  270.                         array = [row.strip() for row in file]
  271.             with open("farms.txt") as file:
  272.                         array1 = [row.strip() for row in file]
  273.             flag = False
  274.             for elem in array1:
  275.                 if elem.split(' ')[0] == str(event.user_id):
  276.                  for elem1 in array:
  277.                   if elem1.split(' ')[0] == str(event.user_id):
  278.                    if int(time.time())-int(elem.split(' ')[3])>=3600:
  279.                     keyboard = VkKeyboard(inline = True)
  280.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  281.                     flag = True
  282.                     farm = elem.split(' ')[1]
  283.                     dohod = farms6[farm][1]
  284.                     cnt = int(elem.split(' ')[2])
  285.                     #datetime.timedelta(seconds = delta)
  286.                     nakop = int((int(time.time())-int(elem.split(' ')[3]))/3600*dohod*cnt)
  287.                     cena = nakop
  288.                     try:
  289.                                         array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' '+elem1.split(' ')[2]+' '+elem1.split(' ')[3]
  290.                     except:
  291.                                         try:
  292.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' '+elem1.split(' ')[2]
  293.                                         except:
  294.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' 1'
  295.                     array1[array1.index(elem)] = elem.split(' ')[0] + ' '+elem.split(' ')[1]+' '+elem.split(' ')[2]+' '+str(int(time.time()))
  296.                     vk.messages.send  (peer_id = event.peer_id,message = 'Вы сняли '+str(des(nakop))+'$ с фермы '+elem.split(' ')[1]+'[x'+elem.split(' ')[2]+']', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  297.                    else:
  298.                        keyboard = VkKeyboard(inline = True)
  299.                        keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  300.                        delta = 3600-(int(time.time())-int(elem.split(' ')[3]))
  301.                        vk.messages.send  (peer_id = event.peer_id,message = 'Подождите ещё '+str(datetime.timedelta(seconds = delta))+' до следющего снятия денег с фермы!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  302.             with open("test.txt", "w") as file:
  303.                      for line in array:
  304.                         file.write(str(line)+"\n")
  305.             with open("farms.txt", "w") as file:
  306.                      for line in array1:
  307.                         file.write(str(line)+"\n")
  308.         elif main_mess=='продать фермы':
  309.             with open("test.txt") as file:
  310.                         array = [row.strip() for row in file]
  311.             with open("farms.txt") as file:
  312.                         array1 = [row.strip() for row in file]
  313.             for elem1 in array1:
  314.                 if elem1.split(' ')[0] == str(event.user_id):
  315.                     cena = int(int(farms6[elem1.split(' ')[1]][0])*int(elem1.split(' ')[2])/3*2)
  316.                     del array1[array1.index(elem1)]
  317.                     for elem in array:
  318.                         if elem.split(' ')[0] == str(event.user_id):
  319.  
  320.                                     try:
  321.                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  322.                                     except:
  323.                                         try:
  324.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' '+elem.split(' ')[2]
  325.                                         except:
  326.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' 1'
  327.                                     vk.messages.send(peer_id = event.peer_id,message = 'Вы успешно продали фермы за '+str(cena)+'$', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  328.             with open("test.txt", "w") as file:
  329.                      for line in array:
  330.                         file.write(str(line)+"\n")
  331.             with open("farms.txt", "w") as file:
  332.                      for line in array1:
  333.                         file.write(str(line)+"\n")
  334.         elif 'ферма' in main_mess:
  335.          if 0>1:
  336.             with open("test.txt") as file:
  337.                         array = [row.strip() for row in file]
  338.             with open("farms.txt") as file:
  339.                         array1 = [row.strip() for row in file]
  340.             keyboard = VkKeyboard(inline = True)
  341.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  342.             flag = False
  343.             try:
  344.                 if event.text.split(' ')[1] in farms6:
  345.                     for elem in array:
  346.                         if elem.split(' ')[0] == str(event.user_id):
  347.                             for elem1 in array1:
  348.                                 if elem1.split(' ')[0] == str(event.user_id):
  349.                                     flag = True
  350.                                     if not elem1.split(' ')[1] == event.text.split(' ')[1]:
  351.                                         vk.messages.send  (peer_id = event.peer_id,message = 'У вас уже имеется ферма - '+elem1.split(' ')[1]+'[x'+elem1.split(' ')[2]+']\nВы можете докупить ещё или продать их с командой "Продать фермы"', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  352.                             if not flag:
  353.                              if farms6[event.text.split(' ')[1]][0]*int(main_mess.split(' ')[2])<=int(elem.split(' ')[1]):
  354.                                 cena = farms6[event.text.split(' ')[1]][0]*int(main_mess.split(' ')[2])
  355.                                 try:
  356.                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  357.                                 except:
  358.                                         try:
  359.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' '+elem.split(' ')[2]
  360.                                         except:
  361.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' 1'
  362.                                 try:
  363.                                     if main_mess.split(' ')[2].isdigit():
  364.                                         cnt = int(main_mess.split(' ')[2])
  365.                                     else:
  366.                                         cnt = 1
  367.                                 except:
  368.                                     cnt = 1
  369.                                 array1.append(str(event.user_id)+' '+event.text.split(' ')[1]+' '+str(cnt)+' '+str(int(time.time())))
  370.                                 vk.messages.send  (peer_id = event.peer_id,message = 'Вы приобрели ферму '+event.text.split(' ')[1]+'[x'+str(cnt)+']', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  371.                              else:
  372.                                  vk.messages.send  (peer_id = event.peer_id,message = 'Недостаточно средств для покупки!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  373.  
  374.                             if flag:
  375.                                 for elem1 in array1:
  376.                                     if elem1.split(' ')[0] == str(event.user_id):
  377.                                         if event.text.split(' ')[1] == elem1.split(' ')[1]:
  378.                                             if farms6[event.text.split(' ')[1]][0]<=int(elem.split(' ')[1]):
  379.                                                 cena = farms6[event.text.split(' ')[1]][0]
  380.                                                 ar9 = 0
  381.                                                 try:
  382.                                                     if main_mess.split(' ')[2].isdigit():
  383.                                                         cnt = int(elem1.split(' ')[2])+int(main_mess.split(' ')[2])
  384.                                                         ar9=main_mess.split(' ')[2]
  385.                                                     else:
  386.                                                         ar9 = 1
  387.                                                         cnt = int(elem1.split(' ')[2])+1
  388.                                                 except:
  389.                                                     ar9=1
  390.                                                     cnt = int(elem1.split(' ')[2])+1
  391.                                                 try:
  392.                                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  393.                                                 except:
  394.                                                         try:
  395.                                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' '+elem.split(' ')[2]
  396.                                                         except:
  397.                                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(cena))+' 1'
  398.  
  399.                                                 array1[array1.index(elem1)] = str(str(event.user_id)+' '+event.text.split(' ')[1]+' '+str(cnt)+' '+str(int(time.time())))
  400.                                                 vk.messages.send  (peer_id = event.peer_id,message = 'Вы приобрели ферму '+event.text.split(' ')[1]+'[x'+str(ar9)+']', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  401.                                             else:
  402.                                                 vk.messages.send  (peer_id = event.peer_id,message = 'Недостаточно средств для покупки!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  403.  
  404.                     with open("test.txt", "w") as file:
  405.                      for line in array:
  406.                         file.write(str(line)+"\n")
  407.                     with open("farms.txt", "w") as file:
  408.                      for line in array1:
  409.                         file.write(str(line)+"\n")
  410.             except:
  411.                 pass
  412.         elif 'передать' in main_mess and main_mess.split(' ')[0]=='передать':
  413.             exc = False
  414.             try:
  415.                 keyboard = VkKeyboard(inline=True)
  416.                 keyboard.add_button('Меню', color=VkKeyboardColor.POSITIVE)
  417.                 to_id = main_mess.split(' ')[1]
  418.                 if to_id.isdigit():
  419.                     pass
  420.                 elif '@' in to_id:
  421.                     ####print(to_id.split('@'))
  422.                     e = vk.users.get(user_ids = to_id.split('@')[1].split(']')[0])
  423.                     ####print(e)
  424.                     ####print(to_id.split('@')[1].split(']'))
  425.                     to_id = str(e[0]['id'])
  426.                     ####print(to_id)
  427.                 else:
  428.                     try:
  429.                         e1 = to_id.split('com/')[1]
  430.                         e = vk.users.get(user_ids = e1)
  431.                         to_id = str(e[0]['id'])
  432.                     except:
  433.                         vk.messages.send  (peer_id = event.peer_id,message = 'Введите корректную ссылку!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  434.                         exc = True
  435.                 ####print(to_id)
  436.                 sum=''
  437.                 try:
  438.                     sum1 = main_mess.split(' ')[2]
  439.                 except:
  440.                     pass
  441.                 try:
  442.                   if 'к' in sum1:
  443.                     cnt = sum1.count('к')
  444.                     sum = str(int(re.findall ('(\d+)', sum1)[0])* 1000**cnt)
  445.                   else:
  446.                       sum = str(main_mess.split(' ')[2])
  447.                       #print(sum)
  448.                 except:
  449.                   if 'к' in sum1:
  450.                     cnt = sum1.count ('к')
  451.                     sum = str(1000**cnt)
  452.                   else:
  453.                       sum = main_mess.split(' ')[2]
  454.                 if event.user_id == int(to_id):
  455.                     vk.messages.send  (peer_id = event.peer_id,message = 'Нельзя передать деньги самому себе.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard(),attachment = 'photo-187194307_457239442')
  456.                     exc = True
  457.                 flag = False
  458.                 if sum.isdigit():
  459.                  if int(sum)>0:
  460.                     with open("test.txt") as file:
  461.                         array = [row.strip() for row in file]
  462.                     for elem in array:
  463.                         if elem.split(' ')[0]==str(event.user_id):
  464.                          if int(elem.split(' ')[1])>=int(sum):
  465.                             for elem1 in array:
  466.                                 if elem1.split(' ')[0]==to_id:
  467.                                     flag = True
  468.                                     try:
  469.                                         array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(sum))+' '+elem1.split(' ')[2]+' '+elem1.split(' ')[3]
  470.                                     except:
  471.                                         try:
  472.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(sum))+' '+elem1.split(' ')[2]
  473.                                         except:
  474.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(sum))+' 1'
  475.                                     try:
  476.                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(sum))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  477.                                     except:
  478.                                         try:
  479.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(sum))+' '+elem.split(' ')[2]
  480.                                         except:
  481.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])-int(sum))+' 1'
  482.                                     try:
  483.                                         if elem1.split(' ')[4] == '1':
  484.                                             vk.messages.send  (user_id = int(to_id),message = '[id'+str(event.user_id)+'|Пользователь] передал вам '+des(sum)+'$!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  485.                                     except:
  486.                                         vk.messages.send  (user_id = int(to_id),message = '[id'+str(event.user_id)+'|Пользователь] передал вам '+des(sum)+'$!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  487.                                     vk.messages.send  (peer_id = event.peer_id,message = 'Успешно. Передано '+des(sum)+'$ [id'+to_id+'|игроку].', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  488.                          else:
  489.                              vk.messages.send  (peer_id = event.peer_id,message = 'Недостаточно средств. Ваш баланс - '+elem.split(' ')[1]+'$.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  490.                              exc = True
  491.                     with open("test.txt", "w") as file:
  492.                         for line in array:
  493.                             file.write(str(line)+"\n")
  494.                     if flag == False:
  495.                      if not exc:
  496.                         vk.messages.send  (peer_id = event.peer_id,message = 'Данный пользователь не найден.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  497.                         exc = True
  498.                  else:
  499.                     if not exc:
  500.                      vk.messages.send  (peer_id = event.peer_id,message = 'Минимальная сумма - 1$.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  501.                      exc = True
  502.                 else:
  503.                   if not exc:
  504.                     vk.messages.send  (peer_id = event.peer_id,message = 'Введите корректную сумму!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  505.                     exc = True
  506.             except:
  507.               if not exc:
  508.                 vk.messages.send  (peer_id = event.peer_id,message = 'Использование команды - Передать [id пользователя ИЛИ ссылка] [сумма]. Пример - Передать vk.com/lionead 600.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  509.  
  510.         elif 'id' in main_mess:
  511.             try:
  512.                 scr = str(main_mess.split(' ')[1])
  513.                 if not '/' in scr:
  514.                     e = vk.users.get(user_ids = scr)
  515.                     keyboard = VkKeyboard(inline=True)
  516.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  517.                     vk.messages.send  (peer_id = event.peer_id,message = u+'ID Пользователя - ' + str(e[0]['id']),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  518.                 else:
  519.                     e1 = scr.split('com/')[1]
  520.                     e = vk.users.get(user_ids = e1)
  521.                     keyboard = VkKeyboard(inline=True)
  522.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  523.                     vk.messages.send  (peer_id = event.peer_id,message = u+'ID Пользователя - ' + str(e[0]['id']),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  524.             except:
  525.                 keyboard = VkKeyboard(inline=True)
  526.                 keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  527.                 vk.messages.send  (peer_id = event.peer_id,message = u+'использование команды: ID [Ссылка]',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  528.         elif main_mess.split(' ')[0]=='никнейм' or main_mess.split(' ')[0]=='ник':
  529.             new = ''
  530.             try:
  531.                 text = event.text.split('] ')[1]
  532.             except:
  533.                 text = event.text
  534.             try:
  535.                 new = text.split(' ')[1]
  536.             except:
  537.                 pass
  538.             with open("test.txt") as file:
  539.                         array = [row.strip() for row in file]
  540.             if len(new)<16:
  541.                 for elem in array:
  542.                         if elem.split(' ')[0]==str(event.user_id):
  543.                             if new == '':
  544.                              nick = ''
  545.                              try:
  546.                                 nick = elem.split(' ')[3]
  547.                                 vk.messages.send  (peer_id = event.peer_id,message = 'Ваш текущий никнейм - '+nick+'.\nСменить никнейм можно командой "Никнейм [Новый никнейм без пробелов]"',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  548.                              except:
  549.                                 vk.messages.send  (peer_id = event.peer_id,message = u+'установи свой никнейм с помощью команды! Пример - "Никнейм Василий"',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  550.                             if not new == '':
  551.                                 try:
  552.                                     array[array.index(elem)]=elem.split(' ')[0] + ' '+elem.split(' ')[1]+' '+elem.split(' ')[2]+' '+new
  553.                                 except:
  554.                                     array[array.index(elem)]=elem.split(' ')[0] + ' '+elem.split(' ')[1]+' 1 '+new
  555.                                 vk.messages.send  (peer_id = event.peer_id,message = 'Никнейм установлен.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  556.             else:
  557.                 vk.messages.send  (peer_id = event.peer_id,message = 'Максимальная длина никнейма - 16 символов!',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  558.             with open("test.txt", "w") as file:
  559.                     for line in array:
  560.                         file.write(str(line)+"\n")
  561.             last_pend = -1
  562.         elif 'стаканчик' in main_mess:
  563.             try:
  564.                 sum=''
  565.                 try:
  566.                     sum1 = main_mess.split(' ')[1]
  567.                 except:
  568.                     pass
  569.                 try:
  570.                   if 'к' in sum1:
  571.                     cnt = sum1.count ('к')
  572.                     sum = str(int(re.findall ('(\d+)', sum1)[0])* 1000**cnt)
  573.                   else:
  574.                       sum = str(main_mess.split(' ')[1])
  575.                       #print(sum)
  576.                 except:
  577.                   if 'к' in sum1:
  578.                     cnt = sum1.count ('к')
  579.                     sum = str(1000**cnt)
  580.                   else:
  581.                       sum = main_mess.split(' ')[1]
  582.                 usnum = main_mess.split(' ')[2]
  583.                 with open("test.txt") as file:
  584.                         array = [row.strip() for row in file]
  585.                 for elem in array:
  586.                         if elem.split(' ')[0]==str(event.user_id):
  587.                             if int(elem.split(' ')[1])>=int(sum):
  588.                              if int(sum)>0:
  589.                                 randnum = random.randint(1,3)
  590.                                 if randnum == int(usnum):
  591.                                     try:
  592.                                         uu = elem.split(' ')[3]
  593.                                     except:
  594.                                         pass
  595.                                     try:
  596.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])+int(sum)*2) +' '+elem.split(' ')[2]+' '+uu
  597.                                     except:
  598.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])+int(sum)*2) +' 1'+' '+uu
  599.                                     keyboard = VkKeyboard(inline=True)
  600.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])+int(sum)*2))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  601.                                     vk.messages.send (peer_id = event.peer_id, message = u+'поздравляем, вы угадали! +'+des(int(sum)*2)+'$&#128522;\n\nВаш баланс - '+des(int(int(elem.split(' ')[1])+int(sum)*2))+'$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999),attachment = 'photo-187194307_457239419')
  602.                                     sleep(0.03)
  603.  
  604.                                 elif not randnum == int(usnum):
  605.                                     try:
  606.                                         uu = elem.split(' ')[3]
  607.                                     except:
  608.                                         pass
  609.                                     try:
  610.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])-int(sum)) +' '+elem.split(' ')[2]+' '+uu
  611.                                     except:
  612.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])-int(sum)) +' 1'+' '+uu
  613.                                     keyboard = VkKeyboard(inline=True)
  614.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])-int(sum)))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  615.                                     keyboard.add_line()
  616.                                     keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  617.                                     vk.messages.send (peer_id = event.peer_id, message = u+'не повезло. -'+des(sum)+'$&#128532;\n\nВаш баланс - '+des(int(int(elem.split(' ')[1])-int(sum)))+'$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999),attachment = 'photo-187194307_457239413')
  618.                                     sleep(0.03)
  619.  
  620.                              else:
  621.                                 keyboard = VkKeyboard(inline=True)
  622.                                 if not int(elem.split(' ')[1]) == 0:
  623.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  624.                                 keyboard.add_line()
  625.                                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  626.                                 vk.messages.send(peer_id = event.peer_id, message = u+"минимальная ставка - 1$!", random_id = random.randint(1,999999), keyboard = keyboard.get_keyboard())
  627.                             else:
  628.                                 keyboard = VkKeyboard(inline=True)
  629.                                 keyboard.add_line()
  630.                                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  631.                                 if not int(elem.split(' ')[1]) == 0:
  632.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  633.                                 vk.messages.send(peer_id = event.peer_id, message = u+"на балансе недостаточно средств!", random_id = random.randint(1,999999), keyboard = keyboard.get_keyboard())
  634.                 with open("test.txt", "w") as file:
  635.                     for line in array:
  636.                         file.write(str(line)+"\n")
  637.             except:
  638.                 with open("test.txt") as file:
  639.                         array = [row.strip() for row in file]
  640.                 for elem in array:
  641.                         if elem.split(' ')[0]==str(event.user_id):
  642.                                 keyboard = VkKeyboard(inline=True)
  643.                                 if not int(elem.split(' ')[1]) == 0:
  644.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  645.                                 else:
  646.                                     keyboard.add_button('&#128219;Недостаточно средств&#128219;', color=VkKeyboardColor.NEGATIVE)
  647.                                 keyboard.add_line()
  648.                                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  649.                                 vk.messages.send (peer_id = event.peer_id, message = u+'использование команды - стаканчик [сумма] [номер стаканчика]\n Пример: "Стаканчик 5000 2" \n\n Угадай номер стаканчика с шариком и утрой свои деньги&#129371;&#128181;\n Примечание: если у вас на балансе недостаточно средств, поставить не получится. Минимальная ставка - 1$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999), attachment = 'photo-187194307_457239418')
  650.                                 vk.messages.send(
  651.                                     peer_id = event.peer_id,
  652.                                     random_id=get_random_id(),
  653.                                     sticker_id = 735
  654.                                 )
  655.         elif main_mess=='🔝топ сейфов':
  656.             with open("safes.txt") as file:
  657.                 array = [row.strip() for row in file]
  658.             new = []
  659.             for elem in array:
  660.                 try:
  661.                     new.append(elem.split(' '))
  662.                 except:
  663.                     pass
  664.             ####print(int)
  665.             new.sort(key = mone, reverse = True)
  666.             keyboard = VkKeyboard(inline=True)
  667.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  668.             a = ""
  669.             ####print(vk.users.get(user_ids='2,3,4'))
  670.             all_usr= "0"
  671.             for i in range(10):
  672.                 all_usr = all_usr +','+ str(new[i][0])
  673.             ####print(all_usr)
  674.             bal = vk.users.get(user_ids=all_usr)
  675.             try:
  676.              for i in range(10):
  677.                 add = ''
  678.                 if str(new[i][0]) in vip:
  679.                     add = '༺VIP༻'
  680.                 if str(new[i][0]) == str('294716376'):
  681.                     add = '༺Ă ͏̷̬̝̲̳̲͑͆͆̀̃̍Ď ̵̷̡̡̛̥̠͙̤̥͓̥͇̟͇̯̜̭̝̝̗͉̫̱̝͌̅̋͂̀̌̉̌̑̉̇͒̃͑͌̍̉̀̒̚͜͜͡ͅМ ̧͓̝͈͛̆͢͡͝Ĩ ̷̨̮̫̲͇̩̥̂̄͒͂̒͌̈̈͒̃̈́̑̿̉̕͝͠͞Ń ̵̨̘̝̤̯̣̂́̀̒̾͛͒̒̏̓̕͘͝ͅͅ༻'
  682.                 try:
  683.                     a = a + str((str(i+1)+'. '+add+'[id'+str(new[i][0])+'|'+bal[i]['first_name']+' '+bal[i]['last_name']+'] - ' + des(new[i][1]) +'&#128275;\n'))
  684.                 except:
  685.                     pass
  686.             except:
  687.                 pass
  688.             vk.messages.send  (peer_id = event.peer_id,message = u+'топ взломщиков сейфов:\n'+a,keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  689.         elif '🔐сейф' in main_mess or 'сейф' in main_mess:
  690.             try:
  691.              usnum = main_mess.split(' ')[1]
  692.              if int(usnum)>0 and int(usnum)<101:
  693.                 truenum = random.randint(1,100)
  694.                 keyboard = VkKeyboard(inline=True)
  695.                 keyboard.add_button('Сейф ' + str(random.randint(1,100)), color=VkKeyboardColor.POSITIVE)
  696.                 keyboard.add_line()
  697.                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  698.                 if truenum == int(usnum):
  699.                     sum = random.randint(0,200000)
  700.                     vk.messages.send (peer_id = event.peer_id, message = u+'нииичоси! Повезло так повезло&#128561; Вы получаете '+des(sum)+'$!' , random_id = random.randint(1,999999), attachment = 'photo-187194307_457239416')
  701.                     vk.messages.send (peer_id = event.peer_id, sticker_id = 7377,keyboard=keyboard.get_keyboard(), random_id = random.randint(1,999999))
  702.                     with open("test.txt") as file:
  703.                         array = [row.strip() for row in file]
  704.                     with open("safes.txt") as file:
  705.                         array1 = [row.strip() for row in file]
  706.                     for elem in array:
  707.                         if elem.split(' ')[0]==str(event.user_id):
  708.                             try:
  709.                                         uu = elem.split(' ')[3]
  710.                             except:
  711.                                         pass
  712.                             try:
  713.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' ' + elem.split(' ')[2]+' '+uu
  714.                             except:
  715.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' 1'
  716.                     flag = False
  717.                     for elem in array1:
  718.                         if elem.split(' ')[0] == str(event.user_id):
  719.                             array1[array1.index(elem)] = elem.split(' ')[0] + ' '+ str(int(elem.split(' ')[1])+1)
  720.                             flag = True
  721.                     if not flag:
  722.                         array1.append(str(event.user_id)+ ' 1')
  723.                     with open("test.txt", "w") as file:
  724.                         for line in array:
  725.                             file.write(str(line)+"\n")
  726.                     with open("safes.txt", "w") as file:
  727.                         for line in array1:
  728.                             file.write(str(line)+"\n")
  729.                 else:
  730.                     vk.messages.send (peer_id = event.peer_id, message = u+'не повезло!&#128555; Попробуй ещё раз! Код сейфа - '+str(truenum), keyboard=keyboard.get_keyboard(), random_id = random.randint(1,999999))
  731.              else:
  732.                  e = 1/0
  733.             except:
  734.                 keyboard = VkKeyboard(inline=True)
  735.                 keyboard.add_button('Сейф ' + str(random.randint(1,100)), color=VkKeyboardColor.POSITIVE)
  736.                 keyboard.add_line()
  737.                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  738.                 vk.messages.send (peer_id = event.peer_id, message = u+'использование команды - сейф [Число от 1 до 100]\n Пример: "сейф 54"\n\n Попробуй подобрать пароль для сейфа и получи до 200.000$!&#129297;', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999))
  739.                 vk.messages.send(
  740.                         peer_id = event.peer_id,
  741.                         random_id=get_random_id(),
  742.                         sticker_id = 733
  743.                         )
  744.         elif main_mess=='выключить рассылки':
  745.             with open("test.txt") as file:
  746.                 array = [row.strip() for row in file]
  747.             for elem in array:
  748.                 if elem.split(' ')[0]==str(event.user_id):
  749.                     try:
  750.                                         uu = elem.split(' ')[3]
  751.                     except:
  752.                                         pass
  753.                     array[array.index(elem)] = elem.split(' ')[0] +' '+ elem.split(' ')[1] + ' 0'+' '+uu
  754.             with open("test.txt", "w") as file:
  755.                 for line in array:
  756.                   file.write(str(line)+"\n")
  757.             keyboard = VkKeyboard(inline=True)
  758.             keyboard.add_button('Включить рассылки', color=VkKeyboardColor.POSITIVE)
  759.             keyboard.add_line()
  760.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  761.             vk.messages.send  (peer_id = event.peer_id,message = u+'успешно. Если надумаете снова включить рассылки, то можете сделать это в любое время через настройки&#128516;',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  762.         elif main_mess=='включить рассылки':
  763.             with open("test.txt") as file:
  764.                 array = [row.strip() for row in file]
  765.             for elem in array:
  766.                 if elem.split(' ')[0]==str(event.user_id):
  767.                     try:
  768.                                         uu = elem.split(' ')[3]
  769.                     except:
  770.                                         pass
  771.                     array[array.index(elem)] = elem.split(' ')[0] +' '+ elem.split(' ')[1] + ' 1'+' '+uu
  772.             with open("test.txt", "w") as file:
  773.                 for line in array:
  774.                   file.write(str(line)+"\n")
  775.             keyboard = VkKeyboard(inline=True)
  776.             keyboard.add_button('Выключить рассылки', color=VkKeyboardColor.NEGATIVE)
  777.             keyboard.add_line()
  778.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  779.             vk.messages.send  (peer_id = event.peer_id,message = u+'успешно. Спасибо!&#128153;',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  780.             with open("test.txt", "w") as file:
  781.                 for line in array:
  782.                   file.write(str(line)+"\n")
  783.         elif main_mess=='рассылки':
  784.             with open("test.txt") as file:
  785.                 array = [row.strip() for row in file]
  786.             for elem in array:
  787.                 if elem.split(' ')[0]==str(event.user_id):
  788.                     try:
  789.                         ####print(elem.split(' ')[2])
  790.                         status = elem.split(' ')[2]
  791.                     except:
  792.                         array[array.index(elem)] = elem + ' 1'
  793.                         status = '1'
  794.                     if status == '1':
  795.                         keyboard = VkKeyboard(inline=True)
  796.                         keyboard.add_button('Выключить рассылки', color=VkKeyboardColor.NEGATIVE)
  797.                         vk.messages.send  (peer_id = event.peer_id,message = u+'текущий статус рассылок - ВКЛ',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  798.                     if status == '0':
  799.                         keyboard = VkKeyboard(inline=True)
  800.                         keyboard.add_button('Включить рассылки', color=VkKeyboardColor.POSITIVE)
  801.                         vk.messages.send  (peer_id = event.peer_id,message = u+'текущий статус рассылок - ВЫКЛ',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  802.             with open("test.txt", "w") as file:
  803.                 for line in array:
  804.                   file.write(str(line)+"\n")
  805.         elif main_mess=='⚙настройки':
  806.             keyboard = VkKeyboard(inline=True)
  807.             keyboard.add_button('Рассылки', color=VkKeyboardColor.POSITIVE)
  808.             keyboard.add_button('Никнейм', color=VkKeyboardColor.POSITIVE)
  809.             keyboard.add_line()
  810.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  811.             vk.messages.send  (peer_id = event.peer_id,message = u+'выберите нужную категорию настроек.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999),attachment = 'photo-187194307_457239415')
  812.  
  813.         elif main_mess=='🔝топ игроков':
  814.             with open("test.txt") as file:
  815.                 array = [row.strip() for row in file]
  816.             new = []
  817.             for elem in array:
  818.                 try:
  819.                     new.append(elem.split(' '))
  820.                 except:
  821.                     pass
  822.             ####print(int)
  823.             new.sort(key = mone, reverse = True)
  824.             keyboard = VkKeyboard(inline=True)
  825.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  826.             a = ""
  827.             all_usr= "0"
  828.             for i in range(10):
  829.                 all_usr = all_usr +','+ str(new[i][0])
  830.             ####print(all_usr)
  831.             bal = vk.users.get(user_ids=all_usr)
  832.             for i in range(10):
  833.                 add = ''
  834.                 if str(new[i][0]) in vip:
  835.                     add = '༺VIP༻'
  836.                 if str(new[i][0]) == str('294716376'):
  837.                     add = '༺Ă ͏̷̬̝̲̳̲͑͆͆̀̃̍Ď ̵̷̡̡̛̥̠͙̤̥͓̥͇̟͇̯̜̭̝̝̗͉̫̱̝͌̅̋͂̀̌̉̌̑̉̇͒̃͑͌̍̉̀̒̚͜͜͡ͅМ ̧͓̝͈͛̆͢͡͝Ĩ ̷̨̮̫̲͇̩̥̂̄͒͂̒͌̈̈͒̃̈́̑̿̉̕͝͠͞Ń ̵̨̘̝̤̯̣̂́̀̒̾͛͒̒̏̓̕͘͝ͅͅ༻'
  838.                 try:
  839.                     a = a + str((str(i+1)+'. '+add+'[id'+str(new[i][0])+'|'+bal[i]['first_name']+' '+bal[i]['last_name']+'] - ' + des(new[i][1]) +'$\n'))
  840.                 except:
  841.                     pass
  842.  
  843.             vk.messages.send  (peer_id = event.peer_id,message = u+'топ игроков бота:\n'+a,keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  844.         elif main_mess=='казино все' or main_mess=='казино всё':
  845.             with open("test.txt") as file:
  846.                 array = [row.strip() for row in file]
  847.             ####print(array)
  848.             for elem in array:
  849.                 if elem.split(' ')[0]==str(event.user_id):
  850.                   if int(elem.split(' ')[1])>0:
  851.                     kef=random.randint(0,8)*0.25
  852.                     wow = False
  853.                     if kef==2 and random.randint(0,9)==0:
  854.                         kef = 4
  855.                         wow = True
  856.                     if kef==2 and random.randint(0,20)==0:
  857.                         kef = 10
  858.                         wow = True
  859.                     if kef == 2 and random.randint(0,30)==0:
  860.                         kef = 30
  861.                         wow = True
  862.                     comis = 0.01
  863.                     if str(elem.split(' ')[0]) in vip:
  864.                         comis = 0.005
  865.  
  866.                     try:
  867.                                         uu = elem.split(' ')[3]
  868.                     except:
  869.                                         pass
  870.                     newbalance = str(int(int(elem.split(' ')[1])*kef*(1-comis)))
  871.                     if not event.user_id == 503708185:
  872.                         daykomis = daykomis + int(int(elem.split(' ')[1])*kef*(comis))
  873.                     try:
  874.                         array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  875.                     except:
  876.                         try:
  877.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]
  878.                         except:
  879.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' 1'
  880.                     att =''
  881.                     if kef==1:
  882.                         mess="Ваши деньги остаются при вас.["
  883.                         att = 'photo-187194307_457239413'
  884.                     elif kef>1:
  885.                         mess="Поздравляем! Вы выиграли с коэффициентом ["
  886.                         att = 'photo-187194307_457239419'
  887.                     elif kef<1:
  888.                         mess="Увы, вы проиграли с коэффициентом ["
  889.                         att = 'photo-187194307_457239413'
  890.                     keyboard = VkKeyboard(inline=True)
  891.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  892.                     if kef>0:
  893.                         keyboard.add_line()
  894.                         keyboard.add_button('Казино 100%', color=VkKeyboardColor.POSITIVE)
  895.                         keyboard.add_button('Казино 50%', color=VkKeyboardColor.POSITIVE)
  896.                         keyboard.add_button('Казино 25%', color=VkKeyboardColor.POSITIVE)
  897.  
  898.                     vk.messages.send  (peer_id = event.peer_id,message = u + mess+"x"+str(kef)+"]\n"+'Ваш баланс - ' + des(newbalance)+"$\nКомиссия - "+str(float(comis)*100)+'%', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard(),attachment = att)
  899.                     if wow == True:
  900.                         vk.messages.send (peer_id = event.peer_id, sticker_id = 726, random_id = time.time())
  901.                     stik = [14256,12689]
  902.                     if kef == 0:
  903.                         vk.messages.send  (peer_id = event.peer_id,sticker_id = stik[random.randint(0,1)], random_id = random.randint(1, 999999))
  904.  
  905.                   else:
  906.                       keyboard = VkKeyboard(inline=True)
  907.                       keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  908.                       vk.messages.send  (peer_id = event.peer_id,message = "Минимальная ставка - 1$!", random_id = random.randint(1, 999999), keyboard = keyboard.get_keyboard())
  909.             with open("test.txt", "w") as file:
  910.                 for line in array:
  911.                   file.write(str(line)+"\n")
  912.         elif main_mess=='vip-бонус':
  913.          keyboard = VkKeyboard(inline=True)
  914.  
  915.  
  916.          if str(event.user_id) in vip:
  917.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  918.             with open("test.txt") as file:
  919.                 array = [row.strip() for row in file]
  920.             with open("vip.txt") as file:
  921.                 array1 = [row.strip() for row in file]
  922.             ####print(array)
  923.             flag = False
  924.             for elem in array:
  925.                 if elem.split(' ')[0]==str(event.user_id):
  926.                  for elem1 in array1:
  927.                   if elem1.split(' ')[0] == str(event.user_id):
  928.                    flag = True
  929.                    delta = int(elem1.split(' ')[1])+10800-int(time.time())
  930.                    if int(int(elem1.split(' ')[1])+10800)<=int(time.time()):
  931.                     sum = random.randint(0,1000000)
  932.                     try:
  933.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  934.                     except:
  935.                      try:
  936.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  937.                      except:
  938.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  939.                     vk.messages.send  (peer_id = event.peer_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  940.                     array1[array1.index(elem1)] = str(event.user_id)+' '+str(int(time.time()))
  941.                    else:
  942.                     vk.messages.send  (peer_id = event.peer_id,message ="Подождите ещё "+str(datetime.timedelta(seconds = delta)) +' до получения следующего бонуса.', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  943.             if flag == False:
  944.                 for elem in array:
  945.                     if elem.split(' ')[0]==str(event.user_id):
  946.                      sum = random.randint(0,1000000)
  947.                      ####print(sum)
  948.                      try:
  949.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  950.                      except:
  951.                       #try:
  952.                         #array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  953.                       #except:
  954.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  955.                      ####print(sum)
  956.                      vk.messages.send  (peer_id = event.peer_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  957.                      array1.append(str(event.user_id)+' '+str(int(time.time())))
  958.                      ####print(str(event.user_id)+' '+str(int(time.time())))
  959.             with open("test.txt", "w") as file:
  960.                          for line in array:
  961.                             ####print(str(line))
  962.                             file.write(str(line)+"\n")
  963.             with open("vip.txt", "w") as file:
  964.                          for line in array1:
  965.                             ####print(str(line))
  966.                             file.write(str(line)+"\n")
  967.          else:
  968.              keyboard.add_openlink_button('Оплата', 'https://qiwi.com/n/lionead')
  969.              keyboard.add_line()
  970.              keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  971.              vk.messages.send(peer_id = event.peer_id,message ="Данная команда доступна только VIP-Пользователям. При оплате обязательно указывайте ссылку на профиль.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard(),attachment = 'market-187194307_3267052')
  972.  
  973.         elif main_mess=='бонус':
  974.             keyboard = VkKeyboard(inline=True)
  975.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  976.             with open("test.txt") as file:
  977.                 array = [row.strip() for row in file]
  978.             with open("bonus.txt") as file:
  979.                 array1 = [row.strip() for row in file]
  980.             ####print(array)
  981.             flag = False
  982.  
  983.             for elem in array:
  984.                 if elem.split(' ')[0]==str(event.user_id):
  985.                  for elem1 in array1:
  986.                   if elem1.split(' ')[0] == str(event.user_id):
  987.                    flag = True
  988.                    delta = int(elem1.split(' ')[1])+86400-int(time.time())
  989.                    text = str(datetime.timedelta(seconds = delta))
  990.                    if int(int(elem1.split(' ')[1])+86400)<=int(time.time()):
  991.                     sum = random.randint(10000,100000)
  992.                     ####print(sum)
  993.                     try:
  994.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  995.                     except:
  996.                      try:
  997.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  998.                      except:
  999.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  1000.                     ####print(sum)
  1001.                     vk.messages.send  (peer_id = event.peer_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1002.                     array1[array1.index(elem1)] = str(event.user_id)+' '+str(int(time.time()))
  1003.                    else:
  1004.                     vk.messages.send  (peer_id = event.peer_id,message ="Подождите ещё " + text +  ' до получения следующего бонуса!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1005.             if flag == False:
  1006.                 for elem in array:
  1007.                     if elem.split(' ')[0]==str(event.user_id):
  1008.                      sum = random.randint(10000,100000)
  1009.                      ####print(sum)
  1010.                      try:
  1011.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1012.                      except:
  1013.                       #try:
  1014.                         #array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  1015.                       #except:
  1016.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  1017.                      ####print(sum)
  1018.                      vk.messages.send  (peer_id = event.peer_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1019.                      array1.append(str(event.user_id)+' '+str(int(time.time())))
  1020.                      ####print(str(event.user_id)+' '+str(int(time.time())))
  1021.             with open("test.txt", "w") as file:
  1022.                          for line in array:
  1023.                             ####print(str(line))
  1024.                             file.write(str(line)+"\n")
  1025.             with open("bonus.txt", "w") as file:
  1026.                          for line in array1:
  1027.                             ####print(str(line))
  1028.                             file.write(str(line)+"\n")
  1029.              #vk.messages.send(peer_id = event.peer_id,message = 'Welcome to the menu! \n T E S T', random_id = random.randint(1, 999999))
  1030.         elif main_mess=='🎰казино':
  1031.          with open("test.txt") as file:
  1032.                 array = [row.strip() for row in file]
  1033.          ####print(array)
  1034.          for elem in array:
  1035.           if elem.split(' ')[0]==str(event.user_id):
  1036.             keyboard = VkKeyboard(inline=True)
  1037.  
  1038.  
  1039.  
  1040.             if not int(elem.split(' ')[1]) == 0:
  1041.                 keyboard.add_button('Казино 100%', color=VkKeyboardColor.POSITIVE)
  1042.                 keyboard.add_button('Казино 50%', color=VkKeyboardColor.POSITIVE)
  1043.                 keyboard.add_button('Казино 25%', color=VkKeyboardColor.POSITIVE)
  1044.                 keyboard.add_line()
  1045.             else:
  1046.                                     keyboard.add_button('&#128219;Недостаточно средств&#128219;', color=VkKeyboardColor.NEGATIVE)
  1047.                                     keyboard.add_line()
  1048.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1049.             vk.messages.send(peer_id = event.peer_id,keyboard=keyboard.get_keyboard(),message = 'Использование команды:\nКазино [Сумма]/[Количество процентов от баланса]/Всё', random_id = random.randint(1, 999999),attachment = 'photo-187194307_457239412')
  1050.         elif 'казино' in main_mess:
  1051.          sum=0
  1052.          sum1 = ''
  1053.          pro = 0
  1054.          balance = 0
  1055.          k = 1
  1056.          exc = False
  1057.          try:
  1058.                     sum1 = main_mess.split(' ')[1]
  1059.                     #print(sum1)
  1060.          except:
  1061.                     pass
  1062.          try:
  1063.                   if 'к' in sum1:
  1064.                     #print('found k')
  1065.                     cnt = sum1.count ('к')
  1066.                     sum = int(int(re.findall ('(\d+)', sum1)[0])* 1000**cnt)
  1067.                     #print(sum)
  1068.                   elif '%' in sum1:
  1069.                     #print('found k')
  1070.                     pro = int(re.findall ('(\d+)', sum1)[0])
  1071.                     print(pro)
  1072.                     if pro>0 and pro<101:
  1073.                         k = float(pro/100)
  1074.                         print(k)
  1075.                     else:
  1076.                         exc = True
  1077.                         keyboard = VkKeyboard(inline=True)
  1078.                         keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1079.                         vk.messages.send  (peer_id = event.peer_id,message ="Количество процентов от баланса должно быть более 0 и не больше 100.",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1080.  
  1081.                     #print(sum)
  1082.                   else:
  1083.                     sum = int(main_mess.split(' ')[1])
  1084.  
  1085.                       ##print(sum)
  1086.          except:
  1087.                   #print('excepted')
  1088.                   if 'к' in sum1:
  1089.                     cnt = sum1.count ('к')
  1090.                     sum = 1000**cnt
  1091.                     #print(sum)
  1092.                   else:
  1093.                       sum = int(main_mess.split(' ')[1])
  1094.                       #print(sum)
  1095.          if sum>0 or pro>0:
  1096.             with open("test.txt") as file:
  1097.                 array = [row.strip() for row in file]
  1098.             ####print(array)
  1099.             for elem in array:
  1100.                 if elem.split(' ')[0]==str(event.user_id):
  1101.                  balance = int(elem.split(' ')[1])
  1102.                  if pro>0:
  1103.                      sum = int(balance*k)
  1104.                  if sum>0:
  1105.                     ####print(balance)
  1106.                     kef=random.randint(0,8)*0.25
  1107.                     wow = False
  1108.                     if kef == 2 and random.randint(0,9)==0:
  1109.                         kef = 4
  1110.                         wow = True
  1111.                     if kef == 2 and random.randint(0,20)==0:
  1112.                         kef = 10
  1113.                         wow = True
  1114.                     if kef == 2 and random.randint(0,30)==0:
  1115.                         kef = 30
  1116.                         wow = True
  1117.                     if str(elem.split(' ')[0]) in vip:
  1118.                         comis = 0.005
  1119.                     else:
  1120.                         comis = 0.01
  1121.                     newbalance = str(int(int(int(elem.split(' ')[1])-sum+(sum*kef*(1-comis)))))
  1122.                     if sum<=balance:
  1123.                      if not event.user_id == 503708185:
  1124.                         daykomis = daykomis + int(int(sum)*kef*(comis))
  1125.                      try:
  1126.                         array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1127.                      except:
  1128.                         try:
  1129.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]
  1130.                         except:
  1131.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' 1'
  1132.                      att = ''
  1133.                      if kef==1:
  1134.                         att = 'photo-187194307_457239413'
  1135.                         mess="ваши деньги остаются при вас. ["
  1136.                      elif kef>1:
  1137.                         mess="поздравляем! Вы выиграли с коэффициентом ["
  1138.                         att = 'photo-187194307_457239419'
  1139.                      elif kef<1:
  1140.                         mess="увы, вы проиграли с коэффициентом ["
  1141.                         att = 'photo-187194307_457239413'
  1142.                      keyboard = VkKeyboard(inline=True)
  1143.                      if pro == 100 and kef == 0:
  1144.                          print('F')
  1145.                      else:
  1146.                          keyboard.add_button('Казино 100%', color=VkKeyboardColor.POSITIVE)
  1147.                          keyboard.add_button('Казино 50%', color=VkKeyboardColor.POSITIVE)
  1148.                          keyboard.add_button('Казино 25%', color=VkKeyboardColor.POSITIVE)
  1149.                          keyboard.add_line()
  1150.                      keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1151.                      vk.messages.send  (peer_id = event.peer_id,message = u + mess+"x"+str(kef)+"]\n"+'Ваш баланс - ' + des(newbalance)+"$\nКомиссия - "+str(float(comis)*100)+'%', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard(),attachment = att)
  1152.                      if wow == True:
  1153.                          vk.messages.send (peer_id = event.peer_id, sticker_id = 726, random_id = time.time())
  1154.                      sleep(0.03)
  1155.                      if pro == 100 and kef == 0:
  1156.                         stik = [14256,12689]
  1157.                         vk.messages.send  (peer_id = event.peer_id,sticker_id = stik[random.randint(0,1)], random_id = random.randint(1, 999999))
  1158.                     else:
  1159.                      if not exc:
  1160.                         keyboard = VkKeyboard(inline=True)
  1161.                         keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1162.                         vk.messages.send  (peer_id = event.peer_id,message ="На вашем балансе нет столько денег! Ваш баланс - "+des(int(balance))+"$",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1163.                     with open("test.txt", "w") as file:
  1164.                         for line in array:
  1165.                              ####print(str(line))
  1166.                              file.write(str(line)+"\n")
  1167.                  else:
  1168.                       if not exc:
  1169.                          keyboard = VkKeyboard(inline=True)
  1170.                          keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1171.                          vk.messages.send(peer_id = event.peer_id,keyboard=keyboard.get_keyboard(),message = 'Минимальная ставка - 1$!', random_id = random.randint(1, 999999))
  1172.          else:
  1173.           if not exc:
  1174.              keyboard = VkKeyboard(inline=True)
  1175.              keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1176.              vk.messages.send(peer_id = event.peer_id,keyboard=keyboard.get_keyboard(),message = 'Минимальная ставка - 1$!', random_id = random.randint(1, 999999))
  1177.         elif main_mess=='стат':
  1178.             with open("test.txt") as file:
  1179.                         array = [row.strip() for row in file]
  1180.             non_all = 0
  1181.             for elem in array:
  1182.                 if elem.split(' ')[2] == '0':
  1183.                     non_all = non_all + 1
  1184.             vk.messages.send(peer_id = event.peer_id, message = 'Количество всех диалогов - '+str(vk.messages.getConversations(offset = 0, count = 0, filter= "all")['count'])+'\nКоличество пользователей, написавших со старта бота - '+str(len(array))+'\nКол-во людей, запретивших рассылки (без учёта закрытого лс) - '+str(non_all)+'\nРазрешивших рассылки - '+str(len(array)-non_all),random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1185.  
  1186.         elif main_mess=='меню' or main_mess=='обратно в меню':
  1187.             keyboard = VkKeyboard(one_time=False)
  1188.             with open("bonus.txt") as file:
  1189.                 array = [row.strip() for row in file]
  1190.             ####print(array)
  1191.             posi = False
  1192.             keyboard.add_button('VIP-Бонус', color=VkKeyboardColor.POSITIVE)
  1193.             keyboard.add_line()
  1194.             for elem in array:
  1195.                 if elem.split(' ')[0]==str(event.user_id):
  1196.                    flag = True
  1197.                    if int(int(elem.split(' ')[1])+86400)<=int(time.time()):
  1198.                         keyboard.add_button('Бонус', color=VkKeyboardColor.POSITIVE)
  1199.                         keyboard.add_line()
  1200.                         posi = True
  1201.             if posi == False:
  1202.                 keyboard.add_button('Бонус', color=VkKeyboardColor.NEGATIVE)
  1203.                 keyboard.add_line()
  1204.             keyboard.add_button('💰Баланс', color=VkKeyboardColor.POSITIVE)
  1205.             keyboard.add_button('🎰Казино', color=VkKeyboardColor.POSITIVE)
  1206.             keyboard.add_line()
  1207.             keyboard.add_button('🔐Сейф', color=VkKeyboardColor.POSITIVE)
  1208.             keyboard.add_button('&#129371;Стаканчик', color=VkKeyboardColor.POSITIVE)
  1209.             keyboard.add_line()
  1210.             keyboard.add_button('Комиссия', color=VkKeyboardColor.POSITIVE)
  1211.             keyboard.add_line()
  1212.  
  1213.             keyboard.add_button('Передать', color=VkKeyboardColor.POSITIVE)
  1214.             keyboard.add_line()
  1215.             keyboard.add_button('&#127380;Узнать мой ID', color=VkKeyboardColor.NEGATIVE)
  1216.             keyboard.add_button('&#127380;Узнать ID по ссылке', color=VkKeyboardColor.NEGATIVE)
  1217.             keyboard.add_line()
  1218.             keyboard.add_button('🔝Топ игроков', color=VkKeyboardColor.NEGATIVE)
  1219.             keyboard.add_button('🔝Топ сейфов', color=VkKeyboardColor.NEGATIVE)
  1220.             keyboard.add_line()
  1221.             keyboard.add_button('&#9881;Настройки', color=VkKeyboardColor.PRIMARY)
  1222.             keyboard.add_line()
  1223.             keyboard.add_openlink_button('Группа', 'https://vk.com/zeo_bot?from=quick_search')
  1224.             vk.messages.send(
  1225.                         peer_id = event.peer_id,
  1226.                         random_id=get_random_id(),
  1227.                         keyboard=keyboard.get_keyboard(),
  1228.                         message=u+'добро пожаловать в меню!',
  1229.                         attachment = 'photo-187194307_457239414'
  1230.                         )
  1231.             vk.messages.send(
  1232.                         peer_id = event.peer_id,
  1233.                         random_id=get_random_id(),
  1234.                         sticker_id = 9880
  1235.                         )
  1236.  
  1237.         else:
  1238.          if isnew and event.from_user:
  1239.             vk.messages.send(
  1240.                         peer_id = event.peer_id,
  1241.                         random_id=get_random_id(),
  1242.                         message = phr[random.randint(0,len(phr)-1)], keyboard=keyboard.get_keyboard()
  1243.                         )
  1244.             vk.messages.send(
  1245.                         peer_id = event.peer_id,
  1246.                         random_id=get_random_id(),
  1247.                         sticker_id = stickers[random.randint(0,len(stickers)-1)]
  1248.                         )
  1249.  
  1250.         if str(event.user_id)==str(294716376):
  1251.             ####print(event.attachments)
  1252.             mas = event.text.split(' ',1)
  1253.             if mas[0]=='рассылка':
  1254.                 add = ''
  1255.                 try:
  1256.                     arr = event.attachments
  1257.                 except:
  1258.                     pass
  1259.                 if not len(arr)==0:
  1260.                     for i in range(int(int(len(arr))/2)):
  1261.                         i = i + 1
  1262.                         add = add + arr['attach'+str(i)+'_type'] + arr['attach'+str(i)] + ','
  1263.                 with open("test.txt") as file:
  1264.                     array = [row.strip() for row in file]
  1265.                 users = grop(array, 99)
  1266.                 ids = ''
  1267.                 count = 0
  1268.                 for array in users:
  1269.                  for elem in array:
  1270.                   try:
  1271.                     if elem.split(' ')[2] == '1':
  1272.                      #if vk.messages.isMessagesFromGroupAllowed(group_id = 179758270, user_id = elem.split(' ')[0]):
  1273.                         ids =ids + ',' + elem.split(' ')[0]
  1274.                   except Exception as e:
  1275.                                                     vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  1276.                                                     pass
  1277.                  #vk.messages.send(user_id=294716376, message = str(array), random_id=random.randint(1,999999))
  1278.                  try:
  1279.                             count += len(ids.split(','))
  1280.                             vk.messages.send  (user_ids = ids,message = str(mas[1]),attachment = add, random_id = random.randint(1, 999999))
  1281.                  except Exception as e:
  1282.                             vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  1283.                  ids = ''
  1284.                 vk.messages.send(user_id=294716376, message = 'Выполнена рассылка на '+str(count)+' человек', random_id=random.randint(1,999999))
  1285.             elif mas[0] == 'стикер':
  1286.                 with open("test.txt") as file:
  1287.                     array = [row.strip() for row in file]
  1288.                 users = grop(array, 99)
  1289.                 ids = ''
  1290.                 for array in users:
  1291.                  for elem in array:
  1292.                   try:
  1293.                     if elem.split(' ')[2] == '1':
  1294.                      #if vk.messages.isMessagesFromGroupAllowed(group_id = 179758270, user_id = elem.split(' ')[0]):
  1295.                          ids =ids + ',' + elem.split(' ')[0]
  1296.  
  1297.                   except:
  1298.                         pass
  1299.                  try:
  1300.                             vk.messages.send(user_ids = ids, sticker_id = mas[1], random_id = random.randint(1,999999))
  1301.                  except Exception as e:
  1302.                             vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  1303.                  ids = ''
  1304.             elif mas[0] == 'евал':
  1305.                 keyboard = VkKeyboard(one_time=True)
  1306.                 try:
  1307.                     eval(mas[1])
  1308.                 except Exception as e:
  1309.                     vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  1310.                 vk.messages.send(user_id=294716376, message = 'Sucess.', random_id=random.randint(1,999999), keyboard=keyboard.get_keyboard())
  1311.             elif mas[0]=='выдать':
  1312.  
  1313.                 with open("test.txt") as file:
  1314.                     array = [row.strip() for row in file]
  1315.                 for elem in array:
  1316.                     if elem.split(' ')[0]==mas[1].split(' ')[0]:
  1317.                         try:
  1318.                                         uu = elem.split(' ')[3]
  1319.                         except:
  1320.                                         pass
  1321.                         try:
  1322.                             array[array.index(elem)]=str(elem.split(' ')[0])+' '+str(int(elem.split(' ')[1])+int(mas[1].split(' ')[1]))+' '+elem.split(' ')[2]+' '+uu
  1323.                         except:
  1324.                             array[array.index(elem)]=str(elem.split(' ')[0])+' '+str(int(elem.split(' ')[1])+int(mas[1].split(' ')[1]))
  1325.  
  1326.                 with open("test.txt", "w") as file:
  1327.                          for line in array:
  1328.                             file.write(str(line)+"\n")
  1329.                 id = mas[1].split(' ')[0]
  1330.                 try:
  1331.                     vk.messages.send(user_id=id, message = 'Администратор начислил на ваш баланс ' + des(mas[1].split(' ')[1])+'$!', random_id=random.randint(1,999999))
  1332.                 except:
  1333.                     pass
  1334.                 vk.messages.send(user_id=294716376, message = 'Успешно. Начислено ' + des(mas[1].split(' ')[1])+'$ [id'+str(id)+'|игроку].', random_id=random.randint(1,999999))
  1335.             elif mas[0]=='вайп25876354783':
  1336.                 with open("test.txt") as file:
  1337.                         array = [row.strip() for row in file]
  1338.                 for elem in array:
  1339.                     try:
  1340.                                         array[array.index(elem)] = elem.split(' ')[0] +' 0 '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1341.                     except:
  1342.                                         try:
  1343.                                             array[array.index(elem)] = elem.split(' ')[0] +' 0 '+elem.split(' ')[2]
  1344.                                         except:
  1345.                                             array[array.index(elem)] = elem.split(' ')[0] +' 0 1'
  1346.                 with open("test.txt", "w") as file:
  1347.                         for line in array:
  1348.                             file.write(str(line)+"\n")
  1349.                 with open("safes.txt") as file:
  1350.                         array = [row.strip() for row in file]
  1351.                 for elem in array:
  1352.                                         array[array.index(elem)] = elem.split(' ')[0] +' 0'
  1353.                 with open("safes.txt", "w") as file:
  1354.                         for line in array:
  1355.                             file.write(str(line)+"\n")
  1356.                 with open('farms.txt', "w") as file:
  1357.                             file.write("\n")
  1358.                 with open('konk.txt', "w") as file:
  1359.                             file.write("1000 0 0")
  1360.                 with open("vip.txt") as file:
  1361.                         array = [row.strip() for row in file]
  1362.                 for elem in array:
  1363.                                         array[array.index(elem)] = elem.split(' ')[0] +' 0'
  1364.                 with open("vip.txt", "w") as file:
  1365.                         for line in array:
  1366.                             file.write(str(line)+"\n")
  1367.                 with open("bonus.txt") as file:
  1368.                         array = [row.strip() for row in file]
  1369.                 for elem in array:
  1370.                                         array[array.index(elem)] = elem.split(' ')[0] +' 0'
  1371.                 with open("bonus.txt", "w") as file:
  1372.                         for line in array:
  1373.                             file.write(str(line)+"\n")
  1374.             if mas[0]=='ктоя':
  1375.                     sum = random.randint(100000,20000000000)
  1376.                     vk.messages.send (peer_id = event.peer_id, message = u+'нииичоси! Повезло так повезло&#128561; Вы получаете '+des(sum)+'$!' , random_id = random.randint(1,999999))
  1377.                     vk.messages.send (peer_id = event.peer_id, sticker_id = 7377,keyboard=keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1378.                     with open("test.txt") as file:
  1379.                         array = [row.strip() for row in file]
  1380.                     with open("safes.txt") as file:
  1381.                         array1 = [row.strip() for row in file]
  1382.                     for elem in array:
  1383.                         if elem.split(' ')[0]==str(event.user_id):
  1384.                             try:
  1385.                                         uu = elem.split(' ')[3]
  1386.                             except:
  1387.                                         pass
  1388.                             try:
  1389.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' ' + elem.split(' ')[2]+' '+uu
  1390.                             except:
  1391.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' 1'
  1392.                     flag = False
  1393.                     for elem in array1:
  1394.                         if elem.split(' ')[0] == str(event.user_id):
  1395.                             array1[array1.index(elem)] = elem.split(' ')[0] + ' '+ str(int(elem.split(' ')[1])+1)
  1396.                             flag = True
  1397.                     if not flag:
  1398.                         array1.append(str(event.user_id)+ ' 1')
  1399.                     with open("test.txt", "w") as file:
  1400.                         for line in array:
  1401.                             file.write(str(line)+"\n")
  1402.                     with open("safes.txt", "w") as file:
  1403.                         for line in array1:
  1404.                             file.write(str(line)+"\n")
  1405.  
  1406.      if event.from_chat:
  1407.       if False:
  1408.         nul = False
  1409.         u = ''
  1410.         nick = ''
  1411.         with open("test.txt") as file:
  1412.                         array = [row.strip() for row in file]
  1413.         nick = vk.users.get(user_ids=event.user_id)[0]['first_name']
  1414.         for elem in array:
  1415.                         if elem.split(' ')[0]==str(event.user_id):
  1416.                             try:
  1417.                                 nick = elem.split(' ')[3]
  1418.                             except:
  1419.                                 pass
  1420.  
  1421.         ####print(event.text)
  1422.         u = nick+', '
  1423.         main_mess = ''
  1424.         if 'Бот]' in event.text:
  1425.          try:
  1426.             main_mess=event.text.casefold().split('бот] ',1)[1]
  1427.          except:
  1428.             pass
  1429.         elif '@' in event.text:
  1430.             try:
  1431.              main_mess=event.text.casefold().split(' ',1)[1]
  1432.             except:
  1433.              pass
  1434.         else:
  1435.             try:
  1436.              main_mess=event.text.casefold()
  1437.             except:
  1438.              pass
  1439.         keyboard = VkKeyboard(inline=True)
  1440.         keyboard.add_button('Меню', color=VkKeyboardColor.POSITIVE)
  1441.         isnew=False
  1442.         with open("test.txt") as file:
  1443.             array = [row.strip() for row in file]
  1444.         ####print(array)
  1445.         for elem in array:
  1446.                 if elem.split(' ')[0]==str(event.user_id):
  1447.                   isnew=True
  1448.         if isnew==False:
  1449.                   with open("test.txt", "a") as file:
  1450.                     file.write(str(event.user_id)+' '+str(1000) + ' 1\n')
  1451.                   vk.messages.send  (chat_id = event.chat_id,message = 'Welcome! +1.000$\n\n Приветствуем! Так как вы новый пользователь, вы будете автоматически получать рассылки. Чтобы отключить их, перейдите в меню, а затем в настройки. Желаем удачи!', random_id = random.randint(1, 999999))
  1452.         if  main_mess== '💰баланс' or main_mess == 'баланс':
  1453.             with open("test.txt") as file:
  1454.                 array = [row.strip() for row in file]
  1455.             for elem in array:
  1456.                 if elem.split(' ')[0]==str(event.user_id):
  1457.                  keyboard = VkKeyboard(inline = True)
  1458.  
  1459.                  keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1460.                  vk.messages.send  (chat_id = event.chat_id,message = u+'ваш баланс - ' + des(elem.split(' ')[1])+"$",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1461.         elif main_mess=='комиссия':
  1462.             keyboard = VkKeyboard(inline=True)
  1463.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1464.             vk.messages.send  (chat_id = event.chat_id,message = u+'накоплено за сутки - '+str(des(daykomis))+'$\n\n&#10067;Что такое комиссия? Она копится за счёт казино. Ровно в 12:00 по МСК каждый день проводится автоконкурс со средств комиссии в течение суток, где все лайкнувшие делят между собой приз&#128123;\n&#10036;У людей с VIP-статусом комиссия снижена в 2 раза.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1465.  
  1466.         elif main_mess=='фермы':
  1467.          if 0>1:
  1468.             #keyboard = VkKeyboard(inline = True)
  1469.             keyboard.add_button('Ферма RX590', color=VkKeyboardColor.POSITIVE)
  1470.             keyboard.add_line()
  1471.             keyboard.add_button('Ферма GTX1660TI', color=VkKeyboardColor.POSITIVE)
  1472.             keyboard.add_line()
  1473.             keyboard.add_button('Ферма RTX2080SUPER', color=VkKeyboardColor.POSITIVE)
  1474.             vk.messages.send(chat_id = event.chat_id, message = 'Доступные для покупки фермы:\n1. RX590. Цена - 120.000$. Доход - 9.000$/час\n2. GTX1660TI. Цена - 340.000$. Доход - 21.000$/час\n2. RTX2080SUPER. Цена - 40.000.000$. Доход - 1.030.000$/час.\n Купить фермы можно с помощью команды ферма [Точное Название] [Количество]',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1475.         elif main_mess=='ферма':
  1476.             with open("test.txt") as file:
  1477.                         array = [row.strip() for row in file]
  1478.             with open("farms.txt") as file:
  1479.                         array1 = [row.strip() for row in file]
  1480.             flag = False
  1481.             for elem in array1:
  1482.                 if elem.split(' ')[0] == str(event.user_id):
  1483.                     keyboard = VkKeyboard(inline = True)
  1484.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1485.                     keyboard.add_line()
  1486.                     keyboard.add_button('Продать фермы', color=VkKeyboardColor.POSITIVE)
  1487.                     flag = True
  1488.                     farm = elem.split(' ')[1]
  1489.                     dohod = farms6[farm][1]
  1490.                     cnt = int(elem.split(' ')[2])
  1491.                     #datetime.timedelta(seconds = delta)
  1492.                     nakop = int((int(time.time())-int(elem.split(' ')[3]))/3600*dohod*cnt)
  1493.                     if 3600 - (int(time.time())-int(elem.split(' ')[3]))>=0:
  1494.                         vk.messages.send(chat_id = event.chat_id, message = 'Накоплено на ферме - '+str(des(nakop))+'$. Ваша ферма - '+farm+'[x'+str(cnt)+']\nДо вывода осталось '+str(datetime.timedelta(seconds = 3600 - (int(time.time())-int(elem.split(' ')[3]))))+'.',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1495.                     else:
  1496.                         keyboard.add_line()
  1497.                         keyboard.add_button('Снять деньги', color=VkKeyboardColor.POSITIVE)
  1498.                         vk.messages.send(chat_id = event.chat_id, message = 'Накоплено на ферме - '+str(des(nakop))+'$. Ваша ферма - '+farm+'[x'+str(cnt)+']\nМожно совершить вывод!',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1499.             #if not flag:
  1500.                # keyboard = VkKeyboard(inline = True)
  1501.             #    keyboard.add_button('Фермы', color=VkKeyboardColor.POSITIVE)
  1502.                # vk.messages.send(chat_id = event.chat_id, message = 'Биткоин фермы позволяют зарабатывать деньги пассивно! Попробуй:',random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1503.         elif main_mess == 'зов' or main_mess =='объявление':
  1504.             if event.from_chat:
  1505.                 if str(event.user_id)==str(294716376):
  1506.                     f = vk.messages.getConversationMembers(peer_id = event.peer_id, group_id = 192499164)
  1507.                     message = ''
  1508.                     a = vk.users.get(user_ids = event.user_id)
  1509.                     message += '[id'+str(event.user_id)+'|'+a[0]['first_name']+' '+a[0]['last_name']+'] созвал всех!\n'
  1510.                     for elem in f['profiles']:
  1511.                         message += '@id'+str(elem['id'])+' '
  1512.                     vk.messages.send(peer_id = event.peer_id, message = message, random_id = random.randint(1,999999),disable_mentions = 0)
  1513.         elif 'снять деньги' in main_mess:
  1514.             with open("test.txt") as file:
  1515.                         array = [row.strip() for row in file]
  1516.             with open("farms.txt") as file:
  1517.                         array1 = [row.strip() for row in file]
  1518.             flag = False
  1519.             for elem in array1:
  1520.                 if elem.split(' ')[0] == str(event.user_id):
  1521.                  for elem1 in array:
  1522.                   if elem1.split(' ')[0] == str(event.user_id):
  1523.                    if int(time.time())-int(elem.split(' ')[3])>=3600:
  1524.                     keyboard = VkKeyboard(inline = True)
  1525.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1526.                     flag = True
  1527.                     farm = elem.split(' ')[1]
  1528.                     dohod = farms6[farm][1]
  1529.                     cnt = int(elem.split(' ')[2])
  1530.                     #datetime.timedelta(seconds = delta)
  1531.                     nakop = int((int(time.time())-int(elem.split(' ')[3]))/3600*dohod*cnt)
  1532.                     cena = nakop
  1533.                     try:
  1534.                                         array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' '+elem1.split(' ')[2]+' '+elem1.split(' ')[3]
  1535.                     except:
  1536.                                         try:
  1537.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' '+elem1.split(' ')[2]
  1538.                                         except:
  1539.                                             array[array.index(elem1)] = elem1.split(' ')[0] +' '+str(int(elem1.split(' ')[1])+int(cena))+' 1'
  1540.                     array1[array1.index(elem)] = elem.split(' ')[0] + ' '+elem.split(' ')[1]+' '+elem.split(' ')[2]+' '+str(int(time.time()))
  1541.                     vk.messages.send  (chat_id = event.chat_id,message = 'Вы сняли '+str(des(nakop))+'$ с фермы '+elem.split(' ')[1]+'[x'+elem.split(' ')[2]+']', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1542.                    else:
  1543.                        keyboard = VkKeyboard(inline = True)
  1544.                        keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1545.                        delta = 3600-(int(time.time())-int(elem.split(' ')[3]))
  1546.                        vk.messages.send  (chat_id = event.chat_id,message = 'Подождите ещё '+str(datetime.timedelta(seconds = delta))+' до следющего снятия денег с фермы!', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1547.             with open("test.txt", "w") as file:
  1548.                      for line in array:
  1549.                         file.write(str(line)+"\n")
  1550.             with open("farms.txt", "w") as file:
  1551.                      for line in array1:
  1552.                         file.write(str(line)+"\n")
  1553.         elif main_mess=='продать фермы':
  1554.             with open("test.txt") as file:
  1555.                         array = [row.strip() for row in file]
  1556.             with open("farms.txt") as file:
  1557.                         array1 = [row.strip() for row in file]
  1558.             for elem1 in array1:
  1559.                 if elem1.split(' ')[0] == str(event.user_id):
  1560.                     cena = int(int(farms6[elem1.split(' ')[1]][0])*int(elem1.split(' ')[2])/3*2)
  1561.                     del array1[array1.index(elem1)]
  1562.                     for elem in array:
  1563.                         if elem.split(' ')[0] == str(event.user_id):
  1564.  
  1565.                                     try:
  1566.                                         array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1567.                                     except:
  1568.                                         try:
  1569.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' '+elem.split(' ')[2]
  1570.                                         except:
  1571.                                             array[array.index(elem)] = elem.split(' ')[0] +' '+str(int(elem.split(' ')[1])+int(cena))+' 1'
  1572.                                     vk.messages.send(chat_id = event.chat_id,message = 'Вы успешно продали фермы за '+str(cena)+'$', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1573.             with open("test.txt", "w") as file:
  1574.                      for line in array:
  1575.                         file.write(str(line)+"\n")
  1576.             with open("farms.txt", "w") as file:
  1577.                      for line in array1:
  1578.                         file.write(str(line)+"\n")
  1579.  
  1580.  
  1581.  
  1582.         elif 'передать' in main_mess and main_mess.split(' ')[0]=='передать':
  1583.             vk.messages.send  (chat_id = event.chat_id,message = "Данная команда доступна только в личных сообщениях.",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1584.         elif main_mess=='стат':
  1585.             with open("test.txt") as file:
  1586.                         array = [row.strip() for row in file]
  1587.             vk.messages.send(chat_id = event.chat_id, message = 'Количество всех бесед и людей, написавших что-либо боту - '+str(vk.messages.getConversations(offset = 0, count = 0, filter= "all")['count'])+'\nКоличество играющих пользователей - '+str(len(array)),random_id = random.randint(1,999999),keyboard=keyboard.get_keyboard())
  1588.  
  1589.         elif main_mess=='🆔узнать мой id':
  1590.             keyboard = VkKeyboard(inline=True)
  1591.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1592.             vk.messages.send  (chat_id = event.chat_id,message = u+'&#127380;Ваш ID ВКонтакте - '+str(event.user_id),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1593.         elif 'id' in main_mess:
  1594.             try:
  1595.                 scr = str(main_mess.split(' ')[1])
  1596.                 if not '/' in scr:
  1597.                     e = vk.users.get(user_ids = scr)
  1598.                     keyboard = VkKeyboard(inline=True)
  1599.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1600.                     vk.messages.send  (chat_id = event.chat_id,message = u+'ID Пользователя - ' + str(e[0]['id']),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1601.                 else:
  1602.                     e1 = scr.split('com/')[1]
  1603.                     e = vk.users.get(user_ids = e1)
  1604.                     keyboard = VkKeyboard(inline=True)
  1605.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1606.                     vk.messages.send  (chat_id = event.chat_id,message = u+'ID Пользователя - ' + str(e[0]['id']),keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1607.             except:
  1608.                 keyboard = VkKeyboard(inline=True)
  1609.                 keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1610.                 vk.messages.send  (chat_id = event.chat_id,message = u+'использование команды: ID [Ссылка]',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1611.         elif main_mess.split(' ')[0]=='никнейм' or main_mess.split(' ')[0]=='ник':
  1612.             new = ''
  1613.             try:
  1614.                 new = event.text.split(' ')[1]
  1615.             except:
  1616.                 pass
  1617.             with open("test.txt") as file:
  1618.                         array = [row.strip() for row in file]
  1619.             if len(new)<16:
  1620.                 for elem in array:
  1621.                         if elem.split(' ')[0]==str(event.user_id):
  1622.                             if new == '':
  1623.                              try:
  1624.                                 nick = elem.split(' ')[3]
  1625.                                 vk.messages.send  (chat_id = event.chat_id,message = 'Ваш текущий никнейм - '+nick+'.\nСменить никнейм можно командой "Никнейм [Новый никнейм без пробелов]"',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1626.                              except:
  1627.                                 vk.messages.send  (chat_id = event.chat_id,message = u+'установи свой никнейм с помощью команды! Пример - "Никнейм Василий"',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1628.                             if not new == '':
  1629.                                 try:
  1630.                                     array[array.index(elem)]=elem.split(' ')[0] + ' '+elem.split(' ')[1]+' '+elem.split(' ')[2]+' '+new
  1631.                                 except:
  1632.                                     array[array.index(elem)]=elem.split(' ')[0] + ' '+elem.split(' ')[1]+' 1 '+new
  1633.                                 vk.messages.send  (chat_id = event.chat_id,message = 'Никнейм установлен.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1634.             else:
  1635.                 vk.messages.send  (chat_id = event.chat_id,message = 'Максимальная длина никнейма - 16 символов!',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1636.             with open("test.txt", "w") as file:
  1637.                     for line in array:
  1638.                         file.write(str(line)+"\n")
  1639.         elif 'стаканчик' in main_mess:
  1640.             try:
  1641.                 usnum = main_mess.split(' ')[2]
  1642.                 sum = main_mess.split(' ')[1]
  1643.                 with open("test.txt") as file:
  1644.                         array = [row.strip() for row in file]
  1645.                 for elem in array:
  1646.                         if elem.split(' ')[0]==str(event.user_id):
  1647.                             if int(elem.split(' ')[1])>=int(sum):
  1648.                              if int(sum)>0:
  1649.                                 randnum = random.randint(1,3)
  1650.                                 if randnum == int(usnum):
  1651.                                     try:
  1652.                                         uu = elem.split(' ')[3]
  1653.                                     except:
  1654.                                         pass
  1655.                                     try:
  1656.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])+int(sum)*2) +' '+elem.split(' ')[2]+' '+uu
  1657.                                     except:
  1658.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])+int(sum)*2) +' 1'+' '+uu
  1659.                                     keyboard = VkKeyboard(inline=True)
  1660.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])+int(sum)*2))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  1661.                                     vk.messages.send (chat_id = event.chat_id, message = u+'поздравляем, вы угадали! +'+des(int(sum)*2)+'$&#128522;\n\nВаш баланс - '+des(int(int(elem.split(' ')[1])+int(sum)*2))+'$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1662.                                     sleep(0.03)
  1663.  
  1664.                                 elif not randnum == int(usnum):
  1665.                                     try:
  1666.                                         uu = elem.split(' ')[3]
  1667.                                     except:
  1668.                                         pass
  1669.                                     try:
  1670.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])-int(sum)) +' '+elem.split(' ')[2]+' '+uu
  1671.                                     except:
  1672.                                         array[array.index(elem)]=elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1])-int(sum)) +' 1'+' '+uu
  1673.                                     keyboard = VkKeyboard(inline=True)
  1674.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])-int(sum)))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  1675.                                     vk.messages.send (chat_id = event.chat_id, message = u+'не повезло. -'+des(sum)+'$&#128532;\n\nВаш баланс - '+des(int(int(elem.split(' ')[1])-int(sum)))+'$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1676.                                     sleep(0.03)
  1677.  
  1678.                              else:
  1679.                                 keyboard = VkKeyboard(inline=True)
  1680.                                 if not int(elem.split(' ')[1]) == 0:
  1681.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  1682.  
  1683.                                 vk.messages.send(chat_id = event.chat_id, message = u+"минимальная ставка - 1$!", random_id = random.randint(1,999999), keyboard = keyboard.get_keyboard())
  1684.                             else:
  1685.                                 keyboard = VkKeyboard(inline=True)
  1686.                                 if not int(elem.split(' ')[1]) == 0:
  1687.                                     keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  1688.  
  1689.                                 vk.messages.send(chat_id = event.chat_id, message = u+"на балансе недостаточно средств!", random_id = random.randint(1,999999), keyboard = keyboard.get_keyboard())
  1690.                 with open("test.txt", "w") as file:
  1691.                     for line in array:
  1692.                         file.write(str(line)+"\n")
  1693.             except:
  1694.                 with open("test.txt") as file:
  1695.                         array = [row.strip() for row in file]
  1696.                 for elem in array:
  1697.                         if elem.split(' ')[0]==str(event.user_id):
  1698.                                 keyboard = VkKeyboard(inline=True)
  1699.                                 keyboard.add_button('Стаканчик ' + str(random.randint(1,int(elem.split(' ')[1])))+' '+str(random.randint(1,3)), color=VkKeyboardColor.POSITIVE)
  1700.                                 vk.messages.send (chat_id = event.chat_id, message = u+'использование команды - стаканчик [сумма] [номер стаканчика]\n Пример: "Стаканчик 5000 2" \n\n Угадай номер стаканчика с шариком и утрой свои деньги&#129371;&#128181;\n Примечание: если у вас на балансе недостаточно средств, поставить не получится. Минимальная ставка - 1$', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1701.                                 vk.messages.send(
  1702.                                     chat_id=event.chat_id,
  1703.                                     random_id=get_random_id(),
  1704.                                     sticker_id = 735
  1705.                                 )
  1706.         elif main_mess=='🔝топ сейфов':
  1707.             with open("safes.txt") as file:
  1708.                 array = [row.strip() for row in file]
  1709.             new = []
  1710.             for elem in array:
  1711.                 try:
  1712.                     new.append(elem.split(' '))
  1713.                 except:
  1714.                     pass
  1715.             ####print(int)
  1716.             new.sort(key = mone, reverse = True)
  1717.             keyboard = VkKeyboard(inline=True)
  1718.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1719.             a = ""
  1720.             ####print(vk.users.get(user_ids='2,3,4'))
  1721.             all_usr= "0"
  1722.             for i in range(10):
  1723.                 all_usr = all_usr +','+ str(new[i][0])
  1724.             ####print(all_usr)
  1725.             bal = vk.users.get(user_ids=all_usr)
  1726.             try:
  1727.              for i in range(10):
  1728.                 add = ''
  1729.                 if str(new[i][0]) in vip:
  1730.                     add = '༺VIP༻'
  1731.                 if str(new[i][0]) == str('294716376'):
  1732.                     add = '༺Ă ͏̷̬̝̲̳̲͑͆͆̀̃̍Ď ̵̷̡̡̛̥̠͙̤̥͓̥͇̟͇̯̜̭̝̝̗͉̫̱̝͌̅̋͂̀̌̉̌̑̉̇͒̃͑͌̍̉̀̒̚͜͜͡ͅМ ̧͓̝͈͛̆͢͡͝Ĩ ̷̨̮̫̲͇̩̥̂̄͒͂̒͌̈̈͒̃̈́̑̿̉̕͝͠͞Ń ̵̨̘̝̤̯̣̂́̀̒̾͛͒̒̏̓̕͘͝ͅͅ༻'
  1733.                 try:
  1734.                     a = a + str((str(i+1)+'. '+add+'[id'+str(new[i][0])+'|'+bal[i]['first_name']+' '+bal[i]['last_name']+'] - ' + des(new[i][1]) +'&#128275;\n'))
  1735.                 except:
  1736.                     pass
  1737.             except:
  1738.                 pass
  1739.             vk.messages.send  (chat_id = event.chat_id,message = u+'топ взломщиков сейфов:\n'+a,keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1740.         elif '🔐сейф' in main_mess or 'сейф' in main_mess:
  1741.             try:
  1742.              usnum = main_mess.split(' ')[1]
  1743.              if int(usnum)>0 and int(usnum)<101:
  1744.                 truenum = random.randint(1,100)
  1745.                 keyboard = VkKeyboard(inline=True)
  1746.                 keyboard.add_button('Сейф ' + str(random.randint(1,100)), color=VkKeyboardColor.POSITIVE)
  1747.                 keyboard.add_line()
  1748.                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  1749.                 if truenum == int(usnum):
  1750.                     sum = random.randint(0,200000)
  1751.                     vk.messages.send (chat_id = event.chat_id, message = u+'нииичоси! Повезло так повезло&#128561; Вы получаете '+des(sum)+'$!' , random_id = random.randint(1,999999))
  1752.                     vk.messages.send (chat_id = event.chat_id, sticker_id = 7377,keyboard=keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1753.                     with open("test.txt") as file:
  1754.                         array = [row.strip() for row in file]
  1755.                     with open("safes.txt") as file:
  1756.                         array1 = [row.strip() for row in file]
  1757.                     for elem in array:
  1758.                         if elem.split(' ')[0]==str(event.user_id):
  1759.                             try:
  1760.                                         uu = elem.split(' ')[3]
  1761.                             except:
  1762.                                         pass
  1763.                             try:
  1764.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' ' + elem.split(' ')[2]+' '+uu
  1765.                             except:
  1766.                                 array[array.index(elem)] = elem.split(' ')[0] +' '+ str(int(elem.split(' ')[1]) + sum) +  ' 1'
  1767.                     flag = False
  1768.                     for elem in array1:
  1769.                         if elem.split(' ')[0] == str(event.user_id):
  1770.                             array1[array1.index(elem)] = elem.split(' ')[0] + ' '+ str(int(elem.split(' ')[1])+1)
  1771.                             flag = True
  1772.                     if not flag:
  1773.                         array1.append(str(event.user_id)+ ' 1')
  1774.                     with open("test.txt", "w") as file:
  1775.                         for line in array:
  1776.                             file.write(str(line)+"\n")
  1777.                     with open("safes.txt", "w") as file:
  1778.                         for line in array1:
  1779.                             file.write(str(line)+"\n")
  1780.                 else:
  1781.                     vk.messages.send (chat_id = event.chat_id, message = u+'не повезло!&#128555; Попробуй ещё раз! Код сейфа - '+str(truenum), keyboard=keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1782.              else:
  1783.                  e = 1/0
  1784.             except:
  1785.                 keyboard = VkKeyboard(inline=True)
  1786.                 keyboard.add_button('Сейф ' + str(random.randint(1,100)), color=VkKeyboardColor.POSITIVE)
  1787.                 keyboard.add_line()
  1788.                 keyboard.add_button('Обратно в меню', color = VkKeyboardColor.POSITIVE)
  1789.                 vk.messages.send (chat_id = event.chat_id, message = u+'использование команды - сейф [Число от 1 до 100]\n Пример: "сейф 54"\n\n Попробуй подобрать пароль для сейфа и получи до 20.000.000.000$!&#129297;', keyboard = keyboard.get_keyboard(), random_id = random.randint(1,999999))
  1790.                 vk.messages.send(
  1791.                         chat_id=event.chat_id,
  1792.                         random_id=get_random_id(),
  1793.                         sticker_id = 733
  1794.                         )
  1795.         elif main_mess=='vip-бонус':
  1796.          keyboard = VkKeyboard(inline=True)
  1797.          keyboard.add_openlink_button('Оплата', 'https://vk.com/zeo_bot?from=quick_search')
  1798.          keyboard.add_line()
  1799.          keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1800.          if str(event.user_id) in vip:
  1801.             with open("test.txt") as file:
  1802.                 array = [row.strip() for row in file]
  1803.             with open("vip.txt") as file:
  1804.                 array1 = [row.strip() for row in file]
  1805.             ####print(array)
  1806.             flag = False
  1807.             keyboard = VkKeyboard(inline=True)
  1808.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1809.             for elem in array:
  1810.                 if elem.split(' ')[0]==str(event.user_id):
  1811.                  for elem1 in array1:
  1812.                   if elem1.split(' ')[0] == str(event.user_id):
  1813.                    flag = True
  1814.                    delta = int(elem1.split(' ')[1])+10800-int(time.time())
  1815.                    text = str(datetime.timedelta(seconds = delta))
  1816.                    if int(int(elem1.split(' ')[1])+10800)<=int(time.time()):
  1817.                     sum = random.randint(0,1000000)
  1818.                     try:
  1819.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1820.                     except:
  1821.                      try:
  1822.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  1823.                      except:
  1824.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  1825.                     vk.messages.send  (chat_id = event.chat_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1826.                     array1[array1.index(elem1)] = str(event.user_id)+' '+str(int(time.time()))
  1827.                    else:
  1828.                     vk.messages.send  (chat_id = event.chat_id,message ="Подождите ещё "+text+" до получения следующего бонуса!", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1829.             if flag == False:
  1830.                      array1.append(str(event.user_id)+' '+str(int(time.time())))
  1831.                      ####print(str(event.user_id)+' '+str(int(time.time())))
  1832.             with open("test.txt", "w") as file:
  1833.                          for line in array:
  1834.                             ####print(str(line))
  1835.                             file.write(str(line)+"\n")
  1836.             with open("vip.txt", "w") as file:
  1837.                          for line in array1:
  1838.                             ####print(str(line))
  1839.                             file.write(str(line)+"\n")
  1840.          else:
  1841.              vk.messages.send  (chat_id = event.chat_id,message ="Данная команда доступна только VIP-Пользователям.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard(), )
  1842.         elif main_mess=='выключить рассылки':
  1843.             with open("test.txt") as file:
  1844.                 array = [row.strip() for row in file]
  1845.             for elem in array:
  1846.                 if elem.split(' ')[0]==str(event.user_id):
  1847.                     try:
  1848.                                         uu = elem.split(' ')[3]
  1849.                     except:
  1850.                                         pass
  1851.                     array[array.index(elem)] = elem.split(' ')[0] +' '+ elem.split(' ')[1] + ' 0'+' '+uu
  1852.             with open("test.txt", "w") as file:
  1853.                 for line in array:
  1854.                   file.write(str(line)+"\n")
  1855.             keyboard = VkKeyboard(inline=True)
  1856.             keyboard.add_button('Включить рассылки', color=VkKeyboardColor.POSITIVE)
  1857.             keyboard.add_line()
  1858.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1859.             vk.messages.send  (chat_id = event.chat_id,message = u+'успешно. Если надумаете снова включить рассылки, то можете сделать это в любое время через настройки&#128516;',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1860.         elif main_mess=='включить рассылки':
  1861.             with open("test.txt") as file:
  1862.                 array = [row.strip() for row in file]
  1863.             for elem in array:
  1864.                 if elem.split(' ')[0]==str(event.user_id):
  1865.                     try:
  1866.                                         uu = elem.split(' ')[3]
  1867.                     except:
  1868.                                         pass
  1869.                     array[array.index(elem)] = elem.split(' ')[0] +' '+ elem.split(' ')[1] + ' 1'+' '+uu
  1870.             with open("test.txt", "w") as file:
  1871.                 for line in array:
  1872.                   file.write(str(line)+"\n")
  1873.             keyboard = VkKeyboard(inline=True)
  1874.             keyboard.add_button('Выключить рассылки', color=VkKeyboardColor.NEGATIVE)
  1875.             keyboard.add_line()
  1876.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1877.             vk.messages.send  (chat_id = event.chat_id,message = u+'успешно. Спасибо!&#128153;',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1878.             with open("test.txt", "w") as file:
  1879.                 for line in array:
  1880.                   file.write(str(line)+"\n")
  1881.         elif main_mess=='рассылки':
  1882.             with open("test.txt") as file:
  1883.                 array = [row.strip() for row in file]
  1884.             for elem in array:
  1885.                 if elem.split(' ')[0]==str(event.user_id):
  1886.                     try:
  1887.                         ####print(elem.split(' ')[2])
  1888.                         status = elem.split(' ')[2]
  1889.                     except:
  1890.                         array[array.index(elem)] = elem + ' 1'
  1891.                         status = '1'
  1892.                     if status == '1':
  1893.                         keyboard = VkKeyboard(inline=True)
  1894.                         keyboard.add_button('Выключить рассылки', color=VkKeyboardColor.NEGATIVE)
  1895.                         vk.messages.send  (chat_id = event.chat_id,message = u+'текущий статус рассылок - ВКЛ',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1896.                     if status == '0':
  1897.                         keyboard = VkKeyboard(inline=True)
  1898.                         keyboard.add_button('Включить рассылки', color=VkKeyboardColor.POSITIVE)
  1899.                         vk.messages.send  (chat_id = event.chat_id,message = u+'текущий статус рассылок - ВЫКЛ',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1900.             with open("test.txt", "w") as file:
  1901.                 for line in array:
  1902.                   file.write(str(line)+"\n")
  1903.         elif main_mess=='⚙настройки':
  1904.             keyboard = VkKeyboard(inline=True)
  1905.             keyboard.add_button('Рассылки', color=VkKeyboardColor.POSITIVE)
  1906.             keyboard.add_button('Никнейм', color=VkKeyboardColor.POSITIVE)
  1907.             keyboard.add_line()
  1908.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1909.             vk.messages.send  (chat_id = event.chat_id,message = u+'выберите нужную категорию настроек.',keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1910.         elif main_mess=='🔝топ игроков':
  1911.             with open("test.txt") as file:
  1912.                 array = [row.strip() for row in file]
  1913.             new = []
  1914.             for elem in array:
  1915.                 try:
  1916.                     new.append(elem.split(' '))
  1917.                 except:
  1918.                     pass
  1919.             ####print(int)
  1920.             new.sort(key = mone, reverse = True)
  1921.             keyboard = VkKeyboard(inline=True)
  1922.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1923.             a = ""
  1924.             ####print(vk.users.get(user_ids='2,3,4'))
  1925.             all_usr= "0"
  1926.             for i in range(10):
  1927.                 all_usr = all_usr +','+ str(new[i][0])
  1928.             ####print(all_usr)
  1929.             bal = vk.users.get(user_ids=all_usr)
  1930.             for i in range(10):
  1931.                 add = ''
  1932.                 if str(new[i][0]) in vip:
  1933.                     add = '༺VIP༻'
  1934.                 if str(new[i][0]) == str('294716376'):
  1935.                     add = '༺Ă ͏̷̬̝̲̳̲͑͆͆̀̃̍Ď ̵̷̡̡̛̥̠͙̤̥͓̥͇̟͇̯̜̭̝̝̗͉̫̱̝͌̅̋͂̀̌̉̌̑̉̇͒̃͑͌̍̉̀̒̚͜͜͡ͅМ ̧͓̝͈͛̆͢͡͝Ĩ ̷̨̮̫̲͇̩̥̂̄͒͂̒͌̈̈͒̃̈́̑̿̉̕͝͠͞Ń ̵̨̘̝̤̯̣̂́̀̒̾͛͒̒̏̓̕͘͝ͅͅ༻'
  1936.                 try:
  1937.                     a = a + str((str(i+1)+'. '+add+'[id'+str(new[i][0])+'|'+bal[i]['first_name']+' '+bal[i]['last_name']+'] - ' + des(new[i][1]) +'$\n'))
  1938.                 except:
  1939.                     pass
  1940.  
  1941.             vk.messages.send  (chat_id = event.chat_id,message = u+'топ игроков бота:\n'+a,keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  1942.         elif main_mess=='казино все' or main_mess=='казино всё':
  1943.             with open("test.txt") as file:
  1944.                 array = [row.strip() for row in file]
  1945.             ####print(array)
  1946.             for elem in array:
  1947.                 if elem.split(' ')[0]==str(event.user_id):
  1948.                   if int(elem.split(' ')[1])>0:
  1949.                     kef=random.randint(0,8)*0.25
  1950.                     wow = False
  1951.                     if kef==2 and random.randint(0,9)==0:
  1952.                         kef = 4
  1953.                         wow = True
  1954.                     if kef==2 and random.randint(0,20)==0:
  1955.                         kef = 10
  1956.                         wow = True
  1957.                     if kef == 2 and random.randint(0,30)==0:
  1958.                         kef = 30
  1959.                         wow = True
  1960.                     comis = 0.01
  1961.                     if str(elem.split(' ')[0]) in vip:
  1962.                         comis = 0.005
  1963.  
  1964.                     try:
  1965.                                         uu = elem.split(' ')[3]
  1966.                     except:
  1967.                                         pass
  1968.                     newbalance = str(int(int(elem.split(' ')[1])*kef*(1-comis)))
  1969.                     daykomis = daykomis + int(int(elem.split(' ')[1])*kef*(comis))
  1970.                     try:
  1971.                         array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  1972.                     except:
  1973.                         try:
  1974.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]
  1975.                         except:
  1976.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' 1'
  1977.                     if kef==1:
  1978.                         mess="Ваши деньги остаются при вас.["
  1979.                     elif kef>1:
  1980.                         mess="Поздравляем! Вы выиграли с коэффициентом ["
  1981.                     elif kef<1:
  1982.                         mess="Увы, вы проиграли с коэффициентом ["
  1983.                     keyboard = VkKeyboard(inline=True)
  1984.                     keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  1985.                     if kef>0:
  1986.                         keyboard.add_line()
  1987.                         keyboard.add_button('Казино 100%', color=VkKeyboardColor.POSITIVE)
  1988.                         keyboard.add_button('Казино 50%', color=VkKeyboardColor.POSITIVE)
  1989.                         keyboard.add_button('Казино 25%', color=VkKeyboardColor.POSITIVE)
  1990.  
  1991.                     vk.messages.send  (chat_id = event.chat_id,message = u + mess+"x"+str(kef)+"]\n"+'Ваш баланс - ' + des(newbalance)+"$\nКомиссия - "+str(float(comis)*100)+'%', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  1992.                     if wow == True:
  1993.                         vk.messages.send (chat_id = event.chat_id, sticker_id = 726, random_id = time.time())
  1994.                     stik = [14256,12689]
  1995.                     if kef == 0:
  1996.                         vk.messages.send  (chat_id = event.chat_id,sticker_id = stik[random.randint(0,1)], random_id = random.randint(1, 999999))
  1997.  
  1998.                   else:
  1999.                       keyboard = VkKeyboard(inline=True)
  2000.                       keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2001.                       vk.messages.send  (chat_id = event.chat_id,message = "Минимальная ставка - 1$!", random_id = random.randint(1, 999999), keyboard = keyboard.get_keyboard())
  2002.             with open("test.txt", "w") as file:
  2003.                 for line in array:
  2004.                   file.write(str(line)+"\n")
  2005.         elif main_mess=='бонус':
  2006.             keyboard = VkKeyboard(inline=True)
  2007.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2008.  
  2009.             with open("test.txt") as file:
  2010.                 array = [row.strip() for row in file]
  2011.             with open("bonus.txt") as file:
  2012.                 array1 = [row.strip() for row in file]
  2013.             ####print(array)
  2014.             flag = False
  2015.             keyboard = VkKeyboard(inline=True)
  2016.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2017.             for elem in array:
  2018.                 if elem.split(' ')[0]==str(event.user_id):
  2019.                  for elem1 in array1:
  2020.                   if elem1.split(' ')[0] == str(event.user_id):
  2021.                    flag = True
  2022.                    delta = int(elem1.split(' ')[1])+86400-int(time.time())
  2023.                    text = str(datetime.timedelta(seconds = delta))
  2024.                    if int(int(elem1.split(' ')[1])+86400)<=int(time.time()):
  2025.                     sum = random.randint(1,100000)
  2026.                     try:
  2027.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  2028.                     except:
  2029.                      try:
  2030.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  2031.                      except:
  2032.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  2033.                     vk.messages.send  (chat_id = event.chat_id,message =u+"вы получаете "+str(sum)+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  2034.                     array1[array1.index(elem1)] = str(event.user_id)+' '+str(int(time.time()))
  2035.                    else:
  2036.                     vk.messages.send  (chat_id = event.chat_id,message ="Подождите ещё "+text+" до получения следующего бонуса!", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  2037.             if flag == False:
  2038.                 for elem in array:
  2039.                     if elem.split(' ')[0]==str(event.user_id):
  2040.                      sum = random.randint(1,100000)
  2041.                      ####print(sum)
  2042.                      try:
  2043.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  2044.                      except:
  2045.                       #try:
  2046.                         #array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' '+elem.split(' ')[2]
  2047.                       #except:
  2048.                         array[array.index(elem)]=str(event.user_id)+' '+str(int(elem.split(' ')[1])+sum)+' 1'
  2049.                      ####print(sum)
  2050.                      vk.messages.send  (chat_id = event.chat_id,message =u+"вы получаете "+str(des(sum))+"$.", random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  2051.                      array1.append(str(event.user_id)+' '+str(int(time.time())))
  2052.                      ####print(str(event.user_id)+' '+str(int(time.time())))
  2053.             with open("test.txt", "w") as file:
  2054.                          for line in array:
  2055.                             ####print(str(line))
  2056.                             file.write(str(line)+"\n")
  2057.             with open("bonus.txt", "w") as file:
  2058.                          for line in array1:
  2059.                             ####print(str(line))
  2060.                             file.write(str(line)+"\n")
  2061.              #vk.messages.send(peer_id = event.peer_id,message = 'Welcome to the menu! \n T E S T', random_id = random.randint(1, 999999))
  2062.         elif main_mess=='🎰казино':
  2063.          with open("test.txt") as file:
  2064.                 array = [row.strip() for row in file]
  2065.          ####print(array)
  2066.          for elem in array:
  2067.           if elem.split(' ')[0]==str(event.user_id):
  2068.             keyboard = VkKeyboard(inline=True)
  2069.             keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2070.             keyboard.add_line()
  2071.             keyboard.add_button('Казино всё', color=VkKeyboardColor.POSITIVE)
  2072.  
  2073.             keyboard.add_button('Казино '+str(int(int(elem.split(' ')[1])/2)), color=VkKeyboardColor.POSITIVE)
  2074.             keyboard.add_button('Казино '+str(int(int(elem.split(' ')[1])/4)), color=VkKeyboardColor.POSITIVE)
  2075.             vk.messages.send(chat_id = event.chat_id,keyboard=keyboard.get_keyboard(),message = 'Использование команды:\nКазино [Сумма]/Всё', random_id = random.randint(1, 999999))
  2076.         elif 'казино' in main_mess:
  2077.          sum=0
  2078.          try:
  2079.             sum = int(main_mess.split(' ')[1])
  2080.          except:
  2081.             pass
  2082.          if sum>0:
  2083.             with open("test.txt") as file:
  2084.                 array = [row.strip() for row in file]
  2085.             ####print(array)
  2086.             for elem in array:
  2087.                 if elem.split(' ')[0]==str(event.user_id):
  2088.                     balance = int(elem.split(' ')[1])
  2089.                     ####print(balance)
  2090.                     kef=random.randint(0,8)*0.25
  2091.                     wow = False
  2092.                     if kef == 2 and random.randint(0,9)==0:
  2093.                         kef = 4
  2094.                         wow = True
  2095.                     if kef == 2 and random.randint(0,20)==0:
  2096.                         kef = 10
  2097.                         wow = True
  2098.                     if kef == 2 and random.randint(0,30)==0:
  2099.                         kef = 30
  2100.                         wow = True
  2101.                     if str(elem.split(' ')[0]) in vip:
  2102.                         comis = 0.005
  2103.                     else:
  2104.                         comis = 0.01
  2105.                     newbalance = str(int(int(int(elem.split(' ')[1])-sum+(sum*kef*(1-comis)))))
  2106.                     daykomis = daykomis + int(sum*kef*(comis))
  2107.                     if sum<=balance:
  2108.                      try:
  2109.                         array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]+' '+elem.split(' ')[3]
  2110.                      except:
  2111.                         try:
  2112.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' '+elem.split(' ')[2]
  2113.                         except:
  2114.                             array[array.index(elem)]=str(event.user_id)+' '+newbalance+' 1'
  2115.                      if kef==1:
  2116.                         mess="ваши деньги остаются при вас. ["
  2117.                      elif kef>1:
  2118.                         mess="поздравляем! Вы выиграли с коэффициентом ["
  2119.                      elif kef<1:
  2120.                         mess="увы, вы проиграли с коэффициентом ["
  2121.                      keyboard = VkKeyboard(inline=True)
  2122.  
  2123.  
  2124.                      keyboard.add_button('Казино всё', color=VkKeyboardColor.POSITIVE)
  2125.                      keyboard.add_button('Казино '+str(int(int((balance-sum)+sum*kef)/2)), color=VkKeyboardColor.POSITIVE)
  2126.                      keyboard.add_button('Казино '+str(int(int((balance-sum)+sum*kef)/4)), color=VkKeyboardColor.POSITIVE)
  2127.                      keyboard.add_line()
  2128.                      keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2129.                      vk.messages.send  (chat_id = event.chat_id,message = u + mess+"x"+str(kef)+"]\n"+'Ваш баланс - ' + des(newbalance)+"$\nКомиссия - "+str(float(comis)*100)+'%', random_id = random.randint(1, 999999),keyboard=keyboard.get_keyboard())
  2130.                      if wow == True:
  2131.                          vk.messages.send (chat_id = event.chat_id, sticker_id = 726, random_id = time.time())
  2132.                      sleep(0.03)
  2133.                     else:
  2134.                         keyboard = VkKeyboard(inline=True)
  2135.                         keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2136.                         vk.messages.send  (chat_id = event.chat_id,message ="На вашем балансе нет столько денег! Ваш баланс - "+des(int(balance))+"$",keyboard=keyboard.get_keyboard(), random_id = random.randint(1, 999999))
  2137.                     with open("test.txt", "w") as file:
  2138.                         for line in array:
  2139.                              ####print(str(line))
  2140.                              file.write(str(line)+"\n")
  2141.          else:
  2142.              keyboard = VkKeyboard(inline=True)
  2143.              keyboard.add_button('Обратно в меню', color=VkKeyboardColor.POSITIVE)
  2144.              vk.messages.send(chat_id = event.chat_id,keyboard=keyboard.get_keyboard(),message = 'Минимальная ставка - 1$!', random_id = random.randint(1, 999999))
  2145.         elif main_mess=='меню' or main_mess=='обратно в меню':
  2146.             keyboard = VkKeyboard(one_time=False)
  2147.             with open("bonus.txt") as file:
  2148.                 array = [row.strip() for row in file]
  2149.             ####print(array)
  2150.             posi = False
  2151.             keyboard.add_button('VIP-Бонус', color=VkKeyboardColor.POSITIVE)
  2152.             keyboard.add_line()
  2153.             for elem in array:
  2154.                 if elem.split(' ')[0]==str(event.user_id):
  2155.                    flag = True
  2156.                    if int(int(elem.split(' ')[1])+86400)<=int(time.time()):
  2157.                         keyboard.add_button('Бонус', color=VkKeyboardColor.POSITIVE)
  2158.                         keyboard.add_line()
  2159.                         posi = True
  2160.             if posi == False:
  2161.                 keyboard.add_button('Бонус', color=VkKeyboardColor.NEGATIVE)
  2162.                 keyboard.add_line()
  2163.             keyboard.add_button('💰Баланс', color=VkKeyboardColor.POSITIVE)
  2164.             keyboard.add_button('🎰Казино', color=VkKeyboardColor.POSITIVE)
  2165.             keyboard.add_line()
  2166.             keyboard.add_button('🔐Сейф', color=VkKeyboardColor.POSITIVE)
  2167.             keyboard.add_button('&#129371;Стаканчик', color=VkKeyboardColor.POSITIVE)
  2168.             keyboard.add_line()
  2169.             keyboard.add_button('Комиссия', color=VkKeyboardColor.POSITIVE)
  2170.             keyboard.add_line()
  2171.             keyboard.add_button('&#127380;Узнать мой ID', color=VkKeyboardColor.NEGATIVE)
  2172.             keyboard.add_button('&#127380;Узнать ID по ссылке', color=VkKeyboardColor.NEGATIVE)
  2173.             keyboard.add_line()
  2174.             keyboard.add_button('🔝Топ игроков', color=VkKeyboardColor.NEGATIVE)
  2175.             keyboard.add_button('🔝Топ сейфов', color=VkKeyboardColor.NEGATIVE)
  2176.             keyboard.add_line()
  2177.             keyboard.add_button('&#9881;Настройки', color=VkKeyboardColor.PRIMARY)
  2178.             with open("test.txt") as file:
  2179.                         array = [row.strip() for row in file]
  2180.  
  2181.             vk.messages.send(
  2182.                         chat_id=event.chat_id,
  2183.                         random_id=get_random_id(),
  2184.                         keyboard=keyboard.get_keyboard(),
  2185.                         message=u+'добро пожаловать в меню!'
  2186.                         )
  2187.             vk.messages.send(
  2188.                         chat_id=event.chat_id,
  2189.                         random_id=get_random_id(),
  2190.                         sticker_id = 9880
  2191.                         )
  2192.         else:
  2193.             nul = True
  2194.             #vk.messages.send(
  2195.                         #chat_id=event.chat_id,
  2196.                         #random_id=get_random_id(),
  2197.                         #keyboard=keyboard.get_keyboard(),
  2198.                         #message='&#13;'
  2199.                         #)
  2200.  
  2201.         if str(event.user_id)==str(294716376):
  2202.             ####print(event.attachments)
  2203.             mas = event.text.split(' ',1)
  2204.             if mas[0]=='рассылка':
  2205.              if False:
  2206.                 add = ''
  2207.                 try:
  2208.                     arr = event.attachments
  2209.                 except:
  2210.                     pass
  2211.                 if not len(arr)==0:
  2212.                     for i in range(int(int(len(arr))/2)):
  2213.                         i = i + 1
  2214.                         add = add + arr['attach'+str(i)+'_type'] + arr['attach'+str(i)] + ','
  2215.                 with open("test.txt") as file:
  2216.                     array = [row.strip() for row in file]
  2217.                 for elem in array:
  2218.                  try:
  2219.                     if elem.split(' ')[2] == '1':
  2220.                         id=elem.split(' ')[0]
  2221.                         try:
  2222.                             vk.messages.send  (user_id = id,message = str(mas[1]),keyboard=keyboard.get_keyboard(),attachment = add, random_id = random.randint(1, 999999))
  2223.                         except:
  2224.                             pass
  2225.                  except:
  2226.                         id=elem.split(' ')[0]
  2227.                         try:
  2228.                             vk.messages.send  (user_id = id,message = str(mas[1]),keyboard=keyboard.get_keyboard(),attachment = add, random_id = random.randint(1, 999999))
  2229.                         except:
  2230.                             pass
  2231.             if mas[0]=='выдать':
  2232.                 with open("test.txt") as file:
  2233.                     array = [row.strip() for row in file]
  2234.                 for elem in array:
  2235.                     if elem.split(' ')[0]==mas[1].split(' ')[0]:
  2236.                         try:
  2237.                                         uu = elem.split(' ')[3]
  2238.                         except:
  2239.                                         pass
  2240.                         try:
  2241.                             array[array.index(elem)]=str(elem.split(' ')[0])+' '+str(int(elem.split(' ')[1])+int(mas[1].split(' ')[1]))+' '+elem.split(' ')[2]+' '+uu
  2242.                         except:
  2243.                             array[array.index(elem)]=str(elem.split(' ')[0])+' '+str(int(elem.split(' ')[1])+int(mas[1].split(' ')[1]))
  2244.  
  2245.                 with open("test.txt", "w") as file:
  2246.                          for line in array:
  2247.                             file.write(str(line)+"\n")
  2248.                 id = mas[1].split(' ')[0]
  2249.                 try:
  2250.                     vk.messages.send(user_id=id, message = 'Администратор начислил на ваш баланс ' + des(mas[1].split(' ')[1])+'$!', random_id=random.randint(1,999999))
  2251.                 except:
  2252.                     pass
  2253.                 vk.messages.send(chat_id=event.chat_id, message = 'Успешно. Начислено ' + des(mas[1].split(' ')[1])+'$ [id'+str(id)+'|игроку].', random_id=random.randint(1,999999))
  2254.         if not event.chat_id == 5:
  2255.             pass
  2256.         elif not nul:
  2257.            vk.messages.send  (chat_id = event.chat_id,message = 'Эта беседа создана для общения&#128521;\nБеседа для использования бота находится в закрепе&#128125;', random_id = random.randint(1, 999999))
  2258.  
  2259.      if last_pend>-1:
  2260.          last_pend = event.user_id
  2261.     elif event.type == VkEventType.MESSAGE_NEW and event.to_me:
  2262.      if event.from_user:
  2263.         try:
  2264.          if event.attachments['attach1_type']=='sticker':
  2265.  
  2266.             idstik = event.attachments['attach1']
  2267.             vk.messages.send  (peer_id = event.peer_id,message = 'ID стикера - '+str(idstik)+'\nСсылка на этот стикер как картинку -\nhttps://vk.com/sticker/1-'+idstik+'-512b', random_id = random.randint(1, 999999))
  2268.          else:
  2269.              vk.messages.send(
  2270.                         peer_id = event.peer_id,
  2271.                         random_id=get_random_id(),
  2272.                         message = phr[random.randint(0,len(phr)-1)]
  2273.                         )
  2274.         except:
  2275.             pass
  2276.     elif event.type == VkEventType.MESSAGE_NEW and event.text:
  2277.         ##print(event.text)
  2278.         pass
  2279.     if event.type == VkEventType.MESSAGE_NEW and event.to_me:
  2280.         if random.randint(1,5) == 2:
  2281.             vk.messages.send(peer_id = event.peer_id, message = '&#128276;Полезный совет:\n'+random.choice(hel), random_id = random.randint(1,99999999999))
  2282.     #if event.type == VkEventType.group_join:
  2283.         #vk.messages.send(peer_id = event.peer_id, message = 'Спасибо за подписку на группу!&#128579;', random_id = time.time())
  2284.         ####print('SUUUUB')
  2285.     #if event.type == VkEventType.GROUP_LEAVE:
  2286.         #vk.messages.send(peer_id = event.peer_id, message = 'Жаль, что вы уходите&#128532;', random_id = time.time())
  2287.         ####print('LEAVE')
  2288.     ####print(event.group_id)
  2289.     ###print(event.type)
  2290.   except Exception as e:
  2291.      ####print(e)
  2292.      vk.messages.send(user_id=294716376, message = str(e), random_id=random.randint(1,999999))
  2293. def f_1():
  2294.  while True:
  2295.      global idcurr, daykomis, yester
  2296.      with open("konk.txt") as file:
  2297.                         array = [row.strip() for row in file]
  2298.      array[0] = str(idcurr)+' '+str(daykomis)+' '+str(yester)
  2299.      schedule.run_pending()
  2300.      with open("konk.txt", "w") as file:
  2301.                      for line in array:
  2302.                         file.write(str(line)+"\n")
  2303.      time.sleep(1)
  2304. #while True:
  2305. if False:
  2306.   try:
  2307.     s = requests.Session()
  2308.     s.headers['authorization'] = 'Bearer ' + api_access_token
  2309.     parameters = {'rows': '1'}
  2310.     h = s.get('https://edge.qiwi.com/payment-history/v1/persons/'+my_login+'/payments', params = parameters)#####print(json.loads(h.text))#####print(h.text)
  2311.     new=json.loads(h.text)
  2312.     curr_num=int(new['data'][0]['txnId'])
  2313.     ####print(" - " + str (new['data'][0]['sum']['amount']) + "р")
  2314.     ####print(" -"+str(new['data'][0]["account"]))
  2315.     ####print(" - '"+str(new['data'][0]["comment"])+"'")
  2316.     #####print(yoy['lava'][0])
  2317.     # ####print(new['data'])
  2318.     uavv=[]
  2319.     abc = str(new['data'][0]["comment"])
  2320.     #####print(abc)
  2321.     uavv=abc.split(" ")
  2322.     ya=1
  2323.     uavv2=str(last_mess).split(" ")
  2324.     time.sleep(2000)
  2325.     try:
  2326.         #####print(uavv)
  2327.         idvk=int(uavv[0])
  2328.         ya=int(idvk)
  2329.     except:
  2330.         yyy=0
  2331.         yyy=yyy
  2332.   except:
  2333.       pass
  2334.  
  2335. th_1, th_2 = Thread(target=f), Thread(target = f_1)
  2336. if __name__ == '__main__':
  2337.     th_1.start(), th_2.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement