Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12893288f8 | ||
|
|
0540f7a9eb | ||
|
|
a4aab09360 | ||
|
|
d82999b141 | ||
|
|
1ffb7fa9a7 | ||
|
|
2566bee0ce | ||
|
|
3d113a06d4 | ||
|
|
2e3b8c86da |
@@ -1,2 +1,5 @@
|
||||
.*
|
||||
Dockerfile
|
||||
LICENSE
|
||||
README.md
|
||||
renovate.json
|
||||
|
||||
@@ -2,14 +2,18 @@ name: build_develop
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
branches:
|
||||
- "*"
|
||||
- "!main"
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
@@ -20,7 +24,9 @@ jobs:
|
||||
registry: gitea.cheezers.org
|
||||
username: imcompiling
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: set env
|
||||
run: echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
|
||||
- name: Build Docker Image
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/agon:develop .
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/agon:${{env.GIT_BRANCH}} .
|
||||
- name: Push Docker Image
|
||||
run: docker push gitea.cheezers.org/imcompiling/agon:develop
|
||||
run: docker push gitea.cheezers.org/imcompiling/agon:${{env.GIT_BRANCH}}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
name: build_latest
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Docker
|
||||
uses: https://github.com/papodaca/install-docker-action@v1
|
||||
- name: Log into container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.cheezers.org
|
||||
username: imcompiling
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
- name: Build Docker Image
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/agon:latest .
|
||||
- name: Push Docker Image
|
||||
run: docker push gitea.cheezers.org/imcompiling/agon:latest
|
||||
@@ -23,8 +23,6 @@ jobs:
|
||||
- name: Set env
|
||||
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
- name: Build Docker Images
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/agon:latest -t gitea.cheezers.org/imcompiling/agon:${{env.GIT_TAG}} .
|
||||
- name: Push Latest Image
|
||||
run: docker push gitea.cheezers.org/imcompiling/agon:latest
|
||||
run: docker build -t gitea.cheezers.org/imcompiling/agon:${{env.GIT_TAG}} .
|
||||
- name: Push Tagged Image
|
||||
run: docker push gitea.cheezers.org/imcompiling/agon:${{env.GIT_TAG}}
|
||||
|
||||
+1
-1
@@ -135,4 +135,4 @@ deleted_backups/
|
||||
highscores_data/
|
||||
TODO.txt
|
||||
sql_tester.py
|
||||
database
|
||||
/database
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ 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
|
||||
|
||||
# Copy project to image
|
||||
ADD . /agon
|
||||
ADD . /home
|
||||
|
||||
# Sync the project into a new environment, using the frozen lockfile
|
||||
WORKDIR /agon
|
||||
WORKDIR /home
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
CMD ["uv", "run", "--frozen", "--no-dev", "-m", "agon"]
|
||||
|
||||
@@ -99,7 +99,7 @@ class CreateCog(commands.Cog, name="Create Cog"):
|
||||
min_value=1,
|
||||
max_value=30,
|
||||
),
|
||||
channel: nextcord.TextChannel | None = nextcord.SlashOption(
|
||||
channel: nextcord.TextChannel | nextcord.Thread | None = nextcord.SlashOption(
|
||||
description="Channel to post Group in. If left empty, defaults to current channel.",
|
||||
required=False,
|
||||
default=None,
|
||||
|
||||
@@ -37,7 +37,7 @@ class DeleteCog(commands.Cog, name="Delete Cog"):
|
||||
async def channel_messages(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
channel: nextcord.TextChannel | None = nextcord.SlashOption(
|
||||
channel: nextcord.TextChannel | nextcord.Thread | None = nextcord.SlashOption(
|
||||
description="Channel to clear of messages.",
|
||||
required=False,
|
||||
default=None,
|
||||
@@ -54,7 +54,7 @@ class DeleteCog(commands.Cog, name="Delete Cog"):
|
||||
Is a SlashOption. Limited to text channels. Defaults to None.
|
||||
"""
|
||||
if not channel:
|
||||
if isinstance(interaction.channel, nextcord.TextChannel):
|
||||
if isinstance(interaction.channel, nextcord.TextChannel | nextcord.Thread):
|
||||
channel = interaction.channel
|
||||
else:
|
||||
# This should never happen.
|
||||
|
||||
@@ -103,7 +103,7 @@ class SubmissionCog(commands.Cog):
|
||||
await interaction.response.send_message(error_response, ephemeral=True)
|
||||
return
|
||||
|
||||
if not isinstance(channel, nextcord.TextChannel):
|
||||
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
|
||||
await interaction.response.send_message("An error happened with submission.")
|
||||
agon_logger.error(
|
||||
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
|
||||
|
||||
@@ -43,7 +43,7 @@ class DeleteConfirmView(nextcord.ui.Modal):
|
||||
session.delete(group)
|
||||
# delete the message related to group
|
||||
channel = interaction.guild.get_channel(group.channel_id)
|
||||
if not isinstance(channel, nextcord.TextChannel):
|
||||
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
|
||||
return
|
||||
message: nextcord.Message = await channel.fetch_message(group.message_id)
|
||||
await message.delete()
|
||||
|
||||
+5
-3
@@ -342,11 +342,13 @@ 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)
|
||||
channel = guild.get_channel(group.channel_id)
|
||||
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
|
||||
|
||||
if not isinstance(channel, nextcord.TextChannel):
|
||||
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
|
||||
agon_logger.error(
|
||||
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
|
||||
"Channel id %s in guild %s is does not correspond to a TextChannel or Thread.", channel.id, channel.guild.id
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user