From 577e6eddba4c1b4d76028504bd9eee51bba50959 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 30 Jun 2020 21:46:15 -0400 Subject: [PATCH 1/9] NEW: Telegram-compatible webhook templates --- bots/game_threads/templates/comment_webhook_telegram.mako | 3 +++ bots/game_threads/templates/game_webhook_telegram.mako | 2 ++ bots/game_threads/templates/gameday_webhook_telegram.mako | 2 ++ bots/game_threads/templates/off_webhook_telegram.mako | 2 ++ bots/game_threads/templates/post_webhook_telegram.mako | 2 ++ bots/game_threads/templates/weekly_webhook_telegram.mako | 2 ++ 6 files changed, 13 insertions(+) create mode 100644 bots/game_threads/templates/comment_webhook_telegram.mako create mode 100644 bots/game_threads/templates/game_webhook_telegram.mako create mode 100644 bots/game_threads/templates/gameday_webhook_telegram.mako create mode 100644 bots/game_threads/templates/off_webhook_telegram.mako create mode 100644 bots/game_threads/templates/post_webhook_telegram.mako create mode 100644 bots/game_threads/templates/weekly_webhook_telegram.mako diff --git a/bots/game_threads/templates/comment_webhook_telegram.mako b/bots/game_threads/templates/comment_webhook_telegram.mako new file mode 100644 index 0000000..976e5c5 --- /dev/null +++ b/bots/game_threads/templates/comment_webhook_telegram.mako @@ -0,0 +1,3 @@ +## This template produces data in JSON format suitable for Telegram webhooks +## Be sure to include \n for line breaks, because actual linebreaks will be stripped out! +{"text": "${commentText.replace('"','\"').replace('\r','').replace('\n','\\n')}"} \ No newline at end of file diff --git a/bots/game_threads/templates/game_webhook_telegram.mako b/bots/game_threads/templates/game_webhook_telegram.mako new file mode 100644 index 0000000..d20a5c0 --- /dev/null +++ b/bots/game_threads/templates/game_webhook_telegram.mako @@ -0,0 +1,2 @@ +## This template produces data in JSON format suitable for Telegram webhooks +{"text":"Game Thread Posted!\n${theThread.title}\n${theThread.shortlink}"} \ No newline at end of file diff --git a/bots/game_threads/templates/gameday_webhook_telegram.mako b/bots/game_threads/templates/gameday_webhook_telegram.mako new file mode 100644 index 0000000..6a72ff3 --- /dev/null +++ b/bots/game_threads/templates/gameday_webhook_telegram.mako @@ -0,0 +1,2 @@ +## This template produces data in JSON format suitable for Telegram webhooks +{"text":"Game Day Thread Posted!\n${theThread.title}\n${theThread.shortlink}"} \ No newline at end of file diff --git a/bots/game_threads/templates/off_webhook_telegram.mako b/bots/game_threads/templates/off_webhook_telegram.mako new file mode 100644 index 0000000..56944dc --- /dev/null +++ b/bots/game_threads/templates/off_webhook_telegram.mako @@ -0,0 +1,2 @@ +## This template produces data in JSON format suitable for Telegram webhooks +{"text":"Off Day Thread Posted!\n${theThread.title}\n${theThread.shortlink}"} \ No newline at end of file diff --git a/bots/game_threads/templates/post_webhook_telegram.mako b/bots/game_threads/templates/post_webhook_telegram.mako new file mode 100644 index 0000000..b991e59 --- /dev/null +++ b/bots/game_threads/templates/post_webhook_telegram.mako @@ -0,0 +1,2 @@ +## This template produces data in JSON format suitable for Telegram webhooks +{"text":"Post Game Thread Posted!\n${theThread.title}\n${theThread.shortlink}"} \ No newline at end of file diff --git a/bots/game_threads/templates/weekly_webhook_telegram.mako b/bots/game_threads/templates/weekly_webhook_telegram.mako new file mode 100644 index 0000000..b26aaab --- /dev/null +++ b/bots/game_threads/templates/weekly_webhook_telegram.mako @@ -0,0 +1,2 @@ +## This template produces data in JSON format suitable for Telegram webhooks +{"text":"Weekly Thread Posted!\n${theThread.title}\n${theThread.shortlink}"} \ No newline at end of file From f761b88682f010a0227ade46b0fc980549462453 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 30 Jun 2020 21:53:56 -0400 Subject: [PATCH 2/9] VER: v0.0.7 --- Dockerfile | 2 +- bots/game_threads/__init__.py | 2 +- redball/version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index da0f83b..7378612 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:alpine3.8 -LABEL Name=redball Version=0.0.6 +LABEL Name=redball Version=0.0.7 WORKDIR /app ADD . /app diff --git a/bots/game_threads/__init__.py b/bots/game_threads/__init__.py index 315eb40..b3e0c7c 100644 --- a/bots/game_threads/__init__.py +++ b/bots/game_threads/__init__.py @@ -30,7 +30,7 @@ import praw -__version__ = "0.0.6" +__version__ = "0.0.7" def run(bot, settings): diff --git a/redball/version.py b/redball/version.py index 1f8b44a..00d912c 100644 --- a/redball/version.py +++ b/redball/version.py @@ -1,3 +1,3 @@ #!/usr/bin/env python -VERSION = "0.0.6" +VERSION = "0.0.7" From 807686238705bff9d82c21f0948a06748aabe791 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 30 Jun 2020 22:04:48 -0400 Subject: [PATCH 3/9] FIX: Code formatting --- bots/game_threads/__init__.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bots/game_threads/__init__.py b/bots/game_threads/__init__.py index b3e0c7c..a0dd880 100644 --- a/bots/game_threads/__init__.py +++ b/bots/game_threads/__init__.py @@ -150,7 +150,7 @@ def run(self): ) ) self.error_notification( - f"Error overriding game date. Falling back to today's date" + "Error overriding game date. Falling back to today's date" ) todayObj = datetime.today() else: @@ -674,7 +674,7 @@ def run(self): ) ) self.error_notification( - f"Game day thread update process is not running" + "Game day thread update process is not running" ) self.THREADS.update( { @@ -815,7 +815,7 @@ def off_day(self): e ) ) - self.error_notification(f"Off day thread update process is not running") + self.error_notification("Off day thread update process is not running") self.THREADS.update( { "OFFDAY_THREAD": threading.Thread( @@ -1260,7 +1260,7 @@ def off_thread_update_loop(self): self.count_check_edit(offDayThread.id, "NA", edit=False) except Exception as e: self.log.error("Error editing off day thread: {}".format(e)) - self.error_notification(f"Error editing off day thread") + self.error_notification("Error editing off day thread") update_off_thread_until = self.settings.get("Off Day Thread", {}).get( "UPDATE_UNTIL", "All MLB games are final" @@ -1569,7 +1569,7 @@ def gameday_thread_update_loop(self, todayGamePks): ) except Exception as e: self.log.error("Error editing game day thread: {}".format(e)) - self.error_notification(f"Error editing game day thread") + self.error_notification("Error editing game day thread") update_gameday_thread_until = self.settings.get("Game Day Thread", {}).get( "UPDATE_UNTIL", "Game thread is posted" @@ -3361,7 +3361,7 @@ def patch_dict(self, theDict, patch): # do nothing, because it will be handled on the next loop if redball.DEV: self.log.debug( - f"missing key, but not a problem because op=add; continuing..." + "missing key, but not a problem because op=add; continuing..." ) continue else: @@ -4988,7 +4988,7 @@ def prep_and_post(self, thread, pk=None, postFooter=None): break except Exception as e: self.log.error("Error checking subreddit for existing posts: {}".format(e)) - self.error_notification(f"Error checking subreddit for existing posts") + self.error_notification("Error checking subreddit for existing posts") if not theThread: try: @@ -5170,7 +5170,7 @@ def prep_and_post(self, thread, pk=None, postFooter=None): accessSecret=tAccessSecret, ) if tweetResult: - self.log.info(f"Tweet submitted successfully!") + self.log.info("Tweet submitted successfully!") else: self.log.warning("No thread object present. Something went wrong!") @@ -5253,7 +5253,7 @@ def post_webhook(self, url, body): ) ) self.error_notification( - f"Failed to convert webhook template from json format. Ensure there are no line breaks or other special characters in the rendered template" + "Failed to convert webhook template from json format. Ensure there are no line breaks or other special characters in the rendered template" ) return "Failed to convert webhook template from json format. Ensure there are no line breaks or other special characters in the rendered template. Error: {}".format( e @@ -5329,7 +5329,7 @@ def submit_reddit_post( "Failed to set flair on thread {post.id} (check mod privileges or change FLAIR_MODE to submitter), continuing..." ) self.error_notification( - f"Failed to set flair (check mod privileges or change FLAIR_MODE to submitter)" + "Failed to set flair (check mod privileges or change FLAIR_MODE to submitter)" ) if sort not in [None, ""]: @@ -5585,7 +5585,7 @@ def init_reddit(self): self.log.error( "Error encountered attempting to initialize Reddit: {}".format(e) ) - self.error_notification(f"Error initializing Reddit") + self.error_notification("Error initializing Reddit") raise scopes = [ @@ -5607,7 +5607,7 @@ def init_reddit(self): ) ) self.error_notification( - f"Error encountered attempting to look up authorized Reddit scopes" + "Error encountered attempting to look up authorized Reddit scopes" ) raise @@ -5622,7 +5622,7 @@ def init_reddit(self): ) ) self.error_notification( - f"Error encountered attempting to identify authorized Reddit user (identity scope may not be authorized)" + "Error encountered attempting to identify authorized Reddit user (identity scope may not be authorized)" ) for scope in scopes: @@ -6272,7 +6272,7 @@ def bot_state(self): "markdown": "Error retrieving bot state: {}".format(e), }, } - self.error_notification(f"Error retrieving bot state") + self.error_notification("Error retrieving bot state") self.log.debug("Bot Status: {}".format(botStatus)) # debug self.bot.detailedState = botStatus From ece9bfd33d2b6db8a7e9994295046830a3f9672b Mon Sep 17 00:00:00 2001 From: todd Date: Mon, 6 Jul 2020 20:26:43 -0400 Subject: [PATCH 4/9] Add docker-compose.yml --- docker-compose.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8044fa5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.0' +services: + redball: + container_name: redball + image: toddrob/redball:latest + volumes: + - ./data:/app/data + - ./logs:/app/logs + - ./custom_templates:/app/custom_templates + - ./certs:/app/certs + environment: + - TZ=America/New_York + restart: unless-stopped + network_mode: bridge + ports: + - 8087:8087 From 23396265b8531fcaeba97b1700e8364197e93f66 Mon Sep 17 00:00:00 2001 From: todd Date: Mon, 13 Jul 2020 20:41:39 -0400 Subject: [PATCH 5/9] ENH: Update docker image to python-3.8.3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7378612..4529ecc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:alpine3.8 +FROM python:3.8.3-alpine LABEL Name=redball Version=0.0.7 From d20fa17c08163e66efce796dc24bbcbcd106a7b3 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 14 Jul 2020 08:57:01 -0400 Subject: [PATCH 6/9] FIX: Thread update process crashes on game with team that has no Division ("Intrasquad") --- bots/game_threads/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bots/game_threads/__init__.py b/bots/game_threads/__init__.py index a0dd880..442b789 100644 --- a/bots/game_threads/__init__.py +++ b/bots/game_threads/__init__.py @@ -1289,8 +1289,8 @@ def off_thread_update_loop(self): and x["status"]["codedGameState"] not in ["C", "D", "U", "T"] and self.myTeam["division"]["id"] in [ - x["teams"]["away"]["team"]["division"]["id"], - x["teams"]["home"]["team"]["division"]["id"], + x["teams"]["away"]["team"].get("division", {}).get("id"), + x["teams"]["home"]["team"].get("division", {}).get("id"), ] ), False, @@ -1636,8 +1636,8 @@ def gameday_thread_update_loop(self, todayGamePks): and x["status"]["codedGameState"] not in ["C", "D", "U", "T"] and self.myTeam["division"]["id"] in [ - x["teams"]["away"]["team"]["division"]["id"], - x["teams"]["home"]["team"]["division"]["id"], + x["teams"]["away"]["team"].get("division", {}).get("id"), + x["teams"]["home"]["team"].get("division", {}).get("id"), ] ), False, @@ -2187,8 +2187,8 @@ def game_thread_update_loop(self, pk): and x["status"]["codedGameState"] not in ["C", "D", "U", "T"] and self.myTeam["division"]["id"] in [ - x["teams"]["away"]["team"]["division"]["id"], - x["teams"]["home"]["team"]["division"]["id"], + x["teams"]["away"]["team"].get("division", {}).get("id"), + x["teams"]["home"]["team"].get("division", {}).get("id"), ] ), False, @@ -2544,8 +2544,8 @@ def postgame_thread_update_loop(self, pk): and x["status"]["codedGameState"] not in ["C", "D", "U", "T"] and self.myTeam["division"]["id"] in [ - x["teams"]["away"]["team"]["division"]["id"], - x["teams"]["home"]["team"]["division"]["id"], + x["teams"]["away"]["team"].get("division", {}).get("id"), + x["teams"]["home"]["team"].get("division", {}).get("id"), ] ), False, From d415ad3ad8b35a67ab3268de56c3e2fb6f808724 Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 14 Jul 2020 10:57:24 -0400 Subject: [PATCH 7/9] FIX: Support for some new data permutations during weird season --- bots/game_threads/templates/game_thread.mako | 2 +- bots/game_threads/templates/gameday_thread.mako | 2 +- bots/game_threads/templates/matchup.mako | 2 +- bots/game_threads/templates/probable_pitchers.mako | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bots/game_threads/templates/game_thread.mako b/bots/game_threads/templates/game_thread.mako index d26ca85..886c1df 100644 --- a/bots/game_threads/templates/game_thread.mako +++ b/bots/game_threads/templates/game_thread.mako @@ -30,7 +30,7 @@ ${'- ' + str(data[gamePk]['schedule']['linescore']['outs']) + ' out' + ('s' if d ## Game status is not final or live (except warmup), include standings, probable pitchers, lineups if posted % if (data[gamePk]['schedule']['status']['abstractGameCode'] != 'L' or data[gamePk]['schedule']['status']['statusCode'] == 'PW') and data[gamePk]['schedule']['status']['abstractGameCode'] != 'F': -% if data[0]['myTeam']['seasonState'] == 'regular': +% if data[0]['myTeam']['seasonState'] == 'regular' and data[pk]['schedule']['gameType'] == "R": <%include file="standings.mako" /> % endif diff --git a/bots/game_threads/templates/gameday_thread.mako b/bots/game_threads/templates/gameday_thread.mako index fc6d8e0..7e8c357 100644 --- a/bots/game_threads/templates/gameday_thread.mako +++ b/bots/game_threads/templates/gameday_thread.mako @@ -20,7 +20,7 @@ ${'###'}\ ## probable pitchers vs. teams % endfor -% if data[0]['myTeam']['seasonState'] == 'regular': +% if data[0]['myTeam']['seasonState'] == 'regular' and data[pk]['schedule']['gameType'] == "R": <%include file="standings.mako" /> % endif diff --git a/bots/game_threads/templates/matchup.mako b/bots/game_threads/templates/matchup.mako index fb99e67..b8e8545 100644 --- a/bots/game_threads/templates/matchup.mako +++ b/bots/game_threads/templates/matchup.mako @@ -1,3 +1,3 @@ <%page args="gamePk,dateFormat='%a, %b %d @ %I:%M %p %Z'" />\ ## Matchup header: Team names with links to team subs and matchup image, followed by game date -[${data[gamePk]['schedule']['teams']['away']['team']['teamName']}](${data[0]['teamSubs'][data[gamePk]['schedule']['teams']['away']['team']['id']]}) [@](http://mlb.mlb.com/images/2017_ipad/684/${data[gamePk]['schedule']['teams']['away']['team']['fileCode'] + data[gamePk]['schedule']['teams']['home']['team']['fileCode']}_684.jpg) [${data[gamePk]['schedule']['teams']['home']['team']['teamName']}](${data[0]['teamSubs'][data[gamePk]['schedule']['teams']['home']['team']['id']]}) - ${data[gamePk]['gameTime']['myTeam'].strftime(dateFormat)} \ No newline at end of file +[${data[gamePk]['schedule']['teams']['away']['team']['teamName']}](${data[0]['teamSubs'].get(data[gamePk]['schedule']['teams']['away']['team']['id'], data[0]['teamSubs'][0])}) [@](http://mlb.mlb.com/images/2017_ipad/684/${data[gamePk]['schedule']['teams']['away']['team']['fileCode'] + data[gamePk]['schedule']['teams']['home']['team']['fileCode']}_684.jpg) [${data[gamePk]['schedule']['teams']['home']['team']['teamName']}](${data[0]['teamSubs'].get(data[gamePk]['schedule']['teams']['home']['team']['id'], data[0]['teamSubs'][0])}) - ${data[gamePk]['gameTime']['myTeam'].strftime(dateFormat)} \ No newline at end of file diff --git a/bots/game_threads/templates/probable_pitchers.mako b/bots/game_threads/templates/probable_pitchers.mako index 118d12a..85799cd 100644 --- a/bots/game_threads/templates/probable_pitchers.mako +++ b/bots/game_threads/templates/probable_pitchers.mako @@ -11,7 +11,7 @@ %>\ ||Probable Pitcher (Season Stats)|Report| |:--|:--|:--| -|[${data[gamePk]['gumbo']["gameData"]["teams"]['away']['teamName']}](${data[0]['teamSubs'][data[gamePk]['gumbo']["gameData"]["teams"]['away']['id']]})|\ +|[${data[gamePk]['gumbo']["gameData"]["teams"]['away']['teamName']}](${data[0]['teamSubs'].get(data[gamePk]['gumbo']["gameData"]["teams"]['away']['id'], data[0]['teamSubs'][0])})|\ ${playerLink(awayPitcherData['person']['fullName'],awayPitcherData['person']['id']) if awayPitcherData['person']['fullName'] != 'TBD' else 'TBD'}\ % if awayPitcherData['person']['fullName'] != 'TBD': (${awayPitcherData['seasonStats']['pitching'].get('wins',0)}-${awayPitcherData['seasonStats']['pitching'].get('losses',0)}, ${awayPitcherData['seasonStats']['pitching'].get('era','0')} ERA, ${awayPitcherData['seasonStats']['pitching'].get('inningsPitched',0)} IP)|\ @@ -20,7 +20,7 @@ ${playerLink(awayPitcherData['person']['fullName'],awayPitcherData['person']['id % endif ${awayPitcher.get('note','No report posted.')}| \ -|[${data[gamePk]['gumbo']["gameData"]["teams"]['home']['teamName']}](${data[0]['teamSubs'][data[gamePk]['gumbo']["gameData"]["teams"]['home']['id']]})|\ +|[${data[gamePk]['gumbo']["gameData"]["teams"]['home']['teamName']}](${data[0]['teamSubs'].get(data[gamePk]['gumbo']["gameData"]["teams"]['home']['id'], data[0]['teamSubs'][0])})|\ ${playerLink(homePitcherData['person']['fullName'],homePitcherData['person']['id']) if homePitcherData['person']['fullName'] != 'TBD' else 'TBD'}\ % if homePitcherData['person']['fullName'] != 'TBD': (${homePitcherData['seasonStats']['pitching'].get('wins',0)}-${homePitcherData['seasonStats']['pitching'].get('losses',0)}, ${homePitcherData['seasonStats']['pitching'].get('era','-')} ERA, ${homePitcherData['seasonStats']['pitching'].get('inningsPitched',0)} IP)|\ From 0de2a999380c1ad74b71653b5c8861be0ffc6a6c Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 14 Jul 2020 19:02:28 -0400 Subject: [PATCH 8/9] Fix data issues with seasonState and game_thread template --- bots/game_threads/__init__.py | 14 ++++++++++---- bots/game_threads/templates/game_thread.mako | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bots/game_threads/__init__.py b/bots/game_threads/__init__.py index 442b789..a87fa5d 100644 --- a/bots/game_threads/__init__.py +++ b/bots/game_threads/__init__.py @@ -126,7 +126,8 @@ def run(self): break self.myTeam = self.get_team( - self.settings.get("MLB", {}).get("TEAM", "").split("|")[1] + self.settings.get("MLB", {}).get("TEAM", "").split("|")[1], + s=datetime.now().strftime("%Y") # band-aid due to MLB defaulting team page to 2021 season in July 2020 ) self.log.info("Configured team: {}".format(self.myTeam["name"])) @@ -3442,6 +3443,7 @@ def get_gamePks(self, t=None, o=None, d=None, sd=None, ed=None): return pks def get_seasonState(self, t=None): + self.log.debug(f"myteam league seasondateinfo: {self.myTeam['league']['seasonDateInfo']}") if ( datetime.strptime( self.myTeam["league"]["seasonDateInfo"]["preSeasonStartDate"], @@ -4802,9 +4804,13 @@ def get_schedule_data( s = self.api_call("schedule", params) return s - def get_team(self, t, h="league,division,venue(timezone)"): - # t = teamId, h = hydrate - return self.api_call("team", {"teamId": t, "hydrate": h})["teams"][0] + def get_team(self, t, h="league,division,venue(timezone)", s=None): + # t = teamId, h = hydrate, s = season + params = {"teamId": t, "hydrate": h} + if s: + params.update({"season": s}) + + return self.api_call("team", params)["teams"][0] def log_last_updated_date_in_db(self, threadId, t=None): # threadId = Reddit thread id that was edited, t = timestamp of edit diff --git a/bots/game_threads/templates/game_thread.mako b/bots/game_threads/templates/game_thread.mako index 886c1df..9296f3e 100644 --- a/bots/game_threads/templates/game_thread.mako +++ b/bots/game_threads/templates/game_thread.mako @@ -30,7 +30,7 @@ ${'- ' + str(data[gamePk]['schedule']['linescore']['outs']) + ' out' + ('s' if d ## Game status is not final or live (except warmup), include standings, probable pitchers, lineups if posted % if (data[gamePk]['schedule']['status']['abstractGameCode'] != 'L' or data[gamePk]['schedule']['status']['statusCode'] == 'PW') and data[gamePk]['schedule']['status']['abstractGameCode'] != 'F': -% if data[0]['myTeam']['seasonState'] == 'regular' and data[pk]['schedule']['gameType'] == "R": +% if data[0]['myTeam']['seasonState'] == 'regular' and data[gamePk]['schedule']['gameType'] == "R": <%include file="standings.mako" /> % endif From 593c726cbec6ce30cffa53f9bbe3452c8ed3a56a Mon Sep 17 00:00:00 2001 From: todd Date: Sat, 18 Jul 2020 13:59:18 -0400 Subject: [PATCH 9/9] Fix log entry typo --- bots/game_threads/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bots/game_threads/__init__.py b/bots/game_threads/__init__.py index a87fa5d..c6b4266 100644 --- a/bots/game_threads/__init__.py +++ b/bots/game_threads/__init__.py @@ -2375,7 +2375,7 @@ def postgame_thread_update_loop(self, pk): ) postGameThread = self.reddit.submission(pgThread[0]["id"]) if not postGameThread.author: - self.log.warning("Game day thread appears to have been deleted.") + self.log.warning("Post game thread appears to have been deleted.") q = "update {}threads set deleted=1 where id='{}';".format( self.dbTablePrefix, postGameThread.id )