Simplify find_next_valid_topic_id, adjust template
This commit is contained in:
parent
ae416242e2
commit
30654c1580
20
main.py
20
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)
|
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
|
CHATGPT_TEMPLATE = '''
|
||||||
caption that tells about what a member of our makerspace has made. Add the
|
Turn this forum post into an two paragraph instagram caption that tells about what a member of our makerspace has made.
|
||||||
hashtags: #makerspace #yyc #maker #diy #calgary and several relevant to the post
|
Add the hashtags: #makerspace #yyc #maker #diy #calgary and several relevant to the post at the end.
|
||||||
at the end. Include a sentence explaining that this was made at Calgary
|
Include a sentence explaining that this was made at Calgary Protospace, a makerspace that's non-profit and volunteer run.
|
||||||
Protospace, a makerspace that's non-profit and community ran. Only say the
|
Only say the member's name once.
|
||||||
member's name once. Use no more than 1000 characters. Write in third person.
|
Use no more than 1000 characters.
|
||||||
|
Write in third person.
|
||||||
|
Do not @ tag anybody.
|
||||||
|
|
||||||
Title: {}
|
Title: {}
|
||||||
Member: {}
|
Member: {}
|
||||||
|
@ -221,12 +223,12 @@ def find_next_valid_topic_id(topic_ids):
|
||||||
if data['states'][topic_id]['status'] in ['POSTED', 'ERROR']:
|
if data['states'][topic_id]['status'] in ['POSTED', 'ERROR']:
|
||||||
continue
|
continue
|
||||||
except KeyError:
|
except KeyError:
|
||||||
break
|
pass
|
||||||
else: # for loop
|
|
||||||
return False
|
|
||||||
|
|
||||||
return topic_id
|
return topic_id
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
async def send_data_to_admin(state):
|
async def send_data_to_admin(state):
|
||||||
try:
|
try:
|
||||||
await bot.send_message(
|
await bot.send_message(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user