From 134c618041657cea89b44384aff0b0d599f25878 Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sun, 5 Feb 2023 19:05:18 +0000 Subject: [PATCH 01/17] Initial --- .gitignore | 3 +++ README.md | 34 ++++++++++++++++++++++++++++++++++ main.py | 27 +++++++++++++++++++++++++++ message.py | 17 +++++++++++++++++ monitor.py | 38 ++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 +++ 6 files changed, 122 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 main.py create mode 100644 message.py create mode 100644 monitor.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86098f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +.fleet/ +.idea/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..064780e --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# QueueNotify (program) +## Description +Program that sends you a text when your Solo Shuffle pops in World of Warcraft. Developed for Windows 11 (but 10 should work). + +**Please note that this program is in Alpha, and so you can expect errors to occur and things to be more difficult to set up for now. I've decided to release it despite the somewhat primitive state, as I think it will be useful for a lot of people who are able to follow the instructions below.** + +Report any problems in the [Issues](https://github.com/test/queue-notify/issues) tab, but please try searching things yourself first. + +## Installation +1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/) or [Wago](https://addons.wago.io/) and then `/reload` +2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 +3. Download this repo (`git clone https://github.com/test/queue-notify`, or [download the ZIP](https://github.com/test/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) +4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` +5. Run `pip install -r requirements.txt` and wait until complete. + + +## Setup +1. Install the [Telegram app](https://telegram.org/apps) on your phone and sign up +2. Open a new message to the user `@BotFather` and type `/newbot`. You will then be prompted to fill in some values +3. Enter a name such as `QueueNotify` +4. Enter some unique username like `queuenotify_123456_bot` +5. Write down the HTTP API token you get, and enter it under `token` in the `config.toml` file +6. Ensure the `path` to your WoW folder in `config.toml` is correct. You must use double backslashes, e.g., `"C:\\Program Files (x86)\\World of Warcraft"` +7. Run the program (from inside the directory, as before) with `python main.py`. You will need to run this whenever you want to begin monitoring after a restart +8. When running for the first time, it will prompt you to send a message to your bot. Do this by clicking the `t.me/{username}` link given to you by the BotFather +9. Stop monitoring by closing the Command Prompt window. + + +## Updates +It is likely that this program will change significantly, and so you should check back here for updates. Please also keep the addon updated. + + +## Changing account +If you wish to change your linked Telegram account, simply change the `chat_id` value in `config.toml` to `""` and re-run the program. diff --git a/main.py b/main.py new file mode 100644 index 0000000..6df9ea8 --- /dev/null +++ b/main.py @@ -0,0 +1,27 @@ +from message import get_chat_id +from monitor import monitor +import toml + + +def load_config(): + config_path = "config.toml" + with open(config_path) as file: + config = toml.load(file) + if config["chat_id"] == "": + chat_id = None + while not chat_id: + input("Please send a message to the Telegram bot you created. Once done, wait 1 minute then press Enter.") + chat_id = get_chat_id(config["token"]) + config["chat_id"] = chat_id + with open(config_path, "w") as file: + toml.dump(config, file) + return config + + +def main(): + config = load_config() + monitor(config["path"], config["token"], config["chat_id"]) + + +if __name__ == "__main__": + main() diff --git a/message.py b/message.py new file mode 100644 index 0000000..d3b39cb --- /dev/null +++ b/message.py @@ -0,0 +1,17 @@ +import requests + + +def get_chat_id(token): + url = f"https://api.telegram.org/bot{token}/getUpdates" + data = requests.get(url).json() + try: + chat_id = data["result"][0]["message"]["chat"]["id"] + except IndexError: + return None + return str(chat_id) + + +def send_message(token, chat_id): + message = "Your Solo Shuffle is ready." + url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat_id}&text={message}" + requests.get(url) diff --git a/monitor.py b/monitor.py new file mode 100644 index 0000000..7d9811f --- /dev/null +++ b/monitor.py @@ -0,0 +1,38 @@ +from watchdog.observers import Observer +from watchdog.events import PatternMatchingEventHandler +import time +from message import send_message +import os + + +class ScanFolder: + def __init__(self, path, token, chat_id): + self.path = path + "\\_retail_\\Screenshots" + self.token = token + self.chat_id = chat_id + self.event_handler = PatternMatchingEventHandler(patterns=["*.tga"], ignore_patterns=None, + ignore_directories=False, case_sensitive=True) + self.event_handler.on_created = self.on_created + self.observer = Observer() + self.observer.schedule(self.event_handler, self.path, recursive=False) + self.observer.start() + + def on_created(self, event): + send_message(self.token, self.chat_id) + print("Sending message...") + if os.path.exists(event.src_path): + os.remove(event.src_path) + + def stop(self): + self.observer.stop() + self.observer.join() + + +def monitor(path, token, chat_id): + observer = ScanFolder(path, token, chat_id) + print("Monitoring...") + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7ef008f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +requests +toml +watchdog \ No newline at end of file From faa1cd0c9dc8b97b129ada63b3d877410a944697 Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:07:52 +0000 Subject: [PATCH 02/17] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 064780e..a7a8020 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ Program that sends you a text when your Solo Shuffle pops in World of Warcraft. **Please note that this program is in Alpha, and so you can expect errors to occur and things to be more difficult to set up for now. I've decided to release it despite the somewhat primitive state, as I think it will be useful for a lot of people who are able to follow the instructions below.** -Report any problems in the [Issues](https://github.com/test/queue-notify/issues) tab, but please try searching things yourself first. +Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/issues) tab, but please try searching things yourself first. ## Installation 1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/) or [Wago](https://addons.wago.io/) and then `/reload` 2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 -3. Download this repo (`git clone https://github.com/test/queue-notify`, or [download the ZIP](https://github.com/test/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) +3. Download this repo (`git clone https://github.com/dev-fatal/queue-notify`, or [download the ZIP](https://github.com/dev-fatal/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` 5. Run `pip install -r requirements.txt` and wait until complete. From 680f2b5e745d781e6796eabd877d291e63bc05fa Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:16:39 +0000 Subject: [PATCH 03/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7a8020..4837700 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Program that sends you a text when your Solo Shuffle pops in World of Warcraft. Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/issues) tab, but please try searching things yourself first. ## Installation -1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/) or [Wago](https://addons.wago.io/) and then `/reload` +1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/wow/addons/queuenotify) or [Wago](https://addons.wago.io/addons/queuenotify) and then `/reload` 2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 3. Download this repo (`git clone https://github.com/dev-fatal/queue-notify`, or [download the ZIP](https://github.com/dev-fatal/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` From 1c4142f509be1201242ff61e3b28c564c21eab29 Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:25:09 +0000 Subject: [PATCH 04/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4837700..4b09b6a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Program that sends you a text when your Solo Shuffle pops in World of Warcraft. Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/issues) tab, but please try searching things yourself first. ## Installation -1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/wow/addons/queuenotify) or [Wago](https://addons.wago.io/addons/queuenotify) and then `/reload` +1. Install the QueueNotify addon via [Wago](https://addons.wago.io/addons/queuenotify) or ~~[CurseForge](https://www.curseforge.com/wow/addons/queuenotify)~~ (upload pending) or and then `/reload` 2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 3. Download this repo (`git clone https://github.com/dev-fatal/queue-notify`, or [download the ZIP](https://github.com/dev-fatal/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` From cc9e702c1df103e19bb628ab2098992780ab78b5 Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:42:16 +0000 Subject: [PATCH 05/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b09b6a..6953de5 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/is 5. Write down the HTTP API token you get, and enter it under `token` in the `config.toml` file 6. Ensure the `path` to your WoW folder in `config.toml` is correct. You must use double backslashes, e.g., `"C:\\Program Files (x86)\\World of Warcraft"` 7. Run the program (from inside the directory, as before) with `python main.py`. You will need to run this whenever you want to begin monitoring after a restart -8. When running for the first time, it will prompt you to send a message to your bot. Do this by clicking the `t.me/{username}` link given to you by the BotFather +8. When running for the first time, it will prompt you to send a message to your bot. Do this by clicking the `t.me/{username}` link given to you by the BotFather. Note you need to type something other than the default `/start`. 9. Stop monitoring by closing the Command Prompt window. From 0de3581ef38796e06d5fb2ca4839b1b0b8b221f2 Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:42:42 +0000 Subject: [PATCH 06/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6953de5..5ee06a4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/is 5. Write down the HTTP API token you get, and enter it under `token` in the `config.toml` file 6. Ensure the `path` to your WoW folder in `config.toml` is correct. You must use double backslashes, e.g., `"C:\\Program Files (x86)\\World of Warcraft"` 7. Run the program (from inside the directory, as before) with `python main.py`. You will need to run this whenever you want to begin monitoring after a restart -8. When running for the first time, it will prompt you to send a message to your bot. Do this by clicking the `t.me/{username}` link given to you by the BotFather. Note you need to type something other than the default `/start`. +8. When running for the first time, it will prompt you to send a message to your bot. Do this by clicking the `t.me/{username}` link given to you by the BotFather. Note you need to type something as well as the default `/start`. 9. Stop monitoring by closing the Command Prompt window. From 98b8daea18b44c81fa0e351a9aa6cbfb9d27b63a Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:43:03 +0000 Subject: [PATCH 07/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ee06a4..2d37b7c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Program that sends you a text when your Solo Shuffle pops in World of Warcraft. Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/issues) tab, but please try searching things yourself first. ## Installation -1. Install the QueueNotify addon via [Wago](https://addons.wago.io/addons/queuenotify) or ~~[CurseForge](https://www.curseforge.com/wow/addons/queuenotify)~~ (upload pending) or and then `/reload` +1. Install the QueueNotify addon via [Wago](https://addons.wago.io/addons/queuenotify) or ~~[CurseForge](https://www.curseforge.com/wow/addons/queuenotify)~~ (upload pending) and then `/reload` 2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 3. Download this repo (`git clone https://github.com/dev-fatal/queue-notify`, or [download the ZIP](https://github.com/dev-fatal/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` From 3ed2791647172b14d47883832144674f9145bb87 Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:28:23 +0000 Subject: [PATCH 08/17] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d37b7c..b7521f7 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,10 @@ Program that sends you a text when your Solo Shuffle pops in World of Warcraft. Report any problems in the [Issues](https://github.com/dev-fatal/queue-notify/issues) tab, but please try searching things yourself first. +You can view the addon source code here: https://github.com/dev-fatal/queue-notify-addon + ## Installation -1. Install the QueueNotify addon via [Wago](https://addons.wago.io/addons/queuenotify) or ~~[CurseForge](https://www.curseforge.com/wow/addons/queuenotify)~~ (upload pending) and then `/reload` +1. Install the QueueNotify addon via [CurseForge](https://www.curseforge.com/wow/addons/queuenotify) or [Wago](https://addons.wago.io/addons/queuenotify) and then `/reload` 2. Install [Python 3 for Windows](https://www.python.org/downloads/) and ensure it's in your PATH. Note that this program has been tested on Python version 3.10 3. Download this repo (`git clone https://github.com/dev-fatal/queue-notify`, or [download the ZIP](https://github.com/dev-fatal/queue-notify/archive/refs/heads/main.zip) and then extract it somewhere) 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` From 47567f245e85bdcf9bab35c0b7f7fbab54c6ad9a Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sat, 11 Feb 2023 16:58:05 +0000 Subject: [PATCH 09/17] Now git ignoring config.toml --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 86098f8..7974f46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ __pycache__/ .fleet/ -.idea/ \ No newline at end of file +.idea/ +config.toml \ No newline at end of file From c775f517881c80ca0aca8b8ceae5b20f1f3b729c Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sat, 11 Feb 2023 16:59:28 +0000 Subject: [PATCH 10/17] Added comments to message.py --- message.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/message.py b/message.py index d3b39cb..8ef03ff 100644 --- a/message.py +++ b/message.py @@ -3,9 +3,9 @@ def get_chat_id(token): url = f"https://api.telegram.org/bot{token}/getUpdates" - data = requests.get(url).json() + data = requests.get(url).json() # Try find chat that user sent to our bot try: - chat_id = data["result"][0]["message"]["chat"]["id"] + chat_id = data["result"][0]["message"]["chat"]["id"] # Retrieve chat id so we can reply except IndexError: return None return str(chat_id) @@ -14,4 +14,4 @@ def get_chat_id(token): def send_message(token, chat_id): message = "Your Solo Shuffle is ready." url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat_id}&text={message}" - requests.get(url) + requests.get(url) # Send the message to the user From 6742aa4697599e8cb41a7dd57e4b8472a294940c Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sat, 11 Feb 2023 16:59:50 +0000 Subject: [PATCH 11/17] Added comments plus cleaner use of config in monitor.py --- monitor.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/monitor.py b/monitor.py index 7d9811f..97c3cad 100644 --- a/monitor.py +++ b/monitor.py @@ -6,10 +6,11 @@ class ScanFolder: - def __init__(self, path, token, chat_id): - self.path = path + "\\_retail_\\Screenshots" - self.token = token - self.chat_id = chat_id + def __init__(self, config): + # Monitor the screenshots folder for any file ending in .tga + self.path = config["path"] + "\\_retail_\\Screenshots" + self.token = config["token"] + self.chat_id = config["chat_id"] self.event_handler = PatternMatchingEventHandler(patterns=["*.tga"], ignore_patterns=None, ignore_directories=False, case_sensitive=True) self.event_handler.on_created = self.on_created @@ -21,18 +22,18 @@ def on_created(self, event): send_message(self.token, self.chat_id) print("Sending message...") if os.path.exists(event.src_path): - os.remove(event.src_path) + os.remove(event.src_path) # Delete the screenshot we created def stop(self): self.observer.stop() self.observer.join() -def monitor(path, token, chat_id): - observer = ScanFolder(path, token, chat_id) +def monitor(config): + observer = ScanFolder(config) print("Monitoring...") try: while True: - time.sleep(1) - except KeyboardInterrupt: + time.sleep(1) # Blocking sleep so we only check every second + except: observer.stop() From ae7de3bc1a81dfa31f4cb0ca6bd1b28ab0eb943b Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sat, 11 Feb 2023 17:00:15 +0000 Subject: [PATCH 12/17] Comments, cleaner config, exit if no token in main.py --- main.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 6df9ea8..00136dd 100644 --- a/main.py +++ b/main.py @@ -1,26 +1,30 @@ from message import get_chat_id from monitor import monitor import toml +import sys def load_config(): - config_path = "config.toml" - with open(config_path) as file: - config = toml.load(file) - if config["chat_id"] == "": - chat_id = None - while not chat_id: - input("Please send a message to the Telegram bot you created. Once done, wait 1 minute then press Enter.") - chat_id = get_chat_id(config["token"]) - config["chat_id"] = chat_id - with open(config_path, "w") as file: - toml.dump(config, file) + config_location = "config.toml" + with open(config_location) as file: + config = toml.load(file) # Make a dict of the config values + + if not config["token"]: # No token supplied + sys.exit("Please enter a token in the config file") + while not config["chat_id"]: # Keep trying to find chat id until we get a valid one + input("Please send a message to the Telegram bot you created. Once done, wait 1 \ + minute then press Enter. If it doesn't work, send another message then try \ + again.") + config["chat_id"] = get_chat_id(config["token"]) + + with open(config_location, "w") as file: + toml.dump(config, file) # Output new config (to file) with updated chat id return config def main(): config = load_config() - monitor(config["path"], config["token"], config["chat_id"]) + monitor(config) if __name__ == "__main__": From 7e0dd45a89477bc3209a163f0db34738ef3f317f Mon Sep 17 00:00:00 2001 From: dev-fatal Date: Sat, 11 Feb 2023 17:04:31 +0000 Subject: [PATCH 13/17] Now only dumping to config if we have made a change to it --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 00136dd..9cb687c 100644 --- a/main.py +++ b/main.py @@ -11,14 +11,19 @@ def load_config(): if not config["token"]: # No token supplied sys.exit("Please enter a token in the config file") + + updated_config = False while not config["chat_id"]: # Keep trying to find chat id until we get a valid one + updated_config = True input("Please send a message to the Telegram bot you created. Once done, wait 1 \ minute then press Enter. If it doesn't work, send another message then try \ again.") config["chat_id"] = get_chat_id(config["token"]) - with open(config_location, "w") as file: - toml.dump(config, file) # Output new config (to file) with updated chat id + if updated_config: + with open(config_location, "w") as file: + toml.dump(config, file) # Output new config (to file) with updated chat id + return config From 0b45fcee9c61336631ef6f68549f8ca39306e3fe Mon Sep 17 00:00:00 2001 From: dev-fatal <124520683+dev-fatal@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:15:34 +0000 Subject: [PATCH 14/17] Added Linux instructions to README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b7521f7..37c8ff2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ You can view the addon source code here: https://github.com/dev-fatal/queue-noti 4. Open Command Prompt and `cd` into where you saved it, e.g., `cd C:\Users\test\Documents\queue-notify` 5. Run `pip install -r requirements.txt` and wait until complete. - ## Setup 1. Install the [Telegram app](https://telegram.org/apps) on your phone and sign up 2. Open a new message to the user `@BotFather` and type `/newbot`. You will then be prompted to fill in some values @@ -28,6 +27,12 @@ You can view the addon source code here: https://github.com/dev-fatal/queue-noti 9. Stop monitoring by closing the Command Prompt window. +## Linux +If using Linux, you should make the following changes: +- Change `self.path = config["path"] + "\\_retail_\\Screenshots"` to `self.path = config["path"] + "/_retail_/Screenshots"` in `monitor.py` +- Use a path in the config such as `path = "/home//.local/share/Steam/steamapps/compatdata//pfx/drive_c/Program Files (x86)/World of Warcraft"` + + ## Updates It is likely that this program will change significantly, and so you should check back here for updates. Please also keep the addon updated. From 68e0d5d87d0716d0da5188a085b84d40d4d46325 Mon Sep 17 00:00:00 2001 From: 50sotero Date: Tue, 30 Apr 2024 11:36:57 -0300 Subject: [PATCH 15/17] init --- config.toml | 6 +++--- main.py | 7 +++---- message.py | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/config.toml b/config.toml index 97ef3b5..f85a3d7 100644 --- a/config.toml +++ b/config.toml @@ -1,3 +1,3 @@ -token = "" -path = "C:\\Program Files (x86)\\World of Warcraft" -chat_id = "" +token = "6769692013:AAGs1bSe4xerq8pWXCfaOvW_KBqgdyvqodU" +path = "G:\\World of Warcraft" +chat_id = "712782336" diff --git a/main.py b/main.py index 9cb687c..4985a4b 100644 --- a/main.py +++ b/main.py @@ -2,10 +2,11 @@ from monitor import monitor import toml import sys - +import os def load_config(): - config_location = "config.toml" + absolute_path = os.path.abspath(__file__) + config_location = os.path.dirname(absolute_path)+"\\config.toml" with open(config_location) as file: config = toml.load(file) # Make a dict of the config values @@ -26,11 +27,9 @@ def load_config(): return config - def main(): config = load_config() monitor(config) - if __name__ == "__main__": main() diff --git a/message.py b/message.py index 8ef03ff..7c2012d 100644 --- a/message.py +++ b/message.py @@ -1,5 +1,5 @@ import requests - +import datetime def get_chat_id(token): url = f"https://api.telegram.org/bot{token}/getUpdates" @@ -12,6 +12,6 @@ def get_chat_id(token): def send_message(token, chat_id): - message = "Your Solo Shuffle is ready." + message = f"""Your Solo Shuffle is ready now ({datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")})""" url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat_id}&text={message}" requests.get(url) # Send the message to the user From c7502f7238155d3d973ac5dd50c6ef35d61aec68 Mon Sep 17 00:00:00 2001 From: 50sotero Date: Tue, 30 Apr 2024 11:36:57 -0300 Subject: [PATCH 16/17] init --- main.py | 7 +++---- message.py | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 9cb687c..4985a4b 100644 --- a/main.py +++ b/main.py @@ -2,10 +2,11 @@ from monitor import monitor import toml import sys - +import os def load_config(): - config_location = "config.toml" + absolute_path = os.path.abspath(__file__) + config_location = os.path.dirname(absolute_path)+"\\config.toml" with open(config_location) as file: config = toml.load(file) # Make a dict of the config values @@ -26,11 +27,9 @@ def load_config(): return config - def main(): config = load_config() monitor(config) - if __name__ == "__main__": main() diff --git a/message.py b/message.py index 8ef03ff..7c2012d 100644 --- a/message.py +++ b/message.py @@ -1,5 +1,5 @@ import requests - +import datetime def get_chat_id(token): url = f"https://api.telegram.org/bot{token}/getUpdates" @@ -12,6 +12,6 @@ def get_chat_id(token): def send_message(token, chat_id): - message = "Your Solo Shuffle is ready." + message = f"""Your Solo Shuffle is ready now ({datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")})""" url = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={chat_id}&text={message}" requests.get(url) # Send the message to the user From c61c2a04d7bb5eac6da08650f769208daaa5ff1e Mon Sep 17 00:00:00 2001 From: 50sotero Date: Tue, 30 Apr 2024 11:38:34 -0300 Subject: [PATCH 17/17] remove config values --- config.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config.toml b/config.toml index f85a3d7..a418abd 100644 --- a/config.toml +++ b/config.toml @@ -1,3 +1,3 @@ -token = "6769692013:AAGs1bSe4xerq8pWXCfaOvW_KBqgdyvqodU" -path = "G:\\World of Warcraft" -chat_id = "712782336" +token = "" +path = "" +chat_id = ""