Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed autoposting from meta-editing to AI safety questions channel #323

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions modules/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from config import coda_api_token, is_rob_server
from servicemodules.discordConstants import (
general_channel_id,
meta_editing_channel_id,
ai_safety_questions_channel_id,
)
from modules.module import Module, Response
from utilities.utilities import (
Expand Down Expand Up @@ -415,15 +415,16 @@ async def autopost_not_started(self) -> None:
def is_time_for_autopost_wip(self) -> bool:
now = datetime.now()
return (
now.weekday() in (0, 2, 4) # Monday, Wednesday, or Friday
now.weekday() in (0, 4) # Monday or Friday
Aprillion marked this conversation as resolved.
Show resolved Hide resolved
and 8 <= now.hour <= 12 # between 08:00 and 12:00
and self.last_wip_autopost_attempt_date
!= now.date() # Wasn't posted today yet
)

async def last_msg_in_meta_editing_was_autoposted(self) -> bool:
async def last_msg_in_ai_safety_questions_was_autoposted(self) -> bool:
channel = cast(
TextChannel, self.utils.client.get_channel(int(meta_editing_channel_id))
TextChannel,
self.utils.client.get_channel(int(ai_safety_questions_channel_id)),
)
async for msg in channel.history(limit=1):
if msg.content.startswith(self.AUTOPOST_STAGNANT_MSG_PREFIX):
Expand All @@ -436,7 +437,7 @@ async def autopost_wip(self) -> None:
today = date.today()
self.last_wip_autopost_attempt_date = today

if await self.last_msg_in_meta_editing_was_autoposted():
if await self.last_msg_in_ai_safety_questions_was_autoposted():
self.log.info(
self.class_name,
msg="Last message in `#meta-editing` was one or more autoposted WIP question(s) -> skipping autoposting",
Expand Down Expand Up @@ -475,7 +476,8 @@ async def autopost_wip(self) -> None:
self.coda_api.last_question_id = questions[0]["id"]

channel = cast(
TextChannel, self.utils.client.get_channel(int(meta_editing_channel_id))
TextChannel,
self.utils.client.get_channel(int(ai_safety_questions_channel_id)),
)
current_time = datetime.now()
msg = self.AUTOPOST_STAGNANT_MSG_PREFIX + "\n\n"
Expand Down