Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ajax146 committed Jul 22, 2024
1 parent 73c256e commit bb8a3f9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 32 deletions.
12 changes: 4 additions & 8 deletions techsupport_bot/commands/modlog.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
class BanLogger:

Check notice on line 1 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L1

Missing module docstring (missing-module-docstring)

Check notice on line 1 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L1

Missing class docstring (missing-class-docstring)
async def high_score_command(self, interaction):
...
async def high_score_command(self, interaction): ...

Check notice on line 2 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L2

Missing function or method docstring (missing-function-docstring)

async def on_ban(self, guild, ban):
...
async def on_ban(self, guild, ban): ...

Check notice on line 4 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L4

Missing function or method docstring (missing-function-docstring)


async def log_ban(banned_member, banning_moderator, guild):
...
async def log_ban(banned_member, banning_moderator, guild): ...

Check notice on line 7 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L7

Missing function or method docstring (missing-function-docstring)


async def log_unban(unbanned_member, unbanning_moderator, guild):
...
async def log_unban(unbanned_member, unbanning_moderator, guild): ...

Check notice on line 10 in techsupport_bot/commands/modlog.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/commands/modlog.py#L10

Missing function or method docstring (missing-function-docstring)
1 change: 0 additions & 1 deletion techsupport_bot/commands/protect.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Move all config over to specific new files
"""


import re

import discord
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def purge_amount(self, ctx: commands.context, amount: int = 1):
if amount <= 0 or amount > config.extensions.protect.max_purge_amount.value:
amount = config.extensions.protect.max_purge_amount.value

await ctx.channel.purge(limit=amount)
await ctx.channel.purge(limit=amount + 1)

await self.send_alert(config, ctx, "Purge command")

Expand Down
1 change: 0 additions & 1 deletion techsupport_bot/core/moderation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""This file will hold the core moderation functions. These functions will:
Do the proper moderative action and return true if successful, false if not."""


from datetime import timedelta

import discord
Expand Down
31 changes: 11 additions & 20 deletions techsupport_bot/functions/automod.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

Check notice on line 1 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L1

Missing module docstring (missing-module-docstring)

import re
from dataclasses import dataclass
from typing import TYPE_CHECKING

import discord
import munch
from core import cogs
from discord.ext import commands
import re

if TYPE_CHECKING:
import bot
Expand Down Expand Up @@ -41,36 +41,27 @@ class AutoModPunishment:
class AutoMod(cogs.MatchCog):

Check notice on line 41 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L41

Missing function or method docstring (missing-function-docstring)
async def match(
self, config: munch.Munch, ctx: commands.Context, content: str
) -> bool:
...
) -> bool: ...

async def response(

Check notice on line 46 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L46

Missing function or method docstring (missing-function-docstring)
self, config: munch.Munch, ctx: commands.Context, content: str, result: bool
) -> None:
...
) -> None: ...

async def should_ban_instead_of_warn(self, member: discord.Member) -> bool:
...
async def should_ban_instead_of_warn(self, member: discord.Member) -> bool: ...

Check notice on line 50 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L50

Missing function or method docstring (missing-function-docstring)

async def send_automod_alert(
self, message: discord.Message, violation: AutoModPunishment
) -> None:
...
) -> None: ...

Check notice on line 54 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L54

Missing function or method docstring (missing-function-docstring)


def run_all_checks(
config, message: discord.Message
) -> list[AutoModPunishment]:
def run_all_checks(config, message: discord.Message) -> list[AutoModPunishment]:

Check notice on line 57 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L57

Missing function or method docstring (missing-function-docstring)
# Automod will only ever be a framework to say something needs to be done
# Outside of running from the response function, NO ACTION will be taken
# All checks will return a list of AutoModPunishment, which may be nothing
...


def run_only_string_checks(
config, content: str
) -> list[AutoModPunishment]:
...
def run_only_string_checks(config, content: str) -> list[AutoModPunishment]: ...

Check notice on line 64 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L64

Missing function or method docstring (missing-function-docstring)


def handle_file_extensions(
Expand Down Expand Up @@ -104,9 +95,7 @@ def handle_exact_string(config, content: str) -> list[AutoModPunishment]:
return violations


def handle_regex_string(
config, content: str
) -> list[AutoModPunishment]:
def handle_regex_string(config, content: str) -> list[AutoModPunishment]:

Check notice on line 98 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L98

Missing function or method docstring (missing-function-docstring)

Check notice on line 98 in techsupport_bot/functions/automod.py

View check run for this annotation

codefactor.io / CodeFactor

techsupport_bot/functions/automod.py#L98

Missing function or method docstring (missing-function-docstring)
violations = []
for rule in config.extensions.protect.block_strings.value:
regex = rule.get("regex")
Expand All @@ -116,5 +105,7 @@ def handle_regex_string(
except re.error:
match = None
if match:
violations.append(AutoModPunishment(rule.message, rule.delete, rule.warn))
violations.append(
AutoModPunishment(rule.message, rule.delete, rule.warn)
)
return violations
2 changes: 1 addition & 1 deletion techsupport_bot/functions/paste.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def handle_length_alert(self, config, ctx, content) -> None:
message=(
f"Protect did not reupload {lf} file(s) due to file size limit."
),
level=LogLevel.INFO,
level=LogLevel.WARNING,
channel=log_channel,
context=LogContext(guild=ctx.guild, channel=ctx.channel),
)
Expand Down

0 comments on commit bb8a3f9

Please sign in to comment.