Added decorator for checking if eligable for managing sources

This commit is contained in:
2021-11-22 18:28:48 +01:00
parent b37c3f533a
commit c45bd8ced3
3 changed files with 34 additions and 5 deletions
+6 -5
View File
@@ -6,6 +6,7 @@ from discord.message import Message
from bot import TuneBot
from context import CustomContext
from utils.classes import BaseCog
from utils.decorators import source_manager_only
from utils.EmbedGenerator import EmbedGenerator
@@ -47,7 +48,7 @@ class SettingsCog(BaseCog, name="Settings"):
embed.title = f"AutoJoin disabled"
await ctx.send(embed=embed)
@commands.is_owner()
@source_manager_only()
@commands.group(
name="source",
aliases=["src"],
@@ -63,7 +64,7 @@ class SettingsCog(BaseCog, name="Settings"):
embed.description = f"```{prefix}source list\n{prefix}source add <url>\n{prefix}source remove <url>\n{prefix}source sync```"
await ctx.send(embed=embed)
@commands.is_owner()
@source_manager_only()
@source.command(name="remove")
async def source_remove(self, ctx: CustomContext, source_url: str):
"""Removes a source from the bot"""
@@ -81,7 +82,7 @@ class SettingsCog(BaseCog, name="Settings"):
embed.title = "Could not remove source, the specified source might not exist"
await ctx.send(embed=embed)
@commands.is_owner()
@source_manager_only()
@source.command(name="add")
async def source_add(self, ctx: CustomContext, source_url: str):
"""
@@ -117,7 +118,7 @@ class SettingsCog(BaseCog, name="Settings"):
else:
await ctx.send(embed=embed)
@commands.is_owner()
@source_manager_only()
@source.command(name="list", aliases=["ls"])
async def source_list(self, ctx: CustomContext):
"""Display a list of sources"""
@@ -133,7 +134,7 @@ class SettingsCog(BaseCog, name="Settings"):
embed.description = description
await ctx.send(embed=embed)
@commands.is_owner()
@source_manager_only()
@source.command(name="sync")
async def source_sync(self, ctx: CustomContext):
"""Forcefully resyncs all sources"""