Simplify find_next_valid_topic_id, adjust template

This commit is contained in:
Tanner Collin 2024-01-13 20:36:53 +00:00
parent ae416242e2
commit 30654c1580

22
main.py
View File

@ -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: