Reply to original message if command invocation was a reply

This commit is contained in:
Stijn De Clercq 2022-02-11 23:08:28 +01:00
parent 0165700d9f
commit b1fdd22058
4 changed files with 29 additions and 5 deletions

View file

@ -7,6 +7,7 @@ from data.menus import custom_commands
from data.snipe import Action, Snipe
from decorators import help
from enums.help_categories import Category
from functions.utils import reply_to_reference
from startup.didier import Didier
@ -20,7 +21,7 @@ class Other(commands.Cog):
@commands.command(name="Link", usage="[Naam]")
@help.Category(category=Category.Other)
async def link(self, ctx, name: str):
async def link(self, ctx: commands.Context, name: str):
"""
Send commonly used links
"""
@ -29,7 +30,7 @@ class Other(commands.Cog):
if match is None:
return await ctx.reply(f"Geen match gevonden voor \"{name}\".", mention_author=False, delete_after=15)
return await ctx.reply(match, mention_author=False)
await reply_to_reference(ctx, content=match)
@commands.command(name="Custom")
@help.Category(category=Category.Didier)

View file

@ -9,6 +9,7 @@ from enums.help_categories import Category
from functions import config, les
from functions.stringFormatters import capitalize
from functions.timeFormatters import skip_weekends
from functions.utils import reply_to_reference
class School(commands.Cog):
@ -101,7 +102,9 @@ class School(commands.Cog):
# Get the guide for the current year
year = 2018 + int(config.get("year"))
return await ctx.reply(f"https://studiekiezer.ugent.be/studiefiche/nl/{course.code}/{year}", mention_author=False)
link = f"https://studiekiezer.ugent.be/studiefiche/nl/{course.code}/{year}"
return await reply_to_reference(ctx, content=link)
@commands.command(name="Deadlines", aliases=["dl"])
@help.Category(category=Category.School)