mirror of https://github.com/stijndcl/didier
Make FAQ check which channel it's called in to return the appropriate FAQ
parent
cb4e67be69
commit
81ef990e1f
|
@ -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()]
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue