Skip to content

Commit cbd18eb

Browse files
committed
Added a repo-level flake8 config to stop linting third-party code flake8
1 parent b2c0ab7 commit cbd18eb

9 files changed

Lines changed: 23 additions & 45 deletions

File tree

bot.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,8 @@ async def _safe_ctx_send(message: str) -> None:
212212

213213
async def on_app_command_error(self, interaction: discord.Interaction, error: app_commands.AppCommandError):
214214
"""Handle slash command errors."""
215-
# Silence unknown slash/app commands
216-
# app_commands doesn't expose a simple CommandNotFound class in some versions, so be conservative
217-
try:
218-
from discord import app_commands as _appc
219-
# In later versions, AppCommandError subclasses may exist; ignore generic NotFound-like errors
220-
except Exception:
221-
_appc = None
215+
# Silence unknown slash/app commands.
216+
# `app_commands` doesn't expose a stable CommandNotFound across versions, so be conservative.
222217

223218
# If it's a cooldown, inform user
224219
if isinstance(error, app_commands.CommandOnCooldown):

cogs/afk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ async def set_afk_command(self, ctx: commands.Context, *, reason: Optional[str]
168168
# Check if user is already AFK
169169
was_afk = self.is_afk(ctx.author.id)
170170
if was_afk:
171-
old_info = self.get_afk_info(ctx.author.id)
172171
action_text = "updated"
173172
else:
174173
action_text = "set"

cogs/codebuddy_leaderboard.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ async def before_weekly_reset(self):
2828
@app_commands.command(name="codeweek", description="Show the weekly coding leaderboard")
2929
async def codeweek(self, interaction: discord.Interaction):
3030
"""Display the weekly leaderboard."""
31-
start_time = datetime.datetime.now()
3231
try:
3332
# Immediate simple response first
3433
embed = discord.Embed(
@@ -126,7 +125,6 @@ async def codeweek(self, interaction: discord.Interaction):
126125
@commands.command(name="codeweek", aliases=["cw", "cwlb"])
127126
async def codeweek_prefix(self, ctx):
128127
"""Display the weekly leaderboard."""
129-
start_time = datetime.datetime.now()
130128
try:
131129
# Immediate simple response first
132130
embed = discord.Embed(
@@ -202,7 +200,6 @@ async def codeweek_prefix(self, ctx):
202200
@app_commands.command(name="codestreak", description="Show the coding streak leaderboard")
203201
async def codestreak(self, interaction: discord.Interaction):
204202
"""Display the streak leaderboard."""
205-
start_time = datetime.datetime.now()
206203
try:
207204
# Immediate simple response first
208205
embed = discord.Embed(
@@ -307,7 +304,6 @@ async def codestreak(self, interaction: discord.Interaction):
307304
@commands.command(name="codestreak", aliases=["cs", "cslb"])
308305
async def codestreak_prefix(self, ctx):
309306
"""Display the streak leaderboard."""
310-
start_time = datetime.datetime.now()
311307
try:
312308
# Immediate simple response first
313309
embed = discord.Embed(

cogs/help.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ def __init__(self, bot: commands.Bot):
8585
)
8686
]
8787

88-
# Track if we've added the Quiz category
89-
quiz_added = False
9088
quiz_command_count = 0
9189

9290
# Cogs to merge into Misc (kept lightweight)
@@ -292,7 +290,7 @@ def _create_category_embed(self, cog_name: str) -> discord.Embed:
292290
else:
293291
embed.description = "No commands available in this category."
294292

295-
embed.set_footer(text=f"Use ?helpmenu <command> for detailed help")
293+
embed.set_footer(text="Use ?helpmenu <command> for detailed help")
296294
return embed
297295

298296
# Handle special Misc category that combines multiple cogs
@@ -365,7 +363,7 @@ def _create_category_embed(self, cog_name: str) -> discord.Embed:
365363
else:
366364
embed.description = "No commands available in this category."
367365

368-
embed.set_footer(text=f"Use ?helpmenu <command> for detailed help")
366+
embed.set_footer(text="Use ?helpmenu <command> for detailed help")
369367
return embed
370368

371369
# Find the cog (case-insensitive)
@@ -452,7 +450,7 @@ def _create_category_embed(self, cog_name: str) -> discord.Embed:
452450
else:
453451
embed.description = "No commands available in this category."
454452

455-
embed.set_footer(text=f"Use ?helpmenu <command> for detailed help")
453+
embed.set_footer(text="Use ?helpmenu <command> for detailed help")
456454
return embed
457455

458456

cogs/misc.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,7 @@ async def bug_report(self, ctx: commands.Context, *, bug: str):
351351
"""Report a bug to the support server."""
352352
# Support server channel ID
353353
SUPPORT_CHANNEL_ID = 1452739906525728828
354-
355-
# Get interaction for hybrid command
356-
interaction = ctx.interaction or ctx
354+
357355
user = ctx.author
358356
guild = ctx.guild
359357

cogs/rockpaperscissors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def format_message(self, cancelled=False):
192192
winner = self.game.players[winner_id]
193193
body = f"\n{winner.mention} has **won!**\n\n"
194194
else:
195-
body = f"Draw!\n\n"
195+
body = "Draw!\n\n"
196196
body += f"{self.format_player_line_endgame(0)}\n{self.format_player_line_endgame(1)}"
197197
if rounds:
198198
body += f"\n\n{rounds}"

cogs/staff_applications.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,6 @@ async def on_interaction(self, interaction: discord.Interaction):
487487
# But to make it work, I need to respond.
488488
# If the view was attached via `add_view`, it handles it. If not, this global listener does.
489489

490-
parts = custom_id.split(':')
491-
action = parts[1]
492-
user_id = int(parts[2])
493-
494490
# We need to recreate the modal logic here manually since the View instance is lost
495491
# But `send_modal` needs a Modal instance.
496492
# Checking if the interaction was already handled (if View was attached)?

cogs/tickets.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async def _restore_persistent_views(self):
180180

181181
# Fetch the message to ensure it exists
182182
try:
183-
message = await channel.fetch_message(message_id)
183+
await channel.fetch_message(message_id)
184184
# Create and attach the persistent view
185185
view = TicketPanelView(self)
186186
# The view is automatically registered due to persistent custom_id
@@ -1090,9 +1090,9 @@ async def ticket_log_setup(self, ctx, channel: Optional[discord.TextChannel] = N
10901090
embed.add_field(
10911091
name="ℹ️ Information",
10921092
value="Ticket actions (create, close, claim) will be logged to this channel.\n\n"
1093-
f"• **Change it:** `/ticketlog #new-channel`\n"
1094-
f"• **Disable custom:** `/ticketlog-disable`\n"
1095-
f"• **Quick disable:** Rename this channel",
1093+
"• **Change it:** `/ticketlog #new-channel`\n"
1094+
"• **Disable custom:** `/ticketlog-disable`\n"
1095+
"• **Quick disable:** Rename this channel",
10961096
inline=False
10971097
)
10981098
else:
@@ -1265,10 +1265,10 @@ async def ticket_support_role(self, ctx, role: Optional[discord.Role] = None):
12651265
)
12661266
embed.add_field(
12671267
name="ℹ️ Information",
1268-
value=f"This role will be pinged when new tickets are created.\n\n"
1269-
f"• **Change it:** `/ticketsupport @new-role`\n"
1270-
f"• **Remove it:** `/ticketsupport-disable`\n"
1271-
f"• **Set via panel:** `/ticketpanel #channel @role`",
1268+
value="This role will be pinged when new tickets are created.\n\n"
1269+
"• **Change it:** `/ticketsupport @new-role`\n"
1270+
"• **Remove it:** `/ticketsupport-disable`\n"
1271+
"• **Set via panel:** `/ticketpanel #channel @role`",
12721272
inline=False
12731273
)
12741274
else:
@@ -1670,10 +1670,10 @@ async def ticket_report_role(self, ctx, role: Optional[discord.Role] = None):
16701670
)
16711671
embed.add_field(
16721672
name="ℹ️ Information",
1673-
value=f"This role will be pinged when report tickets are created.\n\n"
1674-
f"• **Change it:** `/ticketreport @new-role`\n"
1675-
f"• **Remove it:** `/ticketreport-disable`\n"
1676-
f"• **Set via panel:** `/ticketpanel report_role:@role`",
1673+
value="This role will be pinged when report tickets are created.\n\n"
1674+
"• **Change it:** `/ticketreport @new-role`\n"
1675+
"• **Remove it:** `/ticketreport-disable`\n"
1676+
"• **Set via panel:** `/ticketpanel report_role:@role`",
16771677
inline=False
16781678
)
16791679
else:
@@ -1809,10 +1809,10 @@ async def ticket_partner_role(self, ctx, role: Optional[discord.Role] = None):
18091809
)
18101810
embed.add_field(
18111811
name="ℹ️ Information",
1812-
value=f"This role will be pinged when partnership tickets are created.\n\n"
1813-
f"• **Change it:** `/ticketpartner @new-role`\n"
1814-
f"• **Remove it:** `/ticketpartner-disable`\n"
1815-
f"• **Set via panel:** `/ticketpanel partner_role:@role`",
1812+
value="This role will be pinged when partnership tickets are created.\n\n"
1813+
"• **Change it:** `/ticketpartner @new-role`\n"
1814+
"• **Remove it:** `/ticketpartner-disable`\n"
1815+
"• **Set via panel:** `/ticketpanel partner_role:@role`",
18161816
inline=False
18171817
)
18181818
else:

utils/codebuddy_database.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,6 @@ async def increment_quest_quiz_count(user_id: int):
445445
Increment the quiz count for today's quest.
446446
Returns True if quest was completed with this quiz.
447447
"""
448-
today = datetime.date.today()
449-
450448
async with aiosqlite.connect(DB_PATH) as db:
451449
# Get current progress
452450
progress = await get_daily_quest_progress(user_id)
@@ -481,8 +479,6 @@ async def mark_quest_voted(user_id: int):
481479
Mark that the user has voted today.
482480
Returns True if quest was completed with this vote.
483481
"""
484-
today = datetime.date.today()
485-
486482
async with aiosqlite.connect(DB_PATH) as db:
487483
# Get current progress
488484
progress = await get_daily_quest_progress(user_id)

0 commit comments

Comments
 (0)