Skip to content

Instantly share code, notes, and snippets.

@limitedeternity
Last active March 22, 2020 13:15
Show Gist options
  • Save limitedeternity/60153fca96be77e791d467aa3ccae89e to your computer and use it in GitHub Desktop.
Save limitedeternity/60153fca96be77e791d467aa3ccae89e to your computer and use it in GitHub Desktop.
BossFighter for WellDungeon MMORPG
# -*- coding: utf-8 -*-
import time
import uuid
import vk_api
def auth_handler():
key = input("Enter authentication code: ").strip()
remember_device = True
return key, remember_device
def captcha_handler(captcha):
key = input(f"Enter captcha code ({captcha.get_url()}): ").strip()
return captcha.try_again(key)
def main():
login, password = "логин", "пасс"
vk_session = vk_api.VkApi(
login, password,
app_id=2685278,
scope=339968,
auth_handler=auth_handler,
captcha_handler=captcha_handler
)
try:
vk_session.auth()
except vk_api.AuthError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
post_search_query = "пробудил древнего монстра"
attack_keyword = "Атака"
attack_interval = 60 * 60
final_keyword = "Этот ивент уже завершен!"
while True:
post_id = vk.wall.search(owner_id=-182985865, query=post_search_query, count=1)["items"][0]["id"]
latest_post = vk.wall.getComments(owner_id=-182985865, post_id=post_id, count=1, sort="desc", thread_items_count=1)["items"][0]
if latest_post["thread"]["items"] and final_keyword in latest_post["thread"]["items"][0]["text"]:
break
vk.wall.createComment(owner_id=-182985865, post_id=post_id, message=attack_keyword, guid=uuid.uuid4().hex)
time.sleep(attack_interval)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment