Skip to content

Commit

Permalink
Move more soap bits from assistance
Browse files Browse the repository at this point in the history
- Move `setsoaps` command
- Move class init function from assistance
  • Loading branch information
lifehackerhansol committed Sep 30, 2024
1 parent a420436 commit 0f6773c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 0 additions & 15 deletions cogs/assistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class Assistance(commands.GroupCog):
def __init__(self, bot: Kurisu):
self.bot: Kurisu = bot
self.small_help_category: Optional[discord.CategoryChannel] = None
self.soaps_category: Optional[discord.CategoryChannel] = None
self.bot.loop.create_task(self.setup_assistance())
self.filters = bot.filters

Expand All @@ -78,11 +77,6 @@ async def setup_assistance(self):
channel = self.bot.guild.get_channel(db_channel[0])
if channel and channel.type == discord.ChannelType.category:
self.small_help_category = channel
db_channel2 = await self.bot.configuration.get_channel_by_name('soaps')
if db_channel2:
channel2 = self.bot.guild.get_channel(db_channel2[0])
if channel2 and channel2.type == discord.ChannelType.category:
self.soaps_category = channel2

async def unisearch(self, query: str) -> list[dict]:
query = query.lower()
Expand Down Expand Up @@ -139,15 +133,6 @@ async def setsmallhelp(self, ctx: GuildContext, category: discord.CategoryChanne
self.small_help_category = category
await ctx.send("Small help category set.")

@is_staff('OP')
@commands.guild_only()
@commands.command()
async def setsoaps(self, ctx: GuildContext, category: discord.CategoryChannel):
"""Sets the soaps category for creating channels. OP+ only."""
await self.bot.configuration.add_channel('soaps', category)
self.soaps_category = category
await ctx.send("Soaps category set.")

@commands.group(cooldown=None, invoke_without_command=True, case_insensitive=True)
async def tutorial(self, ctx: KurisuContext):
"""Links to one of multiple guides"""
Expand Down
18 changes: 18 additions & 0 deletions cogs/soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ class Soap(commands.GroupCog):
def __init__(self, bot: Kurisu):
self.bot: Kurisu = bot
self.soaps_category: Optional[discord.CategoryChannel] = None
self.bot.loop.create_task(self.setup_soap())

async def setup_soap(self):
await self.bot.wait_until_all_ready()
db_channel = await self.bot.configuration.get_channel_by_name('soaps')
if db_channel:
channel = self.bot.guild.get_channel(db_channel[0])
if channel and channel.type == discord.ChannelType.category:
self.soaps_category = channel

@is_staff('OP')
@commands.guild_only()
@commands.command()
async def setsoaps(self, ctx: GuildContext, category: discord.CategoryChannel):
"""Sets the soaps category for creating channels. OP+ only."""
await self.bot.configuration.add_channel('soaps', category)
self.soaps_category = category
await ctx.send("Soaps category set.")

@soap_check()
@commands.guild_only()
Expand Down

0 comments on commit 0f6773c

Please sign in to comment.