Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Update chatbox_text() located in bot.py #173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/model/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,20 +423,23 @@ def mouseover_text(
return ocr.extract_text(self.win.mouseover, ocr.BOLD_12, color)
return bool(ocr.find_text(contains, self.win.mouseover, ocr.BOLD_12, color))

def chatbox_text(self, contains: str = None) -> Union[bool, str]:
def chatbox_text(self, contains: str = None, color: Union[clr.Color, List[clr.Color]]= clr.BLUE) -> Union[bool, str]:
"""
Examines the chatbox for text. Currently only captures player chat text.
Examines the chatbox for text.
Args:
contains: The text to search for (single word or phrase). Case sensitive. If left blank,
returns all text in the chatbox.
color: The color(s) of the text to search for. If left blank, defults to blue(player chat)
Returns:
True if exact string is found, False otherwise.
If args are left blank, returns the text in the chatbox.
"""
if contains is None:
return ocr.extract_text(self.win.chat, ocr.PLAIN_12, clr.BLUE)
if ocr.find_text(contains, self.win.chat, ocr.PLAIN_12, clr.BLUE):
if ocr.find_text(contains, self.win.chat, ocr.PLAIN_12, color):
return True
else:
return False

# --- Client Settings ---
def set_compass_north(self):
Expand Down