diff --git a/cogs/fun.py b/cogs/fun.py index f797803..11b0a21 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -1,4 +1,3 @@ -from data.embeds.xkcd import XKCDEmbed from data.menus import paginatedLeaderboard from decorators import help import discord @@ -138,14 +137,6 @@ class Fun(commands.Cog): r = requests.get("https://official-joke-api.appspot.com/jokes/programming/random").json() await ctx.send(r[0]["setup"] + "\n" + r[0]["punchline"]) - @commands.command(name="xkcd") - @help.Category(category=Category.Fun) - async def xkcd(self, ctx, n: int = None): - """ - Send an xkcd comic - """ - return await ctx.reply(embed=XKCDEmbed(n).create()) - def setup(client): client.add_cog(Fun(client)) diff --git a/cogs/slash/db_slash.py b/cogs/slash/db_slash.py index 1109b35..24bad49 100644 --- a/cogs/slash/db_slash.py +++ b/cogs/slash/db_slash.py @@ -8,7 +8,7 @@ from functions.timeFormatters import fromString from startup.didier import Didier -class DBSlash(commands.Cog): +class Slash(commands.Cog): def __init__(self, client: Didier): self.client: Didier = client @@ -84,4 +84,4 @@ class DBSlash(commands.Cog): def setup(client: Didier): - client.add_cog(DBSlash(client)) + client.add_cog(Slash(client)) diff --git a/cogs/slash/fun_slash.py b/cogs/slash/fun_slash.py deleted file mode 100644 index bd4191a..0000000 --- a/cogs/slash/fun_slash.py +++ /dev/null @@ -1,29 +0,0 @@ -from discord.ext import commands -from dislash import SlashInteraction, slash_command, Option, OptionType - -from data.embeds.xkcd import XKCDEmbed -from startup.didier import Didier - - -class FunSlash(commands.Cog): - def __init__(self, client: Didier): - self.client: Didier = client - - @slash_command( - name="xkcd", - description="Zoek xkcd comics", - options=[ - Option( - "num", - description="Nummer van de comic (default de comic van vandaag).", - type=OptionType.INTEGER, - required=False - ) - ] - ) - async def _xkcd_slash(self, interaction: SlashInteraction, num: int = None): - return await interaction.reply(embed=XKCDEmbed(num).create()) - - -def setup(client: Didier): - client.add_cog(FunSlash(client)) diff --git a/data/embeds/xkcd.py b/data/embeds/xkcd.py deleted file mode 100644 index 6aaf672..0000000 --- a/data/embeds/xkcd.py +++ /dev/null @@ -1,28 +0,0 @@ -import discord -from requests import get -from functions.stringFormatters import leading_zero - - -class XKCDEmbed: - n: int - - def __init__(self, n: int = None): - self.n = n - - def create(self) -> discord.Embed: - endpoint = "https://xkcd.com/info.0.json" if self.n is None else f"https://xkcd.com/{self.n}/info.0.json" - response = get(endpoint) - - if response.status_code != 200: - embed = discord.Embed(colour=discord.Colour.red()) - embed.set_author(name="xkcd") - embed.description = f"Er ging iets mis (status {response.status_code})." - return embed - - data = response.json() - - embed = discord.Embed(colour=discord.Colour.from_rgb(150, 168, 200), title=data["safe_title"]) - embed.set_author(name=f"xkcd #{data['num']}") - embed.set_image(url=data["img"]) - embed.set_footer(text=f"{leading_zero(data['day'])}/{leading_zero(data['month'])}/{data['year']}") - return embed diff --git a/files/help.json b/files/help.json index a522c9b..545a3c4 100644 --- a/files/help.json +++ b/files/help.json @@ -122,7 +122,6 @@ "unload": "Verwijdert [Cog].", "unload all": "Verwijdert alle cogs.", "whois": "Toont de info van [@User]", - "xkcd": "Zoek [xkcd](https://xkcd.com/) comics.", "xp": "Bekijk je huidige aantal berichten en xp.", "yes/no": "Didier helpt je met keuzes maken." } \ No newline at end of file