diff --git a/cogs/events.py b/cogs/events.py index debaac8..ee0297f 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -111,6 +111,10 @@ class Events(commands.Cog): # Someone used a command that was on cooldown elif isinstance(err, commands.CommandOnCooldown): await ctx.send("Je kan dit commando niet (meer) spammen.", delete_after=10) + elif isinstance(err, commands.MessageNotFound): + await ctx.send("Geen message gevonden die overeenkomt met het opgegeven argument.") + elif isinstance(err, (commands.ChannelNotFound, commands.ChannelNotReadable)): + await ctx.send("Geen channel gevonden dat overeenkomt met het opgegeven argument.") # Someone forgot an argument or passed an invalid argument elif isinstance(err, (commands.BadArgument, commands.MissingRequiredArgument)): await ctx.send("Controleer je argumenten.") diff --git a/cogs/minesweeper.py b/cogs/minesweeper.py index bb80b0a..96ec4f6 100644 --- a/cogs/minesweeper.py +++ b/cogs/minesweeper.py @@ -30,7 +30,7 @@ class Minesweeper(commands.Cog): dimensions = { "e": [5, 5, 4], "m": [10, 10, 20], - "h": [13, 13, 35] + "h": [13, 8, 35] } numbers = { diff --git a/cogs/oneliners.py b/cogs/oneliners.py index 3b7c3e6..a9c80ed 100644 --- a/cogs/oneliners.py +++ b/cogs/oneliners.py @@ -96,9 +96,8 @@ class Oneliners(commands.Cog): @commands.command(name="Changelog", aliases=["Cl", "Change", "Changes"]) @help.Category(category=Category.Didier) - async def changelog(self, ctx, *args): - await ctx.send("V2.0: \n" - "V2.1: https://docs.google.com/document/d/1ezdJBTnKWoog4q9yJrgwfF4iGOn-PZMoBZgSNVYPtqg/edit#") + async def changelog(self, ctx): + await ctx.send("v2.3.0: https://github.com/stijndcl/didier/releases/tag/2.3.0") @commands.command(name="Todo", aliases=["List", "Td"]) @help.Category(category=Category.Didier) diff --git a/cogs/reactword.py b/cogs/reactword.py index 7c879b1..b48e59a 100644 --- a/cogs/reactword.py +++ b/cogs/reactword.py @@ -19,25 +19,16 @@ class ReactWord(commands.Cog): @help.Category(category=Category.Other) async def react(self, ctx, *words): words = list(words) + message = ctx.message target = False - channel = ctx.channel - # Check if the URL or the Id was passed - if str(words[-1]).count("/") > 3: - spl = str(words[-1]).split("/") - channel = self.client.get_channel(int(spl[-2])) - if channel is None: - return await ctx.send("Ik kan geen kanaal zien met dit id.") - words[-1] = spl[-1] - - # Get the message object if an Id was passed, otherwise react to the message itself - try: - message = await channel.fetch_message(words[-1]) - if message is None: - return await ctx.send("Ik kan geen bericht zien met dit id.") + # Message id or URL passed as final argument + if (len(words[-1]) == 18 and all(i.isdigit() for i in words[-1])) or "discord.com/channels/" in words[-1]: target = True - except discord.HTTPException: - message = ctx.message + message = await commands.MessageConverter().convert(ctx, words[-1]) + + # Cut id or URL + words = words[:-1] # Reactions that were added before this command was executed previousReactions = ([x.emoji for x in message.reactions]) if len(message.reactions) != 0 else [] diff --git a/cogs/school.py b/cogs/school.py index 8c6445c..e0834c7 100644 --- a/cogs/school.py +++ b/cogs/school.py @@ -84,6 +84,18 @@ class School(commands.Cog): schedule.append(val) return schedule + @commands.command(name="Pin", usage="[Message]") + @help.Category(category=Category.School) + async def pin(self, ctx, message: discord.Message): + # In case people abuse, check if they're blacklisted + blacklist = [] + + if ctx.author.id in blacklist: + return + + await ctx.message.add_reaction("✅") + await message.pin(reason="Didier Pin door {}".format(ctx.author.display_name)) + def setup(client): client.add_cog(School(client)) diff --git a/enums/courses.py b/enums/courses.py index 8d9a63d..24c1d72 100644 --- a/enums/courses.py +++ b/enums/courses.py @@ -20,6 +20,11 @@ class Ba2(Enum): FuncProg = {"year": 2, "semester": 1, "id": 727879279622225920, "name": "Functioneel Programmeren"} StatProb = {"year": 2, "semester": 1, "id": 727879946458103880, "name": "Statistiek en Probabiliteit"} SysProg = {"year": 2, "semester": 1, "id": 727880036644028517, "name": "Systeemprogrammeren"} + CompArch = {"year": 2, "semester": 2, "id": 807565108355137566, "name": "Computerarchitectuur"} + Multimedia = {"year": 2, "semester": 2, "id": 807565458496028683, "name": "Multimedia"} + SEL1 = {"year": 2, "semester": 2, "id": 807565600086818817, "name": "Software Engineering Lab 1"} + WebDev = {"year": 2, "semester": 2, "id": 807565717234778132, "name": "Webdevelopment"} + WetRek = {"year": 2, "semester": 2, "id": 807562607707947058, "name": "Wetenschappelijk Rekenen"} years = [Ba1, Ba2] diff --git a/files/help.json b/files/help.json index 41f088d..09f640e 100644 --- a/files/help.json +++ b/files/help.json @@ -68,6 +68,7 @@ "muttn": "Kiekt oeveel van ne muttn da [@Persoon] wel nie es aje eenen tagt, anders ist uzelf.", "neck": "<:WhatDidYou:744476950654877756><:DoTo:744476965951504414><:MyDrink:744476979939508275>", "nightly": "Daily is overrated.\nClaim jouw dagelijkse bonus Didier Dinks.", + "pin": "Pin [Message] zodat je geen admins hoeft te pingen. Misbruik kan je blacklisten.", "pjoke": "Didier vertelt een programming joke.", "poke": "Tik [Persoon].", "poke blacklist": "Indien je liever niet aan Poke wil deelnemen, kan je jezelf op deze manier blacklisten.\nIndien je jezelf wil ont-blacklisten stuur je een DM naar DJ STIJN (om misbruik tegen te gaan).", diff --git a/functions/football.py b/functions/football.py index de1fa78..64941ad 100644 --- a/functions/football.py +++ b/functions/football.py @@ -147,7 +147,7 @@ def getTable(): formatted = [_formatRow(row) for row in rows] header = "Jupiler Pro League Klassement" - table = tabulate.tabulate(formatted, headers=["#", "Ploeg", "Punten", "M", "M+", "M-", "M="]) + table = tabulate.tabulate(formatted, headers=["#", "Ploeg", "Punten", "M", "M+", "M-", "M=", "D+", "D-", "D+/-"]) return "```{}\n\n{}```".format(header, table) @@ -156,7 +156,7 @@ def _formatRow(row): """ Function that formats a row into a list for Tabulate to use """ - scoresArray = list([td.renderContents().decode("utf-8") for td in row.find_all("td")])[:6] + scoresArray = list([td.renderContents().decode("utf-8") for td in row.find_all("td")])[:9] # Insert the team name into the list scoresArray.insert(1, row.find_all("a")[0].renderContents().decode("utf-8").split("