Add string to the new schedule button sharing

This commit is contained in:
Marc Di Luzio 2024-08-17 22:53:05 +01:00
parent b5c86f51ca
commit 1b93396315
2 changed files with 21 additions and 6 deletions

View file

@ -300,16 +300,16 @@ class ScheduleButton(discord.ui.Button):
tasks = state.State.get_channel_match_tasks(interaction.channel.id)
msg = f"{interaction.user.mention} added a match to this channel!\n"
msg += "Current scheduled matches are:"
msg = strings.added_schedule(interaction.user.mention) + "\n"
msg += strings.scheduled_matches()
if tasks:
for (day, hour, min) in tasks:
next_run = util.get_next_datetime(day, hour)
date_str = util.datetime_as_discord_time(next_run)
msg += f"\n{date_str} with {min} members per group\n"
msg += strings.scheduled(next_run, min)
await interaction.channel.send(msg)
await interaction.response.send_message(content="Posted :)", ephemeral=True)
await interaction.response.send_message(
content=strings.acknowledgement(interaction.user.mention), ephemeral=True)
else:
await interaction.response.send_message(content="No scheduled matches to post :(", ephemeral=True)
await interaction.response.send_message(content=strings.no_scheduled(), ephemeral=True)

View file

@ -178,3 +178,18 @@ def matched_up(ms): return [
def thread_title(ms): return [
f"{format_list(ms)}",
]
@randomised
def added_schedule(m): return [
f"{m} added a match to this channel!"
f"A matchy run was scheduled by {m}."
f"{m} scheduled a match in here :)"
]
@randomised
def scheduled_matches(): return [
"Current scheduled matches are:"
"I've got these scheduled matches right now:"
]