mirror of
https://github.com/UiO-Gaming/mustafa.git
synced 2026-11-05 13:56:48 +01:00
make import style consistent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70c0236a16
commit
67a418ebe2
7 files changed
+38
-39
No files matched your search
@@ -39,7 +39,6 @@ atomic = true
|
||||
profile = "black"
|
||||
line_length = 120
|
||||
force_single_line = true
|
||||
known_first_party = ["black"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
|
||||
@@ -11,11 +11,9 @@ import numpy as np
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from cogs.utils import discord_utils
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils import misc_utils
|
||||
from cogs.utils.discord_utils import Lobby
|
||||
from cogs.utils.discord_utils import LobbyView
|
||||
from cogs.utils.discord_utils import open_lobby
|
||||
|
||||
|
||||
class CS2Bingo(commands.Cog):
|
||||
@@ -29,7 +27,7 @@ class CS2Bingo(commands.Cog):
|
||||
"""
|
||||
|
||||
self.bot = bot
|
||||
self.active_lobbies: dict[int, Lobby] = {}
|
||||
self.active_lobbies: dict[int, discord_utils.Lobby] = {}
|
||||
|
||||
bingo_group = app_commands.Group(name="cs2bingo", description="Bingo commands for CS2")
|
||||
|
||||
@@ -45,7 +43,7 @@ class CS2Bingo(commands.Cog):
|
||||
interaction (discord.Interaction): The slash command interaction
|
||||
"""
|
||||
|
||||
await open_lobby(interaction, self.active_lobbies, BingoView, "Bingolobby", timedelta(minutes=10))
|
||||
await discord_utils.open_lobby(interaction, self.active_lobbies, BingoView, "Bingolobby", timedelta(minutes=10))
|
||||
|
||||
|
||||
class BingoGenerator:
|
||||
@@ -167,10 +165,10 @@ class BingoGenerator:
|
||||
return cv2.imencode(".png", image)[1].tobytes()
|
||||
|
||||
|
||||
class BingoView(LobbyView):
|
||||
class BingoView(discord_utils.LobbyView):
|
||||
"""Bingo lobby that sends every player a bingo sheet when started"""
|
||||
|
||||
def __init__(self, lobby: Lobby, bot: commands.Bot):
|
||||
def __init__(self, lobby: discord_utils.Lobby, bot: commands.Bot):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
|
||||
+13
-13
@@ -1,16 +1,3 @@
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from random import randint
|
||||
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext import tasks
|
||||
|
||||
from cogs.utils import discord_utils
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils import misc_utils
|
||||
|
||||
"""
|
||||
------ GJORT ------
|
||||
- score for skriving om morgenen (kl. 5-9)
|
||||
@@ -25,6 +12,19 @@ from cogs.utils import misc_utils
|
||||
+ score for å sitte i voice
|
||||
"""
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from random import randint
|
||||
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext import tasks
|
||||
|
||||
from cogs.utils import discord_utils
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils import misc_utils
|
||||
|
||||
|
||||
@dataclass
|
||||
class CreditUser:
|
||||
|
||||
@@ -2,8 +2,8 @@ import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from cogs.utils import discord_utils
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils.discord_utils import TempVoiceHelper
|
||||
|
||||
|
||||
class TempVoice(commands.Cog):
|
||||
@@ -16,7 +16,7 @@ class TempVoice(commands.Cog):
|
||||
bot (commands.Bot): The bot instance
|
||||
"""
|
||||
|
||||
self.temp_voice_helper = TempVoiceHelper(bot)
|
||||
self.temp_voice_helper = discord_utils.TempVoiceHelper(bot)
|
||||
|
||||
async def cog_load(self):
|
||||
"""
|
||||
|
||||
+8
-8
@@ -11,10 +11,8 @@ import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from cogs.utils import discord_utils
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils.discord_utils import Lobby
|
||||
from cogs.utils.discord_utils import LobbyView
|
||||
from cogs.utils.discord_utils import open_lobby
|
||||
|
||||
# Seconds without any interaction before the menus and buttons are disabled
|
||||
SELECTION_TIMEOUT = 300
|
||||
@@ -31,7 +29,7 @@ class TenMan(commands.Cog):
|
||||
"""
|
||||
|
||||
self.bot = bot
|
||||
self.active_lobbies: dict[int, Lobby] = {}
|
||||
self.active_lobbies: dict[int, discord_utils.Lobby] = {}
|
||||
|
||||
ten_man_group = app_commands.Group(name="10man", description="For planlegging og arrangering av 10 mans")
|
||||
|
||||
@@ -47,10 +45,12 @@ class TenMan(commands.Cog):
|
||||
interaction (discord.Interaction): The slash command interaction
|
||||
"""
|
||||
|
||||
await open_lobby(interaction, self.active_lobbies, TenManView, "10 Man Lobby", timedelta(minutes=30))
|
||||
await discord_utils.open_lobby(
|
||||
interaction, self.active_lobbies, TenManView, "10 Man Lobby", timedelta(minutes=30)
|
||||
)
|
||||
|
||||
|
||||
class TenManView(LobbyView):
|
||||
class TenManView(discord_utils.LobbyView):
|
||||
"""The lobby players join before the teams are picked"""
|
||||
|
||||
@discord.ui.button(label="Start", style=discord.ButtonStyle.green)
|
||||
@@ -153,7 +153,7 @@ class TeamDraft:
|
||||
class StageView(discord.ui.View):
|
||||
"""A step of the flow after the lobby has closed"""
|
||||
|
||||
def __init__(self, lobby: Lobby, bot: commands.Bot, message: discord.PartialMessage):
|
||||
def __init__(self, lobby: discord_utils.Lobby, bot: commands.Bot, message: discord.PartialMessage):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
@@ -221,7 +221,7 @@ class StageView(discord.ui.View):
|
||||
class TeamLeaderView(StageView):
|
||||
"""The host picks two team leaders"""
|
||||
|
||||
def __init__(self, lobby: Lobby, bot: commands.Bot, message: discord.PartialMessage):
|
||||
def __init__(self, lobby: discord_utils.Lobby, bot: commands.Bot, message: discord.PartialMessage):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
|
||||
@@ -9,9 +9,8 @@ import psycopg
|
||||
from discord.ext import commands
|
||||
from discord.ext import tasks
|
||||
|
||||
from . import embed_templates
|
||||
from .misc_utils import Paginator
|
||||
from .misc_utils import log_errors
|
||||
from cogs.utils import embed_templates
|
||||
from cogs.utils import misc_utils
|
||||
|
||||
|
||||
async def send_as_txt_file(interaction: discord.Interaction, content: str, filename: str):
|
||||
@@ -53,7 +52,7 @@ class ScrollerButton(discord.ui.Button):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
paginator: Paginator,
|
||||
paginator: misc_utils.Paginator,
|
||||
button_action: callable,
|
||||
content_constructor: callable,
|
||||
owner: discord.User | discord.Member,
|
||||
@@ -103,7 +102,10 @@ class Scroller(discord.ui.View):
|
||||
"""View that allows scrolling through pages of data using the pagination module"""
|
||||
|
||||
def __init__(
|
||||
self, paginator: Paginator, owner: discord.User | discord.Member, content_constructor: callable = None
|
||||
self,
|
||||
paginator: misc_utils.Paginator,
|
||||
owner: discord.User | discord.Member,
|
||||
content_constructor: callable = None,
|
||||
):
|
||||
"""
|
||||
Parameters
|
||||
@@ -566,7 +568,7 @@ class TempVoiceHelper:
|
||||
self.temp_vc_channels[channel]["no_members_since"] = None
|
||||
|
||||
@tasks.loop(minutes=1)
|
||||
@log_errors
|
||||
@misc_utils.log_errors
|
||||
async def check_temp_vc_channels(self):
|
||||
"""
|
||||
Check for temporary voice channels that have been inactive for 1 minute
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ import yaml
|
||||
from discord.ext import commands
|
||||
from psycopg_pool import AsyncConnectionPool
|
||||
|
||||
from cogs.utils import database
|
||||
from cogs.utils import misc_utils
|
||||
from cogs.utils.database import Database
|
||||
from logger import BotLogger
|
||||
|
||||
DATABASE_RELIANT_COGS = {
|
||||
@@ -75,7 +75,7 @@ class Bot(commands.Bot):
|
||||
max_size=5,
|
||||
open=False,
|
||||
)
|
||||
self.db = Database(self.db_pool)
|
||||
self.db = database.Database(self.db_pool)
|
||||
|
||||
if self.check_credentials(config["sanity"], SANITY_RELIANT_COGS):
|
||||
self.sanity = config["sanity"]
|
||||
|
||||
Reference in new issue
Block a user