From 5568a1dc75aac58ae023127f460e5355f3e20157 Mon Sep 17 00:00:00 2001 From: christian Date: Thu, 12 Aug 2021 19:50:13 +0200 Subject: [PATCH] further updates to messages again --- suggestionsbot/discord_suggestions.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/suggestionsbot/discord_suggestions.py b/suggestionsbot/discord_suggestions.py index b6675871..a9ab86ff 100644 --- a/suggestionsbot/discord_suggestions.py +++ b/suggestionsbot/discord_suggestions.py @@ -55,15 +55,22 @@ async def check_suggestions_to_delete(): msgs_history = channel.history() j1 = await msgs_history.flatten() status_msg = "STATUS: No admin interested yet (mark with an emote to prevent suggestion deletion within 48 hours)" + status = 'STATUS:' + suggestion = 'SUGGESTION:' for msg in j1: if len(msg.reactions) == 0: created_at = msg.created_at if created_at < datetime.datetime.now()-datetime.timedelta(days=2): print('deleting message: ', msg.content) await msg.delete() - elif status_msg in msg.content: - first_part = msg.content.split(status_msg)[0] - last_part = msg.content.split(status_msg)[1] + else: + first_part = msg.content.split(status)[0] + last_part = msg.content.split(suggestion)[1] + final_msg = f'{first_part}{status_msg}\n{suggestion}{last_part}' + await msg.edit(content=final_msg) + elif status in msg.content: + first_part = msg.content.split(status)[0] + last_part = msg.content.split(suggestion)[1] user_reactions = [] for react in msg.reactions: users = react.users() @@ -71,7 +78,7 @@ async def check_suggestions_to_delete(): for user in j2: if user.name not in user_reactions: user_reactions.append(user.name) - final_msg = f'{first_part}STATUS: Admins interested in topic:{user_reactions} {last_part}' + final_msg = f'{first_part}STATUS: Admins interested in topic:{user_reactions}\n{suggestion}{last_part}' await msg.edit(content=final_msg) #the entire syntax that is visisble from python3 terminal is not very well displayed in the docs of discord.py and nobody has the current syntax in any suggestions anywhere on the internet. almost every single thing is out of date reee