Messaging update (#408)
* Messaging update Corrects some messages formats and updates to allow titles. * Messaging Update Fixes the new messages and updates some of the others. * mark 2 fixes some space. * Update messenger.py * Update generic_api.py
This commit is contained in:
@@ -21,14 +21,24 @@ class DiscordEmbeds(GenericApi):
|
||||
_, w, _ = image.shape
|
||||
image = image[:, (w//2):,:]
|
||||
cv2.imwrite(f"./loot_screenshots/{item}.png", image)
|
||||
file = self._add_file(f"./loot_screenshots/{item}.png", f"{imgName}.png")
|
||||
e = discord.Embed(
|
||||
title="Item Stashed!",
|
||||
description=f"{item} at {location}",
|
||||
color=self._get_Item_Color( item),
|
||||
)
|
||||
file = discord.File(f"./loot_screenshots/{item}.png", filename=f"{imgName}.png")
|
||||
if item == "magic_gg_club":
|
||||
e = discord.Embed(
|
||||
title="Lucille located.",
|
||||
description=f"This... This is Lucille, and she is awesome. All this, all this is just so we can pick out which one of you gets the honor. ",
|
||||
color=self._get_Item_Color( item),
|
||||
)
|
||||
else:
|
||||
e = discord.Embed(
|
||||
title="Item Stashed!",
|
||||
description=f"{item} at {location}",
|
||||
color=self._get_Item_Color( item),
|
||||
)
|
||||
e.set_thumbnail(url=f"{self._psnURL}41L6bd712.png")
|
||||
e.set_image(url=f"attachment://{imgName}.png")
|
||||
if item == "magic_gg_club":
|
||||
e.set_image(url=f"https://i.insider.com/5bd6fce948eb12606c6c4112?width=700&format=jpeg")
|
||||
else:
|
||||
e.set_image(url=f"attachment://{imgName}.png")
|
||||
self._send_embed(e, file)
|
||||
|
||||
def send_death(self, location, image_path):
|
||||
@@ -63,12 +73,18 @@ class DiscordEmbeds(GenericApi):
|
||||
e.set_thumbnail(url=f"{self._psnURL}6L341955.png")
|
||||
self._send_embed(e)
|
||||
|
||||
def send_message(self, msg: str):
|
||||
def send_status(self, msg: str):
|
||||
e = discord.Embed(title=f"Update:", description=f"```{msg}```", color=Color.dark_teal())
|
||||
if not self._config.general['discord_status_condensed']:
|
||||
e.set_thumbnail(url=f"{self._psnURL}36L4a4994.png")
|
||||
self._send_embed(e)
|
||||
|
||||
def send_message(self, title: str, msg: str, img: str):
|
||||
e = discord.Embed(title=f"{title}", description=f"```{msg}```", color=Color.dark_teal())
|
||||
if not self._config.general['discord_status_condensed']:
|
||||
e.set_thumbnail(url=f"{img}")
|
||||
self._send_embed(e)
|
||||
|
||||
def _send_embed(self, e, file = None):
|
||||
e.set_footer(text=f'Botty v.{__version__} by Aeon')
|
||||
e.timestamp=datetime.datetime.now(datetime.timezone.utc)
|
||||
|
||||
@@ -27,7 +27,10 @@ class GenericApi:
|
||||
msg = f"All stash is full, quitting"
|
||||
self._send(msg)
|
||||
|
||||
def send_message(self, msg: str):
|
||||
def send_status(self, msg: str):
|
||||
self._send(msg)
|
||||
|
||||
def send_message(self, msg: str, img=""):
|
||||
self._send(msg)
|
||||
|
||||
def _send(self, msg: str):
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ class Bot:
|
||||
hot_ip = self._config.dclone["dclone_hotip"]
|
||||
Logger.debug(f"Current Game IP: {cur_game_ip} and HOTIP: {hot_ip}")
|
||||
if hot_ip == cur_game_ip:
|
||||
self._messenger.send_message(f"Dclone IP Found on IP: {cur_game_ip}")
|
||||
self._messenger.send_message("Uber Diablo has been FOUND!", f"Dclone IP Found on IP: {cur_game_ip}", "https://i.psnprofiles.com/games/3bffee/trophies/11Lf29256.png")
|
||||
print("Press Enter")
|
||||
input()
|
||||
os._exit(1)
|
||||
|
||||
@@ -87,7 +87,7 @@ class GameController:
|
||||
Logger.error(
|
||||
f"{self._config.general['name']} could not recover from a max game length violation. Restarting the Game.")
|
||||
if self._config.general["custom_message_hook"]:
|
||||
messenger.send_message(f"{self._config.general['name']}: got stuck and will now restart D2R")
|
||||
messenger.send_message(f"{self._config.general['name']} got stuck!", f"got stuck and will now restart D2R", "https://i.psnprofiles.com/games/3bffee/trophies/21Lc63b56.png")
|
||||
if restart_game(self._config.general["d2r_path"]):
|
||||
self.game_stats.log_end_game(failed=max_game_length_reached)
|
||||
if self.setup_screen():
|
||||
@@ -96,7 +96,7 @@ class GameController:
|
||||
self.game_recovery = GameRecovery(self.screen, self.death_manager)
|
||||
return self.run_bot(True)
|
||||
Logger.error(f"{self._config.general['name']} could not restart the game. Quitting.")
|
||||
messenger.send_message("Got stuck and could not restart the game. Quitting.")
|
||||
messenger.send_message(f"{self._config.general['name']} got stuck!", f"Got stuck and could not restart the game. Quitting.", "https://i.psnprofiles.com/games/3bffee/trophies/21Lc63b56.png")
|
||||
|
||||
os._exit(1)
|
||||
|
||||
|
||||
+13
-8
@@ -30,19 +30,24 @@ class Messenger:
|
||||
def send_gold(self):
|
||||
self._message_api.send_gold()
|
||||
|
||||
def send_message(self, msg: str):
|
||||
self._message_api.send_message(msg)
|
||||
def send_status(self, msg: str):
|
||||
self._message_api.send_status(msg)
|
||||
|
||||
def send_message(self, title: str, msg: str, img=""):
|
||||
self._message_api.send_message(title, msg, img)
|
||||
|
||||
if __name__ == "__main__":
|
||||
messenger = Messenger()
|
||||
|
||||
item = "rune_test"
|
||||
image = None
|
||||
item = "magic_gg_club"
|
||||
image = "./info_screenshots/info_pather_got_stuck_20220105_030427.png"
|
||||
location = "Shenk"
|
||||
|
||||
# messenger.send_item(item, img, location)
|
||||
# messenger.send_death(location, "./info_screenshots/info_debug_chicken_20211220_110621.png")
|
||||
# messenger.send_death(location, "./info_screenshots/info_pather_got_stuck_20220105_030427.png")
|
||||
# messenger.send_chicken(location, "./info_screenshots/info_debug_chicken_20211220_110621.png")
|
||||
messenger.send_stash()
|
||||
messenger.send_gold()
|
||||
messenger.send_message("This is a test message")
|
||||
# messenger.send_stash()
|
||||
# messenger.send_gold()
|
||||
#messenger.send_item(item, image, location)
|
||||
messenger.send_status("test")
|
||||
messenger.send_message("Uber Diablo has been FOUND!", f"Dclone IP Found on IP: FUCK", "https://i.psnprofiles.com/games/3bffee/trophies/11Lf29256.png")
|
||||
|
||||
+4
-5
@@ -129,7 +129,7 @@ class AnyaShopper:
|
||||
)
|
||||
if gg_gloves.valid:
|
||||
mouse.click(button="right")
|
||||
self._messenger.send_message("Bought awesome IAS/+3 gloves!")
|
||||
self._messenger.send_message("We Bought something!", "Bought awesome IAS/+3 gloves!", "https://i.psnprofiles.com/games/3bffee/trophies/34La2f501.png")
|
||||
|
||||
Logger.info("IAS/+3 gloves bought!")
|
||||
self.gloves_bought += 1
|
||||
@@ -147,7 +147,7 @@ class AnyaShopper:
|
||||
)
|
||||
if g_gloves.valid:
|
||||
mouse.click(button="right")
|
||||
self._messenger.send_message("Bought some decent IAS/+2 gloves")
|
||||
self._messenger.send_message("We Bought something!", "Bought some decent IAS/+2 gloves", "https://i.psnprofiles.com/games/3bffee/trophies/34La2f501.png")
|
||||
Logger.info("IAS/+2 gloves bought!")
|
||||
self.gloves_bought += 1
|
||||
time.sleep(1)
|
||||
@@ -208,8 +208,7 @@ class AnyaShopper:
|
||||
if trap_score > self.trap_claw_min_score and self.look_for_trap_claws is True:
|
||||
# pick it up
|
||||
mouse.click(button="right")
|
||||
self._messenger.send_message(f"Bought some terrific trap Claws (score: {trap_score})")
|
||||
|
||||
self._messenger.send_message("We Bought something!", "Bought some terrific trap Claws (score: {trap_score})", "https://i.psnprofiles.com/games/3bffee/trophies/34La2f501.png")
|
||||
Logger.info(f"Trap Claws (score: {trap_score}) bought!")
|
||||
self.claws_bought += 1
|
||||
time.sleep(1)
|
||||
@@ -217,7 +216,7 @@ class AnyaShopper:
|
||||
if melee_score > self.melee_claw_min_score and self.look_for_melee_claws is True:
|
||||
# pick it up
|
||||
mouse.click(button="right")
|
||||
self._messenger.send_message(f"Bought some mad melee Claws (score: {melee_score})")
|
||||
self._messenger.send_message("We Bought something!", "Bought some mad melee Claws (score: {melee_score})", "https://i.psnprofiles.com/games/3bffee/trophies/34La2f501.png")
|
||||
Logger.info(f"Melee Claws (score: {melee_score}) bought!")
|
||||
self.claws_bought += 1
|
||||
time.sleep(1)
|
||||
|
||||
@@ -49,6 +49,6 @@ if __name__ == "__main__":
|
||||
if config.dclone["region_ips"] != "" and config.dclone["dclone_hotip"] != "":
|
||||
print(f"Current Game IP: {get_d2r_game_ip()}")
|
||||
print(f"Current Game Server: {get_d2r_game_server_region_by_ip(get_d2r_game_ip())}")
|
||||
messenger.send_message(f"Dclone IP Found on {get_d2r_game_server_region_by_ip(get_d2r_game_ip())} on IP: {get_d2r_game_ip()}")
|
||||
messenger.send_message("Uber Diablo has been FOUND!", f"Dclone IP Found on {get_d2r_game_server_region_by_ip(get_d2r_game_ip())} on IP: {get_d2r_game_ip()}", "https://i.psnprofiles.com/games/3bffee/trophies/11Lf29256.png")
|
||||
else:
|
||||
print(f"Please Enter the region ip and hot ip on config to use")
|
||||
Reference in New Issue
Block a user