Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12893288f8 |
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
FROM python:3.12.3-slim
|
||||
|
||||
# install uv
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.11.25 /uv /uvx /bin/
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.6.6 /uv /uvx /bin/
|
||||
|
||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install sqlite3
|
||||
|
||||
|
||||
@@ -251,10 +251,6 @@ class SetCog(commands.Cog, name="Set command."):
|
||||
channel (nextcord.abc.GuildChannel, optional): Channel to register.
|
||||
Is a SlashOption. Limited to text channels, Defaults to None.
|
||||
"""
|
||||
if interaction.guild is None or interaction.channel is None:
|
||||
agon_logger.warning("Set command was called with an interaction that had no guild or channel.")
|
||||
return
|
||||
|
||||
channel_id = interaction.channel.id if not channel else channel.id
|
||||
|
||||
with Session(engine) as session:
|
||||
@@ -266,14 +262,11 @@ class SetCog(commands.Cog, name="Set command."):
|
||||
if (group := session.scalar(stmt)) is None:
|
||||
await interaction.response.send_message("Group or Category was not found.", ephemeral=True)
|
||||
return
|
||||
old_channel_id = group.channel_id
|
||||
group.channel_id = channel_id
|
||||
session.commit()
|
||||
|
||||
old_channel = interaction.guild.get_channel(old_channel_id)
|
||||
if old_channel and isinstance(old_channel, nextcord.TextChannel | nextcord.Thread) and group.message_id:
|
||||
await old_channel.get_partial_message(group.message_id).delete()
|
||||
|
||||
# TODO(imcompiling): delete the message and call send_highscore_message to send a new one. Bug needs fixed
|
||||
# first.
|
||||
# 082
|
||||
await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True)
|
||||
|
||||
@group.subcommand(
|
||||
|
||||
@@ -80,7 +80,9 @@ class SubmissionCog(commands.Cog):
|
||||
if (
|
||||
verified_score := await self.verify_score(interaction, score, is_time_record=category.is_time_record)
|
||||
) is None:
|
||||
# Verify score handles responding. Might change when submit is split up.
|
||||
# This response message will be filled out better once command is split up to
|
||||
# know which type it expects...
|
||||
await interaction.response.send_message("Format was incorrect.", ephemeral=True)
|
||||
return
|
||||
|
||||
# Create submission verification request or submit score if verification not needed.
|
||||
@@ -208,9 +210,9 @@ class SubmissionCog(commands.Cog):
|
||||
elif re.search("^[0-9](\\.[0-9])?$", score):
|
||||
# need to add 0 in seconds and leading colon and 0
|
||||
score = "0:0" + score
|
||||
elif re.search("^[0][0-9]:[0-9]{2}(\\.[0-9])?$", score):
|
||||
elif re.search("^[0]?[0-9]:[0-9]{2}(\\.[0-9])?$", score):
|
||||
# if there is a minute 10ths place 0, remove
|
||||
score = score[1:]
|
||||
score = score.lstrip("0")
|
||||
|
||||
return score
|
||||
|
||||
|
||||
+5
-9
@@ -342,7 +342,7 @@ async def send_highscore_message(session: Session, guild: nextcord.Guild, group:
|
||||
group (CategoryGroup): group to post to the message.
|
||||
"""
|
||||
highscore_string = format_highscore_message(session, group)
|
||||
if (channel := guild.get_channel(group.channel_id)) is None:
|
||||
if (channel := guild.get_channel_or_thread(group.channel_id)) is None:
|
||||
agon_logger.error("Channel id %s in guild %s does not exist.", group.channel_id, guild.id)
|
||||
return
|
||||
|
||||
@@ -358,14 +358,10 @@ async def send_highscore_message(session: Session, guild: nextcord.Guild, group:
|
||||
group.message_id = message.id
|
||||
session.commit()
|
||||
else:
|
||||
try:
|
||||
message: nextcord.Message = await channel.fetch_message(group.message_id)
|
||||
await message.edit(content=highscore_string)
|
||||
except nextcord.NotFound:
|
||||
# Message was deleted on discord's side.
|
||||
message: nextcord.Message = await channel.send(highscore_string)
|
||||
group.message_id = message.id
|
||||
session.commit()
|
||||
# TODO(imcompiling): check what happens when message is deleted.
|
||||
# https://gitea.cheezers.org/imcompiling/agon/issues/83
|
||||
message: nextcord.Message = await channel.fetch_message(group.message_id)
|
||||
await message.edit(content=highscore_string)
|
||||
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user