mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Make FAQ check which channel it's called in to return the appropriate FAQ
This commit is contained in:
parent
cb4e67be69
commit
81ef990e1f
2 changed files with 17 additions and 0 deletions
|
|
@ -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()]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue