added global config command

This commit is contained in:
Seaswimmer 2023-03-04 16:59:27 -05:00
parent 087bdd095e
commit 5d60a297b8

View file

@ -23,6 +23,7 @@ class Podcast(commands.Cog):
@commands.command()
async def podcast(self, ctx, question: str):
"""Submits a question to the Podcast."""
prefix = await self.bot.get_valid_prefixes()
if await self.config.guild(ctx.guild).global_mode(True):
submission_channel = bot.get_channel(await self.config.global_submission_channel())
blacklisted_users = await self.config.global_blacklisted_users()
@ -31,10 +32,27 @@ class Podcast(commands.Cog):
blacklisted_users = await self.config.guild(ctx.guild).blacklisted_users()
else:
return
await submission_channel.send(content=f"{question}")
await ctx.send(content="Question submitted!")
if ctx.author.id in blacklisted_users:
ctx.author.send(content=f"You are blacklisted from ``{prefix}podcast``!")
return
else:
await submission_channel.send(content=f"{question}")
await ctx.send(content="Question submitted!")
@commands.group(autohelp=True)
@checks.is_admin_or_superior()
async def podcastset(self):
"""Commands to configure the Podcast cog."""
"""Commands to configure the Podcast cog."""
@podcastset.command(name="global")
@checks.is_admin_or_superior()
async def set_global_mode(self, ctx, boolean: bool):
"""Enables or disables global mode."""
if boolean == True:
await self.config.guild(ctx.guild).global_mode.set(True)
await ctx.send(content="``global_mode`` has been set to True.")
elif boolean == False:
await self.config.guild(ctx.guild).global_mode.set(False)
await ctx.send(content="``global_mode`` has been set to False.")
else:
await ctx.send(content="Please specify an argument!")