Skip to content
Merged
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
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Changes since 2026.11.07
### DB_management
- New module, taking over backup. Allowing both exporting and importing of DB_management tables

### GitHub
- Full migration to app commands

## Fun

### Grabs
Expand Down
40 changes: 16 additions & 24 deletions modules/administration/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
Commands which allows the admin to create github issues on linked repo
The cog in the file is named:
IssueCreator

This file contains 4 commands:
.botish
.botissue
.ish
.issue
"""

from __future__ import annotations
Expand All @@ -16,7 +10,7 @@
from typing import TYPE_CHECKING, Self

import discord
from discord.ext import commands
from discord import app_commands

from core import auxiliary, cogs

Expand Down Expand Up @@ -58,39 +52,38 @@ class IssueCreator(cogs.BaseCog):

GITHUB_API_BASE_URL: str = "https://api.github.com"

@commands.check(auxiliary.bot_admin_check_context)
@auxiliary.with_typing
@commands.command(
@app_commands.check(auxiliary.bot_admin_check_interaction)
@app_commands.command(
name="issue",
aliases=["ish", "botish", "botissue"],
description="Creates a Github issue on the configured bot repo",
usage="[title] [description]",
)
async def issue(
self: Self, ctx: commands.Context, title: str, description: str = ""
self: Self, interaction: discord.Interaction, title: str, description: str = ""
) -> None:
"""Creates an issue in the bot's Github Repo

This is a command and should be accessed via Discord.

Args:
ctx (commands.Context): the context object for the calling message
interaction (discord.Interaction): The interaction that called this command
title (str): the title of the issue
description (str, optional): the description of the issue. Defaults to ""
description (str, optional): The description of the issue. Defaults to ""
"""

await interaction.response.defer()
if not self.bot.file_config.api.github.api_key:
await auxiliary.send_deny_embed(
message="I don't have a Github API key", channel=ctx.channel
await interaction.followup.send(
embed=auxiliary.prepare_deny_embed("I don't have a Github API key")
)
return

if (
not self.bot.file_config.api.github.username
or not self.bot.file_config.api.github.repo
):
await auxiliary.send_deny_embed(
message="I don't have a Github repo configured", channel=ctx.channel
await interaction.followup.send(
embed=auxiliary.prepare_deny_embed(
"I don't have a Github repo configured"
)
)
return

Expand All @@ -110,11 +103,10 @@ async def issue(

status_code = response.get("status_code")
if status_code != 201:
await auxiliary.send_deny_embed(
message=(
await interaction.followup.send(
embed=auxiliary.prepare_deny_embed(
f"I was unable to create your issue (status code {status_code})"
),
channel=ctx.channel,
)
return

Expand All @@ -127,4 +119,4 @@ async def issue(
url="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
)

await ctx.send(embed=embed)
await interaction.followup.send(embed=embed)
Loading