Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.11.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1 # Use the sha / tag you want to point at
rev: v1.19.1 # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies: [types-requests==2.31.0.1, types_pytz>=2023.3.1.0]
Expand Down
1 change: 1 addition & 0 deletions database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for interacting with the database throughout the bot."""

import motor.motor_asyncio

import constants
Expand Down
1 change: 1 addition & 0 deletions logs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Stores classes for storing log data and player stats"""

from steam.steamid import SteamID

from database import BotCollection
Expand Down
1 change: 1 addition & 0 deletions logs/elo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Elo calculations, storage and utilities."""

from difflib import SequenceMatcher
import math
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions logs/elo_cog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This cog contains the elo cog with commands to configure elo and add missing logs."""

import asyncio
import time

Expand Down
1 change: 1 addition & 0 deletions logs/logs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This cog contains the logs command and its subcommands."""

import nextcord
from nextcord.ext import commands, application_checks
from nextcord.enums import ChannelType
Expand Down
1 change: 1 addition & 0 deletions logs/logstf_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File storing the LogsAPI class, which is used to interact with the Logs.tf API."""

import asyncio

import aiohttp
Expand Down
1 change: 1 addition & 0 deletions logs/searcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements the log searcher file, which takes the players from a team generation or moved back and searches for the log associated with the game that was played/being played."""

import time
import traceback

Expand Down
1 change: 1 addition & 0 deletions logs/stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cog that handles stats and showing stats to players."""

from typing import Optional
import nextcord
from nextcord.ext import commands
Expand Down
1 change: 1 addition & 0 deletions menus/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains some useful callbacks for menus."""

from typing import Callable, Any

from nextcord import Interaction
Expand Down
7 changes: 4 additions & 3 deletions menus/templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to build predefined for use around the bot."""

from nextcord import ButtonStyle, Interaction, Embed
from nextcord.abc import GuildChannel
from nextcord.enums import ChannelType
Expand Down Expand Up @@ -81,9 +82,9 @@ async def send_channel_prompt(
ValueError
If required is True and no channel is selected for a entry.
"""
channel_selects: list[
ChannelSelect
] = [] # We'll go through this later to get the values
channel_selects: list[ChannelSelect] = (
[]
) # We'll go through this later to get the values
menu.clear_items()
if interaction.response.is_done():
await menu.edit(interaction)
Expand Down
1 change: 1 addition & 0 deletions pug/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Holds classes for pug commands/setup"""

from typing import Union, List, Dict, TypedDict
import time

Expand Down
3 changes: 1 addition & 2 deletions pug/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,7 @@ async def default_add_time(
async def manual_add(
self,
interaction: nextcord.Interaction,
add_time: int
| None = nextcord.SlashOption(
add_time: int | None = nextcord.SlashOption(
name="time",
description="The hours to add up for.",
required=False,
Expand Down
1 change: 1 addition & 0 deletions pug/med_immunity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Commands for randomly rolling medics in pugs."""

import datetime
import random
from typing import Set
Expand Down
16 changes: 10 additions & 6 deletions pug/pug.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,19 @@ async def generate_balanced_teams(
random.shuffle(players["add_up"])
# Deprioritize players that are not registered, as their skill is unknown
players["next_pug"].sort(
key=lambda x: 10
if x.get_division(gamemode, reg_settings.mode) == -1
else x.get_division(gamemode, reg_settings.mode),
key=lambda x: (
10
if x.get_division(gamemode, reg_settings.mode) == -1
else x.get_division(gamemode, reg_settings.mode)
),
reverse=False,
)
players["add_up"].sort(
key=lambda x: 10
if x.get_division(gamemode, reg_settings.mode) == -1
else x.get_division(gamemode, reg_settings.mode),
key=lambda x: (
10
if x.get_division(gamemode, reg_settings.mode) == -1
else x.get_division(gamemode, reg_settings.mode)
),
reverse=False,
)
all_players = players["next_pug"] + players["add_up"]
Expand Down
4 changes: 2 additions & 2 deletions pug/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cog to set up pug categories for the server."""

import nextcord
from nextcord.ext import commands
from nextcord.abc import GuildChannel
Expand Down Expand Up @@ -171,8 +172,7 @@ async def role_add(
value: int = nextcord.SlashOption(
name="value", description="The point value to give the role.", required=True
),
emote: str
| None = nextcord.SlashOption(
emote: str | None = nextcord.SlashOption(
name="emote", description="The emote to use for the role.", required=False
),
):
Expand Down
1 change: 1 addition & 0 deletions registration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains classes for registration of new users."""

import asyncio
from dataclasses import dataclass, field
import json
Expand Down
5 changes: 3 additions & 2 deletions registration/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ async def delete_user(
self,
interaction: nextcord.Interaction,
steam: str | None = nextcord.SlashOption(name="steam", required=None),
discord: nextcord.User
| None = nextcord.SlashOption(name="discord", required=False),
discord: nextcord.User | None = nextcord.SlashOption(
name="discord", required=False
),
):
"""Deletes a user from the database.

Expand Down
1 change: 1 addition & 0 deletions registration/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cog to hold commands to set up the registration part of the bot per server."""

import nextcord
from nextcord.ext import commands
from nextcord.ui import RoleSelect
Expand Down
1 change: 1 addition & 0 deletions registration/webserver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File holding the actual FastAPI webserver for use with the registration cog."""

import logging

from fastapi import FastAPI, APIRouter, Request, Response, status
Expand Down
1 change: 1 addition & 0 deletions rglapi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File containing the rglAPI class, which is used to interact with the RGL API."""

from datetime import datetime, timedelta

import aiohttp
Expand Down
1 change: 1 addition & 0 deletions servers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Classes for use in the servers cog."""

from datetime import datetime
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions test_cog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains all of the commands for the test bot."""

import gql
import nextcord
from gql.transport.aiohttp import AIOHTTPTransport
Expand Down
1 change: 1 addition & 0 deletions util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for use throughout the code."""

import aiohttp
import nextcord
from steam import steamid
Expand Down