Advertisement
Guest User

Untitled

a guest
May 4th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.64 KB | None | 0 0
  1. # !/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import sys
  4. import threading
  5. import vk_api
  6. from vk_api.longpoll import VkLongPoll, VkEventType
  7. from vk_api.keyboard import VkKeyboard, VkKeyboardColor
  8. from datetime import datetime
  9. import random
  10. import time
  11. import os
  12. import pymysql.cursors
  13. import logging
  14. import vkcoin
  15.  
  16. file_log = logging.FileHandler('Log.log')
  17. console_out = logging.StreamHandler()
  18. merchant = vkcoin.VKCoinApi(user_id=242193778, key='G7Y0tMmvqOPfXInBSYkO,JawJ42GonTpyC,7h-VV4_6aXv0Oxd') # Ваш ID и ключ
  19. logging.basicConfig(handlers=(file_log, console_out),
  20. level=logging.INFO)
  21.  
  22.  
  23. logging.basicConfig(filename="sample.log", level=logging.INFO)
  24. """ БД """
  25. def connecti():
  26. conn = pymysql.connect(host='127.0.0.1',
  27. user='root',
  28. password='',
  29. db='vkbot',
  30. charset='utf8mb4',
  31. cursorclass=pymysql.cursors.DictCursor)
  32. return conn
  33.  
  34. def register(imid):
  35. connection = connecti()
  36. try:
  37. with connection.cursor() as cursor:
  38. result = cursor.execute(f"SELECT * FROM account WHERE idvk={imid}")
  39. row = cursor.fetchone()
  40. if result == 0:
  41. cursor.execute(f"INSERT INTO account(idvk) VALUES({imid})")
  42. connection.commit()
  43. else:
  44. return row
  45. finally:
  46. connection.close()
  47.  
  48. def getdate (imid):
  49. connect = connecti()
  50. try:
  51. with connect.cursor() as cursor:
  52. result = cursor.execute(f"SELECT * FROM account WHERE idvk={imid}")
  53. row = cursor.fetchone()
  54. if result == 1:
  55. return row
  56. finally:
  57. connect.close()
  58.  
  59. def savedate (imid, iq1, nickname1, job1, jobn1, timeend1, pazle1, paper1, excoins1, frac1, chees,doc,prog,sprog,atack,defend,regen,vs,statsb,vkcoin,testing):
  60. connect = connecti()
  61. try:
  62. with connect.cursor() as cursor:
  63. result = cursor.execute(f"UPDATE account SET testing={testing}, iq={iq1}, nickname='{nickname1}', job='{job1}', jobn={jobn1}, timeend={timeend1}, pazle={pazle1}, paper={paper1}, excoins={excoins1}, frac='{frac1}', chees={chees}, doc={doc}, prog = {prog}, sprog = {sprog}, atack = {atack}, defend = {defend}, regen = {regen}, vs={vs}, statsb={statsb}, vkcoin={vkcoin} WHERE idvk={imid}")
  64. connect.commit()
  65. return result
  66. finally:
  67. connect.close()
  68. def savedatecoin (imid, vkcoin):
  69. connect = connecti()
  70. try:
  71. with connect.cursor() as cursor:
  72. result = cursor.execute(f"UPDATE account SET vkcoin={vkcoin} WHERE idvk={imid}")
  73. connect.commit()
  74. return result
  75. finally:
  76. connect.close()
  77. # БД
  78. token = "d1e176c0a8f1e69f6e07c76b4b4a7c361a31852b348960f8867f807846f21c4608e19b6bd2b226bd8e936" #Авторизация
  79. vk_session = vk_api.VkApi(token=token)
  80. session_api = vk_session.get_api()
  81. longpoll = VkLongPoll(vk_session)
  82.  
  83. def captcha_handler(captcha):
  84. key = input("Enter captcha code {0}: ".format(captcha.get_url())).strip()
  85. return captcha.try_again(key)
  86.  
  87.  
  88. # Клавиатуры
  89. def create_keyboard(response):
  90. keyboard = VkKeyboard(one_time=True)
  91.  
  92. keyboard.add_button('Я', color=VkKeyboardColor.NEGATIVE)
  93. keyboard.add_button('Работы', color=VkKeyboardColor.POSITIVE)
  94. keyboard.add_button('Магазин', color=VkKeyboardColor.POSITIVE)
  95. keyboard.add_line()
  96. keyboard.add_button('Дела', color=VkKeyboardColor.DEFAULT)
  97. keyboard.add_button('Vkcoin', color=VkKeyboardColor.POSITIVE)
  98. keyboard.add_button('Битва', color=VkKeyboardColor.POSITIVE)
  99. keyboard.add_line()
  100. keyboard.add_button('Казино', color=VkKeyboardColor.POSITIVE)
  101. keyboard.add_line()
  102. keyboard.add_button('Работать', color=VkKeyboardColor.DEFAULT)
  103.  
  104. keyboard = keyboard.get_keyboard()
  105. return keyboard
  106.  
  107. def create_rabota(response):
  108. keyboard = VkKeyboard(one_time=True)
  109.  
  110. keyboard.add_button('Уборщик', color=VkKeyboardColor.POSITIVE)
  111. keyboard.add_button('Дворник', color=VkKeyboardColor.POSITIVE)
  112. keyboard.add_line()
  113. keyboard.add_button('Строитель', color=VkKeyboardColor.POSITIVE)
  114. keyboard.add_button('Архитектор', color=VkKeyboardColor.POSITIVE)
  115. keyboard.add_line()
  116. keyboard.add_button('Спасатель', color=VkKeyboardColor.POSITIVE)
  117. keyboard.add_button('Юрист', color=VkKeyboardColor.POSITIVE)
  118. keyboard.add_line()
  119. keyboard.add_button('Дизайнер', color=VkKeyboardColor.POSITIVE)
  120. keyboard.add_button('Разработчик', color=VkKeyboardColor.POSITIVE)
  121. keyboard.add_line()
  122. keyboard.add_button('Я', color=VkKeyboardColor.NEGATIVE)
  123.  
  124. keyboard = keyboard.get_keyboard()
  125. return keyboard
  126.  
  127. def create_dela(response):
  128. keyboard = VkKeyboard(one_time=True)
  129.  
  130. keyboard.add_button('Собирать пазлы', color=VkKeyboardColor.DEFAULT)
  131. keyboard.add_button('Читать газету', color=VkKeyboardColor.POSITIVE)
  132. keyboard.add_line()
  133. keyboard.add_button('Играть в шахматы', color=VkKeyboardColor.POSITIVE)
  134. keyboard.add_button('Читать техническую документацию', color=VkKeyboardColor.POSITIVE)
  135. keyboard.add_line()
  136. keyboard.add_button('Практиковаться в программировании', color=VkKeyboardColor.POSITIVE)
  137. keyboard.add_button('Написать высоконагруженный проект', color=VkKeyboardColor.POSITIVE)
  138. keyboard.add_line()
  139. keyboard.add_button('Я', color=VkKeyboardColor.NEGATIVE)
  140.  
  141.  
  142. keyboard = keyboard.get_keyboard()
  143. return keyboard
  144. def create_magaz(response):
  145. keyboard = VkKeyboard(one_time=True)
  146. keyboard.add_button('Пистолет', color=VkKeyboardColor.NEGATIVE)
  147. keyboard.add_button('Деревянный щит', color=VkKeyboardColor.POSITIVE)
  148. keyboard.add_line()
  149. keyboard.add_button('Пистолет - пулемёт', color=VkKeyboardColor.NEGATIVE)
  150. keyboard.add_button('Металлический щит', color=VkKeyboardColor.POSITIVE)
  151. keyboard.add_line()
  152. keyboard.add_button('АКМ', color=VkKeyboardColor.NEGATIVE)
  153. keyboard.add_button('Энергетический щит', color=VkKeyboardColor.POSITIVE)
  154. keyboard.add_line()
  155. keyboard.add_button('Самонаводящяяся базука', color=VkKeyboardColor.NEGATIVE)
  156. keyboard.add_button('Энергетическая стена', color=VkKeyboardColor.POSITIVE)
  157. keyboard.add_line()
  158. keyboard.add_button('Автоматическая пушка ', color=VkKeyboardColor.NEGATIVE)
  159. keyboard.add_button('Щит из сверхпрочной стали', color=VkKeyboardColor.POSITIVE)
  160. keyboard.add_line()
  161. keyboard.add_button('Щит из тёмной материи', color=VkKeyboardColor.POSITIVE)
  162. keyboard.add_button('Я', color=VkKeyboardColor.DEFAULT)
  163. keyboard = keyboard.get_keyboard()
  164. return keyboard
  165.  
  166. def create_fractionkey(response):
  167. keyboard = VkKeyboard(one_time=True)
  168. keyboard.add_button('Фракция1', color=VkKeyboardColor.DEFAULT)
  169. keyboard.add_button('Фракция2', color=VkKeyboardColor.POSITIVE)
  170. keyboard = keyboard.get_keyboard()
  171. return keyboard
  172. def create_kazs(response):
  173. keyboard = VkKeyboard(one_time=True)
  174. keyboard.add_button('Угадай число', color=VkKeyboardColor.NEGATIVE)
  175. keyboard.add_line()
  176. keyboard.add_button('Я', color=VkKeyboardColor.DEFAULT)
  177. keyboard = keyboard.get_keyboard()
  178. return keyboard
  179. def create_atackkey(response):
  180. keyboard = VkKeyboard(one_time=True)
  181. keyboard.add_button('Атака', color=VkKeyboardColor.NEGATIVE)
  182. keyboard.add_button('Защита', color=VkKeyboardColor.POSITIVE)
  183. keyboard.add_line()
  184. keyboard.add_button('Назад', color=VkKeyboardColor.DEFAULT)
  185. keyboard = keyboard.get_keyboard()
  186. return keyboard
  187. def create_nz(response):
  188. keyboard = VkKeyboard(one_time=True)
  189. keyboard.add_button('я', color=VkKeyboardColor.NEGATIVE)
  190. keyboard = keyboard.get_keyboard()
  191. return keyboard
  192. def create_vkcoinkey(response):
  193. keyboard = VkKeyboard(one_time=True)
  194. keyboard.add_button('Пополнить', color=VkKeyboardColor.POSITIVE)
  195. keyboard.add_button('Я', color=VkKeyboardColor.NEGATIVE)
  196. keyboard = keyboard.get_keyboard()
  197. return keyboard
  198. def kaz(stav):
  199. random.randint(0,100)
  200. def create_stav4(response):
  201. keyboard = VkKeyboard(one_time=True)
  202. keyboard.add_button('100', color=VkKeyboardColor.POSITIVE)
  203. keyboard.add_button('500', color=VkKeyboardColor.NEGATIVE)
  204. keyboard.add_line()
  205. keyboard.add_button('1000', color=VkKeyboardColor.POSITIVE)
  206. keyboard.add_button('5000', color=VkKeyboardColor.NEGATIVE)
  207. keyboard.add_line()
  208. keyboard.add_button('10000', color=VkKeyboardColor.POSITIVE)
  209. keyboard.add_button('15000', color=VkKeyboardColor.NEGATIVE)
  210. keyboard = keyboard.get_keyboard()
  211. return keyboard
  212. while True:
  213. for event in longpoll.listen():
  214. if event.type == VkEventType.MESSAGE_NEW:
  215. print(f'<{str(datetime.strftime(datetime.now(), "%H:%M:%S"))}> ({str(event.user_id)}) -> {str(event.text)}')
  216. response = event.text.lower()
  217. if event.from_user and not event.from_me and imid == event.user_id:
  218. if response=="100":
  219.  
  220.  
  221. def create_kaz2(response,imid):
  222. keyboard = VkKeyboard(one_time=True)
  223. keyboard.add_button('1-49', color=VkKeyboardColor.POSITIVE)
  224. keyboard.add_button('51-99', color=VkKeyboardColor.NEGATIVE)
  225. keyboard = keyboard.get_keyboard()
  226. return keyboard
  227. while True:
  228. for event in longpoll.listen():
  229. if event.type == VkEventType.MESSAGE_NEW:
  230. print(f'<{str(datetime.strftime(datetime.now(), "%H:%M:%S"))}> ({str(event.user_id)}) -> {str(event.text)}')
  231. response = event.text.lower()
  232. if event.from_user and not event.from_me and imid == event.user_id:
  233. if response == "1-49":
  234. am = 1
  235. keyboard = create_stav4(response,am)
  236. vk_session.method('messages.send', {'user_id': imid, 'message': f"Выбери ставку",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  237. break
  238. elif response == "51-99":
  239. am = 2
  240. keyboard = create_stav4(response,am)
  241. vk_session.method('messages.send', {'user_id': imid, 'message': f"Выбери ставку",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  242. break
  243. def noiq(imid, iqneed,iq):
  244. keyboard = create_rabota(response)
  245. vk_session.method('messages.send', {'user_id': imid, 'message': f'У вас не достаточно {iqneed-iq} IQ, чтобы его прокачать, зайдите в пункт дела', 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  246.  
  247.  
  248. """
  249. Основная функция
  250. """
  251. def mesed (imid, responsce):
  252. row = register(imid)
  253. row = getdate(imid)
  254. job = row['job']
  255. iq = row['iq']
  256. nickname = row['nickname']
  257. excoins = row['excoins']
  258. timeend = row['timeend']
  259. jobn = row['jobn']
  260. pazle = row['pazle']
  261. paper = row['paper']
  262. frac = str(row['frac'])
  263. chees = row['chees']
  264. doc = row['doc']
  265. prog = row['prog']
  266. strongprog = row['sprog']
  267. atack = row['atack']
  268. defend = row['defend']
  269. regen = row['regen']
  270. vs = row['vs']
  271. statsb = row['statsb']
  272. vkcoin = row['vkcoin']
  273. testing = row['testing']
  274.  
  275. if nickname == "":
  276. vk_session.method('messages.send', {'user_id': event.user_id, 'message': 'У вас не установлен ник, пожалуйста введите его :) ', 'random_id': random.randint(0, 9999999999), 'captcha_handler': captcha_handler})
  277. nickname = "*"
  278. elif nickname == "*":
  279. nickname = response
  280. keyboard = create_fractionkey(response)
  281. vk_session.method('messages.send',{'user_id': event.user_id, 'message': ' /*Ник установлен*/ Так же, тебе надо выбрать фракцию за которую ты будешь играть ', 'keyboard': keyboard,'random_id': random.randint(0, 9999999999), 'captcha_handler': captcha_handler})
  282. frac = "404"
  283. elif frac == "404":
  284. vk_session.method('messages.send', {'user_id': imid, 'message': "/*Фракция выбрана*/ \n О чём игра? \n Ты уже выбрал фракцию за которую ты будешь воевать, теперь именно они твои братья. \n Каждый день в 3 часа проходит битва в которой ты должен сражаться как атакующий или защищающий \n Чтобы увеличить урон или защиту, нужно купить предметы в магазине за excoins \n Чтобы заработать деньги нужно устроиться на работу, но не все работы будут доступны тебе сразу, для некоторых работ требуется равзитие тоесть очки IQ которые можно заработать в разделе Дела. \n Ну что-ж! Начнём. Для продолжения введите Я", 'random_id': random.randint(0, 9999999999), 'captcha_handler': captcha_handler})
  285. if response == "фракция1":
  286. frac = "фракция1"
  287. if response == "фракция2":
  288. frac = "фракция2"
  289. else:
  290. keyboard = create_stav4(response)
  291.  
  292. if response == "я":
  293. d1 = datetime.utcnow()
  294. d2 = datetime(d1.year,d1.month,d1.day,19)
  295. sc = round((d2-d1).total_seconds())
  296. mc = int(sc/60)
  297. hc = mc/60
  298. if hc < 0 and mc < 0:
  299. timebitva = f"Завтра в 18:00"
  300. elif hc < 1:
  301. timebitva = f"через {mc} минут"
  302. elif hc >=1:
  303. timebitva = f"через {round(hc)} часов {mc - (round(hc)*60)} минут"
  304. keyboard = create_keyboard(response)
  305. if statsb == 1:
  306. stb = "атаковать"
  307. elif statsb == 2:
  308. stb = "защищать"
  309. messa = "🔎Я, " + str(nickname) + f"\n🚧Ваша фракция {frac}"
  310. messa = messa + "\n\n🔥Ваша работа: " + str(job) + " \n🧬Ваш IQ: " + str(iq) + "\n💰Ваш баланс: " + str(excoins) + f" excoins | {vkcoin} vkcoins"+f"\n\n 🧰Навыки: \n\n ⚔Атака:{atack} \n 🧯Защита:{defend} \n ⚒Регенерация:{regen} \n 🔋Выносливость:{vs} \n\n 🚨Битва {timebitva} \n 🚦Вы собрались {stb}"
  311. vk_session.method('messages.send', {'user_id': imid, 'message': messa, 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  312. elif response =="vkcoin":
  313. keyboard = create_vkcoinkey(response)
  314. vk_session.method('messages.send', {'user_id': event.user_id,
  315. 'message': 'Меню действий с vkcoin',
  316. 'keyboard': keyboard, 'random_id': random.randint(0, 9999999999),
  317. 'captcha_handler': captcha_handler})
  318. elif response == "пополнить":
  319. keyboard = create_nz(response)
  320. result = merchant.get_payment_url(amount=10, payload=78922, free_amount=True)
  321. vk_session.method('messages.send', {'user_id': event.user_id,
  322. 'message': f'Вот ваша ссылка - {result} Сумму выбирайте сами.',
  323. 'keyboard': keyboard, 'random_id': random.randint(0, 9999999999),
  324. 'captcha_handler': captcha_handler})
  325. elif response == "битва":
  326. keyboard = create_atackkey(response)
  327. vk_session.method('messages.send',{'user_id': imid, 'message': f'Это меню битвы, выберите будите вы атаковать или защищаться\n При атаке важен навыки ⚔Атака и 🔋Выносливость \n При Защите навыки ⚒Регенерация и 🧯Защита. \n Точный алгоритм битвы засекречен, но есть смысл и атаковать и защищаться. \n А теперь выбирите, будете вы защищться или атаковать', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  328. elif response == "атака":
  329. statsb = 1
  330. keyboard = create_nz(response)
  331. vk_session.method('messages.send', {'user_id': event.user_id,
  332. 'message': 'Вы установили статус битвы, чтобы вернуться нажмите Я ',
  333. 'random_id': random.randint(0, 9999999999),
  334. 'captcha_handler': captcha_handler, 'keyboard': keyboard} )
  335. elif response == "защита":
  336. statsb = 2
  337. keyboard = create_nz(response)
  338. vk_session.method('messages.send', {'user_id': event.user_id,
  339. 'message': 'Вы установили статус битвы, чтобы вернуться нажмите Я ',
  340. 'random_id': random.randint(0, 9999999999),
  341. 'captcha_handler': captcha_handler, 'keyboard': keyboard})
  342.  
  343. elif response == "работы":
  344. keyboard = create_rabota(response)
  345. vk_session.method('messages.send', {'user_id': imid, 'message': 'Работы: \n Название\iq необходимо\время\зарплата \nУборщик 0iq 1мин 1coin \nДворник 5iq 1.5 мин 3coin\nСтроитель 10iq 2мин 8сoin\nАрхитектор 30iq 2мин 10 coin\nСпасатель 50iq 2мин 20coin\nЮрист 100iq 3 мин 40coin\nДизайнер 120iq 4мин 50coin\nРазработчик 300iq 5мин 100coin', 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  346. elif response == "уборщик":
  347. job = "уборщик"
  348. jobn = 1
  349. keyboard = create_keyboard(response)
  350. vk_session.method('messages.send',{'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  351. elif response == "дворник":
  352. if iq>=5:
  353. job = "дворник"
  354. jobn = 2
  355. keyboard = create_keyboard(response)
  356. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  357. else:
  358. noiq(imid,5,iq)
  359. elif response == "строитель":
  360. if iq >= 10:
  361. job = "строитель"
  362. jobn = 3
  363. keyboard = create_keyboard(response)
  364. vk_session.method('messages.send',{'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  365. else:
  366. noiq(imid,10,iq)
  367. elif response == "архитектор":
  368. if iq >= 30:
  369. job = "архитектор"
  370. jobn = 4
  371. keyboard = create_keyboard(response)
  372. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  373. else:
  374. noiq(imid,30,iq)
  375. elif response == "спасатель":
  376. if iq >= 50:
  377. job = "спасатель"
  378. jobn = 5
  379. keyboard = create_keyboard(response)
  380. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  381. else:
  382. noiq(imid,50,iq)
  383. elif response == "юрист":
  384. if iq >= 100:
  385. job = "юрист"
  386. jobn = 6
  387. keyboard = create_keyboard(response)
  388. vk_session.method('messages.send',{'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  389. else:
  390. noiq(imid,100,iq)
  391. elif response == "дизайнер":
  392. if iq >= 120:
  393. job = "дизайнер"
  394. jobn = 7
  395. keyboard = create_keyboard(response)
  396. vk_session.method('messages.send',{'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  397. else:
  398. noiq(imid,120,iq)
  399. elif response == "разработчик":
  400. if iq >= 300:
  401. job = "разработчик"
  402. jobn = 8
  403. keyboard = create_keyboard(response)
  404. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы устроились на работу {job}', 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  405. else:
  406. noiq(imid,300,iq)
  407. elif response == "дела":
  408. keyboard = create_dela(response)
  409. vk_session.method('messages.send', {'user_id': imid, 'message': f'Дела нужны чтобы прокачать ваш IQ \n 1) Собрать пазлы Стоимость: {pazle} +0.1iq \n2) Читать газету Стоимость: {paper} +0.2 iq \n3) Играть в шахматы Стоимость:{chees} +0.5iq \n4) Читать техническую документацию Стоимость: {doc} + 1iq \n5) Практиковаться в программировании Стоимость: {prog} +3iq Только при iq>50 \n6) Написать высоконагруженный проект Стоимость: {strongprog} +10 iq Только при iq>150', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  410. elif response == "собирать пазлы":
  411. if int(excoins) >= float(pazle):
  412. excoins = excoins - pazle
  413. pazle = pazle*1.5
  414. iq = iq+0.1
  415. keyboard = create_dela(response)
  416. vk_session.method('messages.send',
  417. {'user_id': imid, 'message': f'Вы собрали пазлы для детей от 3ёх лет. Не сильно помогло вам, но эффект явно есть ;-) \n +0.1 IQ, теперь у вас {iq}',
  418. 'random_id': random.randint(0, 9999999999),
  419. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  420. else:
  421. keyboard = create_dela(response)
  422. vk_session.method('messages.send',{'user_id': imid, 'message': f'У вас не хватает 💰 {pazle - excoins} excoins', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  423. elif response == "играть в шахматы":
  424. if int(excoins) >= float(chees):
  425. excoins = excoins - chees
  426. chees = chees * 1.5
  427. iq = iq + 0.5
  428. keyboard = create_dela(response)
  429. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы поиграли в шахматы, +0.5 IQ, теперь у вас {iq}',
  430. 'random_id': random.randint(0, 9999999999),
  431. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  432. else:
  433. keyboard = create_dela(response)
  434. vk_session.method('messages.send',{'user_id': imid, 'message': f'У вас не хватает 💰 {chees - excoins} excoins', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  435. elif response == "читать газету":
  436. if int(excoins) >= float(paper):
  437. excoins = excoins - paper
  438. paper = paper * 1.5
  439. iq = iq + 0.2
  440. keyboard = create_dela(response)
  441. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы прочитали газету, там было очень много жёлтых новостей, но попались и интерестные статьи \n +0.2 IQ, теперь у вас {iq}',
  442. 'random_id': random.randint(0, 9999999999),
  443. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  444. else:
  445. keyboard = create_dela(response)
  446. vk_session.method('messages.send',{'user_id': imid, 'message': f'У вас не хватает 💰 {paper - excoins} excoins ', 'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  447. elif response == "читать техническую документацию":
  448. if int(excoins) >= float(doc):
  449. excoins = excoins - doc
  450. paper = paper * 1.5
  451. iq = iq + 1
  452. keyboard = create_dela(response)
  453. vk_session.method('messages.send', {'user_id': imid, 'message': f'Вы прочитали техническую документацию, может быть, не до конца всё поняли, но определённая польза всё же была \n +1 IQ, теперь у вас {iq}',
  454. 'random_id': random.randint(0, 9999999999),
  455. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  456. else:
  457. keyboard = create_dela(response)
  458. vk_session.method('messages.send',
  459. {'user_id': imid, 'message': f'У вас не хватает 💰 {doc - excoins} excoins',
  460. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  461. 'captcha_handler': captcha_handler})
  462. elif response == "практиковаться в программировании":
  463. if iq >= 50:
  464. if int(excoins) >= float(prog):
  465. excoins = excoins - doc
  466. doc = doc * 1.5
  467. iq = iq + 3
  468. keyboard = create_dela(response)
  469. vk_session.method('messages.send', {'user_id': imid,
  470. 'message': f'Вы попрактиковались в программировании и написали не сложную программку \n +3 IQ, теперь у вас {iq}',
  471. 'random_id': random.randint(0, 9999999999),
  472. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  473. else:
  474. keyboard = create_dela(response)
  475. vk_session.method('messages.send',{'user_id': imid, 'message': f'У вас не хватает 💰 {doc - excoins} excoins ',
  476. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  477. 'captcha_handler': captcha_handler})
  478. else:
  479. keyboard = create_dela(response)
  480. vk_session.method('messages.send',
  481. {'user_id': imid, 'message': f'Вы ещё не достаточно умны чтобы программировать нехваатет {50-iq}IQ',
  482. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  483. 'captcha_handler': captcha_handler})
  484. elif response == "написать высоконагруженный проект":
  485. if iq >= 150:
  486. if int(excoins) >= float(strongprog):
  487. excoins = excoins - strongprog
  488. strongprog = strongprog * 1.5
  489. iq = iq + 7
  490. keyboard = create_dela(response)
  491. vk_session.method('messages.send', {'user_id': imid,
  492. 'message': f'Вы попрактиковались в программировании и написали не сложную программу \n +7 IQ, теперь у вас {iq}',
  493. 'random_id': random.randint(0, 9999999999),
  494. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  495. else:
  496. keyboard = create_dela(response)
  497. vk_session.method('messages.send',{'user_id': imid, 'message': f'У вас не хватает 💰 {strongprog - excoins} excoins',
  498. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  499. 'captcha_handler': captcha_handler})
  500. else:
  501. keyboard = create_dela(response)
  502. vk_session.method('messages.send',
  503. {'user_id': imid, 'message': f'Вы ещё не достаточно умны чтобы писать сложные программы нехваатет {150-iq}IQ',
  504. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  505. 'captcha_handler': captcha_handler})
  506. elif response == "работать":
  507. gg = 0
  508. if timeend != 0:
  509. ep = datetime(1970,1,1,0,0,0)
  510. timegagh = (datetime.utcnow()- ep).total_seconds()
  511. gg = timegagh - timeend
  512. if jobn == 0:
  513. keyboard = create_keyboard(response)
  514. vk_session.method('messages.send',
  515. {'user_id': imid, 'message': "🤣🤣Сначала вы должны устроиться на работу. \n ‼ Для этого в главном меню есть пункт работы.",
  516. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  517. 'captcha_handler': captcha_handler})
  518.  
  519. if jobn == 1:
  520. if gg >= 60 and timeend != 0:
  521. keyboard = create_keyboard(response)
  522. excoins = int(excoins)+1
  523. vk_session.method('messages.send', {'user_id': imid, 'message': "+1 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  524. timeend = 0
  525. elif gg < 60 and timeend != 0:
  526. keyboard = create_keyboard(response)
  527. endf = round(60 - gg)
  528. endf = int(endf)
  529. if endf / 60 < 1:
  530. mf = 0
  531. else:
  532. mf = endf / 60
  533. vk_session.method('messages.send', {'user_id': imid,
  534. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  535. 'random_id': random.randint(0, 9999999999),
  536. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  537. elif timeend == 0:
  538. keyboard = create_keyboard(response)
  539. vk_session.method('messages.send', {'user_id': imid, 'message': "Вы начали работать уборщиком, это займет 1 минуту. \nВажно, чтобы получить зарплату через 1 или более минуту сного нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  540. ep = datetime(1970,1,1,0,0,0)
  541. timeend = round((datetime.utcnow()- ep).total_seconds())
  542. elif jobn == 2:
  543. if gg >= 90 and timeend != 0:
  544. keyboard = create_keyboard(response)
  545. excoins = int(excoins)+5
  546. vk_session.method('messages.send', {'user_id': imid, 'message': "+3 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  547. timeend = 0
  548. elif gg < 90 and timeend != 0:
  549. keyboard = create_keyboard(response)
  550. endf = round(90 - gg)
  551. if endf/60 < 1:
  552. mf = 0
  553. else:
  554. mf = endf/60
  555. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы еще не доработали, осталось {mf} минут {endf%60} секунд" , 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  556. elif timeend == 0:
  557. keyboard = create_keyboard(response)
  558. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы начали работать Дворником, это займет 1.5 минуты. \nВажно, чтобы получить зарплату через 1.5 или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  559. ep = datetime(1970,1,1,0,0,0)
  560. timeend = round((datetime.utcnow()- ep).total_seconds())
  561. elif jobn == 3:
  562. timek = 120
  563. if gg >= timek and timeend != 0:
  564. keyboard = create_keyboard(response)
  565. excoins = int(excoins)+8
  566. vk_session.method('messages.send', {'user_id': imid, 'message': "+5 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  567. timeend = 0
  568. elif gg < timek and timeend != 0:
  569. keyboard = create_keyboard(response)
  570. endf = round(timek - gg)
  571. if endf / 60 < 1:
  572. mf = 0
  573. else:
  574. mf = endf / 60
  575. vk_session.method('messages.send', {'user_id': imid,
  576. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  577. 'random_id': random.randint(0, 9999999999),
  578. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  579. elif timeend == 0:
  580. keyboard = create_keyboard(response)
  581. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы начали работать Строителем, это займет {timek/60} минут. \nВажно, чтобы получить зарплату через {timek/60} или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  582. ep = datetime(1970,1,1,0,0,0)
  583. timeend = round((datetime.utcnow()- ep).total_seconds())
  584. elif jobn == 4:
  585. timek = 120
  586. if gg >= timek and timeend != 0:
  587. keyboard = create_keyboard(response)
  588. excoins = int(excoins)+10
  589. vk_session.method('messages.send', {'user_id': imid, 'message': "+20 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  590. timeend = 0
  591. elif gg < timek and timeend != 0:
  592. keyboard = create_keyboard(response)
  593. endf = round(timek - gg)
  594. if endf / 60 < 1:
  595. mf = 0
  596. else:
  597. mf = endf / 60
  598. vk_session.method('messages.send', {'user_id': imid,
  599. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  600. 'random_id': random.randint(0, 9999999999),
  601. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  602. elif timeend == 0:
  603. keyboard = create_keyboard(response)
  604. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы начали работать Архитектором, это займет {timek/60} минут. \nВажно, чтобы получить зарплату через {timek/60} или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  605. ep = datetime(1970,1,1,0,0,0)
  606. timeend = round((datetime.utcnow()- ep).total_seconds())
  607. elif jobn == 5:
  608. timek = 120
  609. if gg >= timek and timeend != 0:
  610. keyboard = create_keyboard(response)
  611. excoins = int(excoins)+20
  612. vk_session.method('messages.send', {'user_id': imid, 'message': "+20 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  613. timeend = 0
  614. elif gg < timek and timeend != 0:
  615. keyboard = create_keyboard(response)
  616. endf = round(timek - gg)
  617. if endf / 60 < 1:
  618. mf = 0
  619. else:
  620. mf = endf / 60
  621. vk_session.method('messages.send', {'user_id': imid,
  622. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  623. 'random_id': random.randint(0, 9999999999),
  624. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  625. elif timeend == 0:
  626. keyboard = create_keyboard(response)
  627. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы начали работать Спасателем, это займет {timek/60} минут. \nВажно, чтобы получить зарплату через {timek/60} или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  628. ep = datetime(1970,1,1,0,0,0)
  629. timeend = round((datetime.utcnow()- ep).total_seconds())
  630. elif jobn == 6:
  631. timek = 180
  632. if gg >= timek and timeend != 0:
  633. keyboard = create_keyboard(response)
  634. excoins = int(excoins)+40
  635. vk_session.method('messages.send', {'user_id': imid, 'message': "+40 excoin\nЧтобы вернуться нажмите Я", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  636. timeend = 0
  637. elif gg < timek and timeend != 0:
  638. keyboard = create_keyboard(response)
  639. endf = round(timek - gg)
  640. if endf / 60 < 1:
  641. mf = 0
  642. else:
  643. mf = endf / 60
  644. vk_session.method('messages.send', {'user_id': imid,
  645. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  646. 'random_id': random.randint(0, 9999999999),
  647. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  648. elif timeend == 0:
  649. keyboard = create_keyboard(response)
  650. vk_session.method('messages.send', {'user_id': imid, 'message': f"🤔Вы начали работать Юристом, это займет {timek/60} минут. \nВажно, чтобы получить зарплату через {timek/60} или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  651. ep = datetime(1970,1,1,0,0,0)
  652. timeend = round((datetime.utcnow()- ep).total_seconds())
  653. elif jobn == 7:
  654. timek = 240
  655. if gg >= timek and timeend != 0:
  656. keyboard = create_keyboard(response)
  657. excoins = int(excoins) + 50
  658. vk_session.method('messages.send',{'user_id': imid, 'message': "+50 excoin\nЧтобы вернуться нажмите Я",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  659. timeend = 0
  660. elif gg < timek and timeend != 0:
  661. keyboard = create_keyboard(response)
  662. endf = round(timek - gg)
  663. if endf / 60 < 1:
  664. mf = 0
  665. else:
  666. mf = endf / 60
  667. vk_session.method('messages.send', {'user_id': imid,
  668. 'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",
  669. 'random_id': random.randint(0, 9999999999),
  670. 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  671. elif timeend == 0:
  672. keyboard = create_keyboard(response)
  673. vk_session.method('messages.send', {'user_id': imid,'message': f"🤔Вы начали работать Дизайнером, это займет {timek / 60} минут. \nВажно, чтобы получить зарплату через {timek / 60} или более минут ещё раз нажмите Работать", 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  674. ep = datetime(1970, 1, 1, 0, 0, 0)
  675. timeend = round((datetime.utcnow() - ep).total_seconds())
  676. elif jobn == 8:
  677. timek = 300
  678. if gg >= timek and timeend != 0:
  679. keyboard = create_keyboard(response)
  680. excoins = int(excoins) + 100
  681. vk_session.method('messages.send',{'user_id': imid, 'message': "+50 excoin\nЧтобы вернуться нажмите Я",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  682. timeend = 0
  683. elif gg < timek and timeend != 0:
  684. keyboard = create_keyboard(response)
  685. endf = round(timek - gg)
  686. if endf / 60 < 1:
  687. mf = 0
  688. else:
  689. mf = endf / 60
  690. vk_session.method('messages.send', {'user_id': imid,'message': f"Вы еще не доработали, осталось {mf} минут {endf % 60} секунд",'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  691. elif timeend == 0:
  692. keyboard = create_keyboard(response)
  693. vk_session.method('messages.send', {'user_id': imid,'message': f"🤔Вы начали работать Разработчиком, это займет {timek / 60} минут. \nВажно, чтобы получить зарплату через {timek / 60} или более минут ещё раз нажмите Работать",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  694. ep = datetime(1970, 1, 1, 0, 0, 0)
  695. timeend = round((datetime.utcnow() - ep).total_seconds())
  696. elif response == "магазин":
  697. keyboard = create_magaz(response)
  698. vk_session.method('messages.send', {'user_id': imid,'message': f"Это магазин тут вы можете купить разные предметы для повышения своих навыком, они вам помогут в битве\n Предмет | Навык | Стоимость \n-----------------------------------------------\nПистолет | Атака +1 | 10 excoins\nПистолет - пулемёт | Атака +4 | 20 excoins\nАКМ | Атака +7 | 50 excoins\nАвтоматический пулемёт | Атака +13 | 100 excoins\nРПГ | Атака +20 | 1000 excoins\nСамонаводящяяся базука | Атака +25 | 5000 excoins\nАвтоматическая пушка | Атака +50 | 10000 excoins\nДеревянный щит | Защита +1 | 5 excoins\nМеталлический щит | Защита +5 | 30 excoins\nЭнергетический щит | Защита +10| 50 excoins\nЭнергетическая стена | Защита +20| 300 excoins\nЩит из сверхпрочной стали | Защита +30| 1000 excoins\nЩит из тёмной материи | Защита +55| 8500 excoins\n ",'random_id': random.randint(0, 9999999999),'keyboard': keyboard, 'captcha_handler': captcha_handler})
  699.  
  700. elif response == "пистолет":
  701. if excoins>=10:
  702. atack = atack+1
  703. excoins = excoins - 10
  704. keyboard = create_magaz(response)
  705. vk_session.method('messages.send', {'user_id': imid, 'message': f"Вы купили пистолет +1 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  706. else:
  707. keyboard = create_magaz(response)
  708. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {10-excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  709. elif response == "пистолет - пулемёт":
  710. if excoins >= 20:
  711. atack = atack + 4
  712. excoins = excoins - 20
  713. keyboard = create_magaz(response)
  714. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Пистолет - пулемёт +4 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  715. else:
  716. keyboard = create_magaz(response)
  717. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {20 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  718. elif response == "акм":
  719. if excoins >= 50:
  720. atack = atack + 7
  721. excoins = excoins - 50
  722. keyboard = create_magaz(response)
  723. vk_session.method('messages.send', {'user_id': imid,'message': f"Вы купили АКМ +7 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  724. else:
  725. keyboard = create_magaz(response)
  726. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {50 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard, 'captcha_handler': captcha_handler})
  727. elif response == "автоматический пулемёт":
  728. if excoins >= 100:
  729. atack = atack + 13
  730. excoins = excoins - 100
  731. keyboard = create_magaz(response)
  732. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Автоматический пулемёт +13 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  733. else:
  734. keyboard = create_magaz(response)
  735. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {100 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  736.  
  737. elif response == "рпг":
  738. if excoins >= 1000:
  739. atack = atack + 20
  740. excoins = excoins - 1000
  741. keyboard = create_magaz(response)
  742. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили РПГ +20 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  743. else:
  744. keyboard = create_magaz(response)
  745. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {1000 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  746. elif response == "самонаводящяяся базука":
  747. if excoins >= 5000:
  748. atack = atack + 25
  749. excoins = excoins - 5000
  750. keyboard = create_magaz(response)
  751. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Самонаводящяяся базука +25 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  752. else:
  753. keyboard = create_magaz(response)
  754. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {5000 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  755. elif response == "автоматическая пушка":
  756. if excoins >= 10000:
  757. atack = atack + 25
  758. excoins = excoins - 10000
  759. keyboard = create_magaz(response)
  760. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Автоматическая пушка +20 к ⚔атаке \n Теперь у вас Атака:{atack}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  761. else:
  762. keyboard = create_magaz(response)
  763. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {10000 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  764. elif response == "деревянный щит":
  765. if excoins >= 5:
  766. defend = defend + 1
  767. excoins = excoins - 5
  768. keyboard = create_magaz(response)
  769. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Деревянный щит +1 к защите \n Теперь у вас Защита:{defend}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  770. else:
  771. keyboard = create_magaz(response)
  772. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {5 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  773. elif response == "металлический щит":
  774. if excoins >= 30:
  775. defend = defend + 5
  776. excoins = excoins - 30
  777. keyboard = create_magaz(response)
  778. vk_session.method('messages.send',{'user_id': imid, 'message': f"Вы купили Металлический щит +5 к защите \n Теперь у вас Защита:{defend}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  779. else:
  780. keyboard = create_magaz(response)
  781. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {30 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  782. elif response == "энергетический щит":
  783. if excoins >= 50:
  784. defend = defend + 10
  785. excoins = excoins - 50
  786. keyboard = create_magaz(response)
  787. vk_session.method('messages.send', {'user_id': imid,
  788. 'message': f"Вы купили Энергетический щит +10 к защите \n Теперь у вас Защита:{defend}",
  789. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  790. 'captcha_handler': captcha_handler})
  791. else:
  792. keyboard = create_magaz(response)
  793. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {50 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  794. elif response == "энергетическая стена":
  795. if excoins >= 300:
  796. defend = defend + 20
  797. excoins = excoins - 300
  798. keyboard = create_magaz(response)
  799. vk_session.method('messages.send', {'user_id': imid,
  800. 'message': f"Вы купили Энергетическая стену +20 к защите \n Теперь у вас Защита:{defend}",
  801. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  802. 'captcha_handler': captcha_handler})
  803. else:
  804. keyboard = create_magaz(response)
  805. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {300 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  806. elif response == "щит из сверхпрочной стали":
  807. if excoins >= 1000:
  808. defend = defend + 30
  809. excoins = excoins - 1000
  810. keyboard = create_magaz(response)
  811. vk_session.method('messages.send', {'user_id': imid,'message': f"Вы купили Щит из сверхпрочной стали +30 к защите \n Теперь у вас Защита:{defend}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  812. else:
  813. keyboard = create_magaz(response)
  814. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {1000 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  815. elif response == "щит из тёмной материи":
  816. if excoins >= 8500:
  817. defend = defend + 55
  818. excoins = excoins - 85
  819. keyboard = create_magaz(response)
  820. vk_session.method('messages.send', {'user_id': imid,'message': f"Вы купили Щит из тёмной материи +55 к защите \n Теперь у вас Защита:{defend}",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  821. else:
  822. keyboard = create_magaz(response)
  823. vk_session.method('messages.send', {'user_id': imid, 'message': f"😰Вам не хватает {8500 - excoins} excoins ",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  824. elif response == "казино":
  825. keyboard = create_kazs(response)
  826. vk_session.method('messages.send', {'user_id': imid,
  827. 'message': f"Вы в казино, 💰💰💰 здесь можно выйграть состояние, а можно и проиграть ;-)\n 🤓Пологайтесь только на свою удачу ",
  828. 'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,
  829. 'captcha_handler': captcha_handler})
  830. elif response == "угадай число":
  831. keyboard = create_kaz2(response,imid)
  832. vk_session.method('messages.send', {'user_id': imid,'message': f"Выбери промежуток для выгрыша, число может выпасть от 0 до 100",'random_id': random.randint(0, 9999999999), 'keyboard': keyboard,'captcha_handler': captcha_handler})
  833.  
  834.  
  835.  
  836. savedate (imid, iq, nickname, job, jobn, timeend, pazle, paper, excoins, frac, chees,doc,prog,strongprog,atack,defend,regen,vs,statsb,vkcoin,testing)
  837.  
  838.  
  839. """
  840. Основной цикл
  841. """
  842. @merchant.lp_handler
  843. def payment_received(data):
  844. """
  845. При получении платежа будет запущена эта функция. Она может называться как угодно
  846. :param data.to_id: Ваш ID ВКонтакте
  847. :param data.id: ID платежа
  848. :param data.created_at: Unix timestamp, время когда был совершён платёж
  849. :param data.from_id: ID отправителя платежа
  850. :param data.amount: Количество полученных VK Coin
  851. """
  852. user_id = data.to_id
  853. amount = data.amount
  854.  
  855. print('Получен платёж на сумму {amount} от {user_id}'.format(amount=amount, user_id=user_id))
  856. row = getdate(data.from_id)
  857. vkcoin = row['vkcoin']
  858. vkcoin = vkcoin + int(data.amount)/1000
  859. savedatecoin(data.from_id, vkcoin)
  860.  
  861. def traz():
  862. while True:
  863. merchant.longpoll_start(tx=[1])
  864.  
  865. while True:
  866. geg = threading.Thread(target = traz)
  867. geg.start()
  868. for event in longpoll.listen():
  869. if event.type == VkEventType.MESSAGE_NEW:
  870. print(f'<{str(datetime.strftime(datetime.now(), "%H:%M:%S"))}> ({str(event.user_id)}) -> {str(event.text)}')
  871. response = event.text.lower()
  872. if event.from_user and not event.from_me:
  873. idid = event.user_id
  874. t = threading.Thread(target = mesed,name = str(idid), args = (idid, response))
  875. t.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement