Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
More lint fixes
  • Loading branch information
DMFriends committed Aug 9, 2025
commit 0b8754a9920d3a471cce6728302bc9c1bb1fedc9
18 changes: 9 additions & 9 deletions bot/exts/fun/madlibs.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import json
import asyncio
import discord

import json
from pathlib import Path
from random import choice
from typing import TypedDict

import discord
from discord.ext import commands

from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES


TIMEOUT = 120

Check failure on line 14 in bot/exts/fun/madlibs.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (I001)

bot/exts/fun/madlibs.py:1:1: I001 Import block is un-sorted or un-formatted


class MadlibsTemplate(TypedDict):
Expand Down Expand Up @@ -86,10 +87,7 @@

# Ignore commands while a game is running
prefix = ctx.prefix or ""
if prefix and message.content.startswith(prefix):
return False

return True
return not (prefix and message.content.startswith(prefix))

self.checks.add(author_check)

Expand Down Expand Up @@ -135,7 +133,7 @@

return
# else: "Choose for me" set self.submitted_words[i]; just continue
except asyncio.TimeoutError:
except TimeoutError:
# If we ended the game around the same time, don't show timeout
if self.end_game:
self.checks.remove(author_check)
Expand Down Expand Up @@ -212,6 +210,7 @@


class MadlibsView(discord.ui.View):
"""A set of buttons to control a Madlibs game."""

def __init__(self, ctx: commands.Context, cog: "Madlibs", cooldown: float = 0,
part_of_speech: str = "", index: int = 0):
Expand All @@ -230,7 +229,8 @@
if cooldown > 0:
self.random_word_button.disabled = True

async def enable_random_button_after(self, message: discord.Message):
async def enable_random_button_after(self, message: discord.Message) -> None:
"""Function that controls the cooldown of the "Choose for me" button to prevent spam."""
if self._cooldown <= 0:
return
await asyncio.sleep(self._cooldown)
Expand Down
Loading