Skip to content

Commit

Permalink
Fix lint/type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
raccube committed Aug 17, 2024
1 parent 3d04602 commit c194f5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import discord
from discord import app_commands

from src.commands.logs import logs
from src.constants import (
SPECIAL_ROLE,
VERIFIED_ROLE,
Expand All @@ -18,6 +17,7 @@
PASSWORDS_CHANNEL_NAME,
)
from src.commands.join import join
from src.commands.logs import logs
from src.commands.team import (
Team,
new_team,
Expand Down
20 changes: 10 additions & 10 deletions src/commands/logs.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import logging
import os
import re
import shutil
import sys
import shutil
import logging
import tempfile
from datetime import datetime
from enum import Enum
from typing import IO, cast, List, Tuple, TYPE_CHECKING
from pathlib import Path
from typing import TYPE_CHECKING, IO, Tuple, List, cast
from zipfile import BadZipFile, ZipFile, is_zipfile, ZIP_DEFLATED
from zipfile import ZipFile, BadZipFile, is_zipfile, ZIP_DEFLATED
from datetime import date

import aiohttp
import discord
Expand Down Expand Up @@ -251,7 +251,7 @@ async def logs_upload(
# The file will be removed with the temporary directory
continue

if team_animation and animations_found:
if team_animation == AnimationHandling.team and animations_found:
insert_match_files(tmpdir / archive_name, tmpdir / 'animations')

# get team's channel
Expand Down Expand Up @@ -290,7 +290,7 @@ async def logs_upload(

completed_tlas.append(tla)

if team_animation is False and animations_found:
if team_animation == AnimationHandling.separate and animations_found:
common_channel = await get_channel(ctx, "general")
# upload animations.zip to common channel
if common_channel:
Expand All @@ -311,7 +311,7 @@ async def logs_upload(
await log_and_reply(ctx, f"# {zip_name} is not a valid ZIP file")


@app_commands.command(
@app_commands.command( # type:ignore[arg-type]
name="logs",
description="Get combined logs archive from URL for distribution to teams, avoids Discord's size limit",
)
Expand All @@ -332,7 +332,7 @@ async def logs(
if url.endswith('.zip'):
filename = url.split("/")[-1]
else:
filename = f"logs_upload-{datetime.date.today()}.zip"
filename = f"logs_upload-{date.today()}.zip"

await interaction.response.defer(thinking=True) # provides feedback that the bot is processing
# download zip, using aiohttp
Expand All @@ -358,6 +358,6 @@ async def logs(
interaction,
zipfile,
filename,
event_name,
event_name or "",
animations,
)
4 changes: 2 additions & 2 deletions src/commands/team.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Mapping
from typing import Mapping, TYPE_CHECKING

import discord
from discord import app_commands
Expand All @@ -12,9 +12,9 @@
ROLE_PREFIX,
TEAM_LEADER_ROLE,
TEAM_CATEGORY_NAME,
TEAM_CHANNEL_PREFIX,
PASSWORDS_CHANNEL_NAME,
TEAM_VOICE_CATEGORY_NAME,
TEAM_CHANNEL_PREFIX,
)

TEAM_CREATED_REASON = "Created via command by "
Expand Down

0 comments on commit c194f5d

Please sign in to comment.