Skip to content

FEATURE: Ticketing & API improvements#116

Open
Minus-hates-school wants to merge 69 commits into
masterfrom
feature/minus-hates-school
Open

FEATURE: Ticketing & API improvements#116
Minus-hates-school wants to merge 69 commits into
masterfrom
feature/minus-hates-school

Conversation

@Minus-hates-school

Copy link
Copy Markdown
Collaborator

This pull request introduces a new ticket management feature to the API, including routes and database helper methods for handling tickets. Additionally, it improves consistency in HTTP response handling and enhances error logging and transaction management across several endpoints.

[Ai Generated summary]

os.environ['TOKEN'] raised a KeyError instead of falling through to the else branch

setup_logger called with bool(os.getenv("STREAM_LOGS")) 
  -- bool("false") is True since any non-empty string is truthy

int(os.getenv("BOT_LOG_LEVEL")) will crash if env var is missing
     If BOT_LOG_LEVEL is unset, os.getenv() raises TypeError
Using VS to commit changes.
Fix KeyError in logging and clean up debug statements
Fix Setttings from [0]
as well as some debugging
Fix response formatting and update setting retrieval
Comment thread src/bot/cogs/logging/logging_name_changes.py Outdated
Comment thread src/bot/cogs/logging/logging_message_edit.py Outdated
Comment thread src/bot/cogs/logging/logging_member_leaves.py Outdated
Comment thread src/bot/cogs/logging/logging_member_kick.py
Comment thread src/bot/cogs/logging/logging_member_ban.py Outdated
Comment thread src/api/core/db_helper.py Outdated
return {"status": "ok", "message": f"role with ID {role_id} deleted successfully"}
except OperationalError as err:
logger.error(f"Error deleting role: {err}")
self.conn.rollback()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyscopg is autocommit=True, so this should automatically happen if the execute fails

Comment thread src/bot/cogs/features/ticket.py Outdated
logger.error(f"Error sending followup message: {e}")

async def on_error(self, interaction: discord.Interaction, error: Exception):
await interaction.followup.send("An error occurred while creating your ticket. Please try again later.", ephemeral=True)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without confirming the interaction was already deferred/responded — if on_submit errored before send_message, this raises the exception here and you swallow the original exception, losing it to the void

Comment thread src/bot/cogs/features/ticket.py Outdated
await thread.send(
f'<@&{staff_role}>\n## {interaction.user.mention} has created a ticket\n'
f'** Type: ** {option}\n'
f'"{self.description.value}" - {interaction.user.nick}\n\n'

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the user has no nickname set, this will show as "None". Prefer a ternary that uses the name if nick is none

Comment thread src/bot/cogs/admin/points.py Outdated
async def sync_users_command_error(self, ctx, error):
if isinstance(error, commands.CheckFailure):
logger.warning(f"{ctx.author.name} has attempted to use the {ctx.invoked_with} command, and was not allowed to do so.")
await ctx.send('For one reason, or another, YOU cannot use this command.')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reply, not send

Comment thread src/bot/cogs/admin/points.py Outdated
await ctx.reply(embed=embed_info("Error!", "You must provide a required argument.", discord.Color.dark_gray()))
elif isinstance(error, commands.MissingPermissions):
logger.warning(f"{ctx.author.name} has attempted to use the {ctx.invoked_with} command, and was not allowed to do so.")
await ctx.send('For one reason, or another, YOU cannot use this command.')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reply, not send

@kritarth2135 kritarth2135 mentioned this pull request May 29, 2026
@Jiggly-Balls Jiggly-Balls linked an issue May 29, 2026 that may be closed by this pull request
@Jiggly-Balls Jiggly-Balls added the feature New feature or request label May 29, 2026
@Jiggly-Balls Jiggly-Balls changed the title Feature/minus hates school FEATURE: Ticketing & API improvements May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE: Ticket

4 participants