diff --git a/cogs/faq.py b/cogs/faq.py index da18a80..8817b29 100644 --- a/cogs/faq.py +++ b/cogs/faq.py @@ -1,3 +1,4 @@ +from data import constants from decorators import help import discord from discord.ext import commands @@ -20,6 +21,9 @@ class Faq(commands.Cog): """ Command group that controls the FAQ commands. When this command is invoked, it sends a list of valid categories. + + After invoking in a subject's channel (without passing a category), + it sends the FAQ for that subject instead. :param ctx: Discord Context :param args: args passed """ @@ -28,6 +32,10 @@ class Faq(commands.Cog): if len(args) != 0 and any("@" not in arg for arg in args): return await self.faqCategory(ctx, args) + # Check if the command was used in a subject's channel + if ctx.channel.id in constants.faq_channels: + return await self.faqCategory(ctx, (constants.faq_channels[ctx.channel.id],)) + # List of all categories with the first letter capitalized resp = [stringFormatters.titleCase(cat[0]) for cat in faq.getCategories()] diff --git a/data/constants.py b/data/constants.py index 09da550..af8e46b 100644 --- a/data/constants.py +++ b/data/constants.py @@ -46,6 +46,15 @@ holidayAPIKey = "af4e1ebe-465d-4b93-a828-b95df18e6424" prefixes = ["big d", "didier"] +faq_channels = { + 727876753523081216: "ad2", + 727876779481497600: "comnet", + 727876797458284584: "funcprog", + 727876819264733244: "statprob", + 727876836587208714: "sysprog", + 676713433567199232: "didier" +} + class Live(Enum): CallOfCode = "626699611192688641"