diff --git a/main.py b/main.py index d5cbe69..5824d56 100644 --- a/main.py +++ b/main.py @@ -149,7 +149,7 @@ def run_scrapers( # Default values default_run_everything: bool = False default_use_parallelism: bool = False - default_restaurant_names = ["bocca_ovp"] + default_restaurant_names = ["s5"] # Parse command-line arguments args = parse_arguments() diff --git a/mattermost_comunication.py b/mattermost_comunication.py index 78ffc4e..f845f56 100644 --- a/mattermost_comunication.py +++ b/mattermost_comunication.py @@ -23,9 +23,8 @@ def send_message(file_info, message): ) except mattermostdriver.exceptions.InvalidOrMissingParameters as e: # This will occur when we try to react to a file in a channel that is not the same as the originating channel. - unique_post_url = f"{config['mattermost']['server_url']}/pl/{post_id}" channel.create_post( - f"{unique_post_url}\n\n{message}", + f"{message}", ) @@ -51,10 +50,10 @@ def report_newly_found_but_invalid_file(file_info): send_message(file_info, message) -send_message( - { - "originating_mm_post_channel_id": "dm1abp4wfidezmig1yqyu53mmy", - "originating_mm_post_id": "dm1abp4wfidezmig1yqyu53mmy" - }, - "this is a test message" -) +# send_message( +# { +# "originating_mm_post_channel_id": "dm1abp4wfidezmig1yqyu53mmy", +# "originating_mm_post_id": "dm1abp4wfidezmig1yqyu53mmy" +# }, +# "haldis_sync is started" +# ) diff --git a/requirements.txt b/requirements.txt index b000791..ba9c129 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ pdfplumber==0.11.4 requests==2.32.3 selenium==4.27.1 seleniumbase==4.33.11 -mattermostdriver \ No newline at end of file +mattermostdriver +colored \ No newline at end of file diff --git a/sync_gitmate.py b/sync_gitmate.py index e520a91..0fa2ef3 100644 --- a/sync_gitmate.py +++ b/sync_gitmate.py @@ -9,6 +9,8 @@ import tomllib from pprint import pprint +from mattermost_comunication import send_message + # import mattermost_communication with open("config.toml", mode="rb") as config_toml: @@ -23,6 +25,11 @@ GIT_ORG = config["gitea"]["remote_org"] GIT_REPO = config["gitea"]["remote_repo"] +conf = { + "originating_mm_post_channel_id": "dm1abp4wfidezmig1yqyu53mmy", + "originating_mm_post_id": "dm1abp4wfidezmig1yqyu53mmy" +} + def init_sync(): repo = get_repo() @@ -152,6 +159,10 @@ def sync_file(repo, api_instance, file_info): print( " Creating a new merge request to update the git menu with the new version from the hlds menu." ) + send_message( + conf, + f"[hlds sync] Creating a new merge request to update the git menu of {sync_to} with the new version from the hlds menu." + ) api_instance.repo_create_pull_request( GIT_ORG, GIT_REPO, @@ -163,6 +174,10 @@ def sync_file(repo, api_instance, file_info): ) else: print(" Creating a new merge request to add the Menu to git.") + send_message( + conf, + f"[hlds sync] Creating a new merge request to add the git menu of {sync_to} with the new version from the hlds menu." + ) api_instance.repo_create_pull_request( GIT_ORG, GIT_REPO, @@ -174,5 +189,9 @@ def sync_file(repo, api_instance, file_info): ) else: print(" Merge request was already open.") + send_message( + conf, + f"[hlds sync] Merge request was already open for git menu of {sync_to}" + ) else: print(" Menu has no changes.")