discord integration for drops and getting stuck
This commit is contained in:
@@ -73,6 +73,8 @@ resume_key | After starting the exe botty will wait for this keypress to atually
|
||||
color_checker_key | Pressing this key will start a debug mode to check if the color filtering works with your settings. It also includes the item search and marks items it would pick up with red circles
|
||||
logger_lvl | Can be any of [info, debug] and determines how much output you see on the command line
|
||||
randomize_runs | If 0, the order will always be pindle -> eldritch/shenk. If 1 the order will be random.
|
||||
send_drops_to_discord | If 1 sends your drops to the discord channel "drop-log"
|
||||
custom_discord_hook | If 1 sends a message about drops to this hook and will update you in case botty got stuck and can not resume
|
||||
|
||||
[routes] | Descriptions
|
||||
--------------------------------|---------------------------------------------
|
||||
|
||||
@@ -16,3 +16,4 @@ dependencies:
|
||||
- beautifultable
|
||||
- zstandard
|
||||
- pytweening
|
||||
- requests
|
||||
|
||||
@@ -7,6 +7,8 @@ auto_settings_key=f9
|
||||
color_checker_key=f10
|
||||
logg_lvl=info
|
||||
randomize_runs=0
|
||||
send_drops_to_discord=1
|
||||
custom_discord_hook=
|
||||
|
||||
[routes]
|
||||
run_pindle=1
|
||||
|
||||
@@ -14,7 +14,7 @@ from health_manager import HealthManager
|
||||
from death_manager import DeathManager
|
||||
from npc_manager import NpcManager, Npc
|
||||
from pickit import PickIt
|
||||
from utils.misc import wait
|
||||
from utils.misc import wait, send_discord
|
||||
import keyboard
|
||||
import threading
|
||||
import time
|
||||
@@ -103,7 +103,11 @@ class Bot:
|
||||
self._timer = time.time()
|
||||
found, _ = self._template_finder.search_and_wait("D2_LOGO_HS", time_out=70)
|
||||
if not found:
|
||||
Logger.error("Something went wrong here, bot is unsure about current location. Exit game and closing down bot.")
|
||||
Logger.error("Something went wrong here, bot is unsure about current location. Closing down bot.")
|
||||
if self._config.general["custom_discord_hook"] != "":
|
||||
send_discord_thread = threading.Thread(target=send_discord, args=("Botty got stuck and can not resume", self._config.general["custom_discord_hook"]))
|
||||
send_discord_thread.daemon = True
|
||||
send_discord_thread.start()
|
||||
self._ui_manager.save_and_exit()
|
||||
os._exit(1)
|
||||
self._ui_manager.start_hell_game()
|
||||
|
||||
@@ -30,6 +30,8 @@ class Config:
|
||||
"color_checker_key": self._select_val("general", "color_checker_key"),
|
||||
"logg_lvl": self._select_val("general", "logg_lvl"),
|
||||
"randomize_runs": bool(int(self._select_val("general", "randomize_runs"))),
|
||||
"send_drops_to_discord": bool(int(self._select_val("general", "send_drops_to_discord"))),
|
||||
"custom_discord_hook": self._select_val("general", "custom_discord_hook"),
|
||||
}
|
||||
|
||||
self.routes = {}
|
||||
|
||||
@@ -7,7 +7,8 @@ from char.i_char import IChar
|
||||
from logger import Logger
|
||||
from screen import Screen
|
||||
from ui_manager import UiManager
|
||||
import random
|
||||
import threading
|
||||
from utils.misc import send_discord
|
||||
|
||||
|
||||
class PickIt:
|
||||
@@ -54,6 +55,17 @@ class PickIt:
|
||||
time.sleep(0.1)
|
||||
mouse.click(button="left")
|
||||
time.sleep(0.5)
|
||||
|
||||
if self._config.general["send_drops_to_discord"]:
|
||||
send_discord_thread = threading.Thread(target=send_discord, args=(closest_item.name,))
|
||||
send_discord_thread.daemon = True
|
||||
send_discord_thread.start()
|
||||
|
||||
if self._config.general["custom_discord_hook"] != "":
|
||||
send_discord_thread = threading.Thread(target=send_discord, args=(closest_item.name, self._config.general["custom_discord_hook"]))
|
||||
send_discord_thread.daemon = True
|
||||
send_discord_thread.start()
|
||||
|
||||
if self._ui_manager.is_overburdened():
|
||||
Logger.warning("Inventory full, skipping pickit!")
|
||||
# TODO: should go back to town and stash stuff then go back to picking up more stuff
|
||||
|
||||
@@ -4,8 +4,15 @@ import ctypes
|
||||
from logger import Logger
|
||||
import cv2
|
||||
from typing import List, Tuple
|
||||
import requests
|
||||
|
||||
|
||||
def send_discord(item_name, url:str = None):
|
||||
if url is None:
|
||||
url = "https://discord.com/api/webhooks/908045354061160459/8-HQRLPTHxMlf5VpvScuvNEpLLIe8KHqxgRIk6p17u6LMPvzCCQotT_iGioQHQVU5u_P"
|
||||
data = {"content": f"Botty just found: {item_name}"}
|
||||
requests.post(url, json=data)
|
||||
|
||||
def wait(min_seconds, max_seconds = None):
|
||||
if max_seconds is None:
|
||||
max_seconds = min_seconds
|
||||
|
||||
Reference in New Issue
Block a user