Added sendkeys module.
This commit is contained in:
32
src/sendkeys.py
Normal file
32
src/sendkeys.py
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
from pywinauto.application import Application
|
||||
|
||||
|
||||
def send_text(text: str) -> None:
|
||||
app = Application()
|
||||
app.connect(title='Path of Exile')
|
||||
win = app.window_(title_re='Path of Exile')
|
||||
win.TypeKeys('{ENTER}^A{DELETE}' + text + '{ENTER}', with_spaces=True)
|
||||
|
||||
|
||||
def send_to(user: str, text: str) -> None:
|
||||
send_text(f'@{user} {text}')
|
||||
|
||||
|
||||
def invite(user: str) -> None:
|
||||
send_text(f'/invite {user}')
|
||||
|
||||
|
||||
def send_ty(user: str, conf: dict) -> None:
|
||||
send_to(user, conf['Chat']['ty'])
|
||||
|
||||
|
||||
def send_wait(user: str, conf: dict) -> None:
|
||||
send_to(user, conf['Chat']['wait'])
|
||||
|
||||
|
||||
def send_pickup(user: str, item: str, amount: int, currency: str, conf: dict) -> None:
|
||||
text = conf['Chat']['pickup'].replace('{item}', item)
|
||||
text = text.replace('{amount}', str(amount))
|
||||
text = text.replace('{currency}', currency)
|
||||
send_to(user, text)
|
||||
Reference in New Issue
Block a user