From 30654c1580ad6fc0ca11f76efdb7d33fc1bd2ebb Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 13 Jan 2024 20:36:53 +0000 Subject: [PATCH] Simplify find_next_valid_topic_id, adjust template --- main.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 80f093c..ae11863 100644 --- a/main.py +++ b/main.py @@ -20,12 +20,14 @@ TIMEZONE_CALGARY = pytz.timezone('America/Edmonton') bot = TelegramClient('data/bot', secrets.API_ID, secrets.API_HASH).start(bot_token=secrets.API_TOKEN) -CHATGPT_TEMPLATE = '''Turn this forum post into an two paragraph instagram -caption that tells about what a member of our makerspace has made. Add the -hashtags: #makerspace #yyc #maker #diy #calgary and several relevant to the post -at the end. Include a sentence explaining that this was made at Calgary -Protospace, a makerspace that's non-profit and community ran. Only say the -member's name once. Use no more than 1000 characters. Write in third person. +CHATGPT_TEMPLATE = ''' +Turn this forum post into an two paragraph instagram caption that tells about what a member of our makerspace has made. +Add the hashtags: #makerspace #yyc #maker #diy #calgary and several relevant to the post at the end. +Include a sentence explaining that this was made at Calgary Protospace, a makerspace that's non-profit and volunteer run. +Only say the member's name once. +Use no more than 1000 characters. +Write in third person. +Do not @ tag anybody. Title: {} Member: {} @@ -221,11 +223,11 @@ def find_next_valid_topic_id(topic_ids): if data['states'][topic_id]['status'] in ['POSTED', 'ERROR']: continue except KeyError: - break - else: # for loop - return False + pass - return topic_id + return topic_id + + return False async def send_data_to_admin(state): try: