mirror of https://github.com/stijndcl/didier
commit
969c66e2bf
|
@ -136,7 +136,7 @@ class Fun(commands.Cog):
|
|||
@commands.hybrid_command(name="xkcd")
|
||||
@app_commands.rename(comic_id="id")
|
||||
async def xkcd(self, ctx: commands.Context, comic_id: Optional[int] = None):
|
||||
"""Fetch comic `#id` from xkcd
|
||||
"""Fetch comic `#id` from xkcd.
|
||||
|
||||
If no argument to `id` is passed, this fetches today's comic instead.
|
||||
"""
|
||||
|
|
|
@ -116,10 +116,22 @@ class School(commands.Cog):
|
|||
mention_author=False,
|
||||
)
|
||||
|
||||
@commands.hybrid_command(name="ufora")
|
||||
async def ufora(self, ctx: commands.Context, course: str):
|
||||
"""Link the Ufora page for a course."""
|
||||
async with self.client.postgres_session as session:
|
||||
ufora_course = await ufora_courses.get_course_by_name(session, course)
|
||||
|
||||
if ufora_course is None:
|
||||
return await ctx.reply(f"Found no course matching `{course}`", ephemeral=True)
|
||||
|
||||
return await ctx.reply(
|
||||
f"https://ufora.ugent.be/d2l/le/content/{ufora_course.course_id}/home", mention_author=False
|
||||
)
|
||||
|
||||
@study_guide.autocomplete("course")
|
||||
async def _study_guide_course_autocomplete(
|
||||
self, _: discord.Interaction, current: str
|
||||
) -> list[app_commands.Choice[str]]:
|
||||
@ufora.autocomplete("course")
|
||||
async def _course_autocomplete(self, _: discord.Interaction, current: str) -> list[app_commands.Choice[str]]:
|
||||
"""Autocompletion for the 'course'-parameter"""
|
||||
return self.client.database_caches.ufora_courses.get_autocomplete_suggestions(current)
|
||||
|
||||
|
|
Loading…
Reference in New Issue