diff options
author | 2019-02-23 11:52:17 +0100 | |
---|---|---|
committer | 2019-02-23 11:52:17 +0100 | |
commit | ae6e610b4e0b2f63c28f0c6aa45a33f3f229ae1f (patch) | |
tree | b0b01b10544c7aa23412b8baacb89c66a0f9ee3d | |
parent | Merge pull request #313 from python-discord/Hemlock.Users_and_Roles_adjustment (diff) | |
parent | Merge branch 'master' into Hemlock-Another-Role-Tweak (diff) |
Merge pull request #314 from python-discord/Hemlock-Another-Role-Tweak
Hemlock another role tweak
-rw-r--r-- | bot/cogs/off_topic_names.py | 10 | ||||
-rw-r--r-- | bot/cogs/reddit.py | 4 | ||||
-rw-r--r-- | bot/cogs/reminders.py | 3 | ||||
-rw-r--r-- | bot/cogs/rules.py | 6 |
4 files changed, 10 insertions, 13 deletions
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index 25b8a48b8..4dde9169f 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -5,7 +5,7 @@ from datetime import datetime, timedelta from discord import Colour, Embed from discord.ext.commands import BadArgument, Bot, Context, Converter, group -from bot.constants import Channels, Keys, Roles, URLs +from bot.constants import Channels, Keys, MODERATION_ROLES, URLs from bot.decorators import with_role from bot.pagination import LinePaginator @@ -87,14 +87,14 @@ class OffTopicNames: self.updater_task = await self.bot.loop.create_task(coro) @group(name='otname', aliases=('otnames', 'otn'), invoke_without_command=True) - @with_role(Roles.owner, Roles.admin, Roles.moderator) + @with_role(*MODERATION_ROLES) async def otname_group(self, ctx): """Add or list items from the off-topic channel name rotation.""" await ctx.invoke(self.bot.get_command("help"), "otname") @otname_group.command(name='add', aliases=('a',)) - @with_role(Roles.owner, Roles.admin, Roles.moderator) + @with_role(*MODERATION_ROLES) async def add_command(self, ctx, name: OffTopicName): """Adds a new off-topic name to the rotation.""" @@ -117,7 +117,7 @@ class OffTopicNames: await ctx.send(f":warning: got non-200 from the API: {error_reason}") @otname_group.command(name='delete', aliases=('remove', 'rm', 'del', 'd')) - @with_role(Roles.owner, Roles.admin, Roles.moderator) + @with_role(*MODERATION_ROLES) async def delete_command(self, ctx, name: OffTopicName): """Removes a off-topic name from the rotation.""" @@ -143,7 +143,7 @@ class OffTopicNames: await ctx.send(f":warning: got non-200 from the API: {error_reason}") @otname_group.command(name='list', aliases=('l',)) - @with_role(Roles.owner, Roles.admin, Roles.moderator) + @with_role(*MODERATION_ROLES) async def list_command(self, ctx): """ Lists all currently known off-topic channel names in a paginator. diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py index 952fa4682..2e3d32b2d 100644 --- a/bot/cogs/reddit.py +++ b/bot/cogs/reddit.py @@ -7,7 +7,7 @@ from datetime import datetime, timedelta from discord import Colour, Embed, TextChannel from discord.ext.commands import Bot, Context, group -from bot.constants import Channels, ERROR_REPLIES, Reddit as RedditConfig, Roles +from bot.constants import Channels, ERROR_REPLIES, Reddit as RedditConfig, STAFF_ROLES from bot.converters import Subreddit from bot.decorators import with_role from bot.pagination import LinePaginator @@ -257,7 +257,7 @@ class Reddit: time="week" ) - @with_role(Roles.owner, Roles.admin, Roles.moderator, Roles.helpers) + @with_role(*STAFF_ROLES) @reddit_group.command(name="subreddits", aliases=("subs",)) async def subreddits_command(self, ctx: Context): """ diff --git a/bot/cogs/reminders.py b/bot/cogs/reminders.py index ddf5cc1f3..2a9a9d6dc 100644 --- a/bot/cogs/reminders.py +++ b/bot/cogs/reminders.py @@ -11,7 +11,7 @@ from discord.ext.commands import Bot, Context, group from bot.constants import ( Channels, Icons, Keys, NEGATIVE_REPLIES, - POSITIVE_REPLIES, Roles, URLs + POSITIVE_REPLIES, STAFF_ROLES, URLs ) from bot.pagination import LinePaginator from bot.utils.scheduling import Scheduler @@ -19,7 +19,6 @@ from bot.utils.time import humanize_delta, parse_rfc1123, wait_until log = logging.getLogger(__name__) -STAFF_ROLES = (Roles.owner, Roles.admin, Roles.moderator, Roles.helpers) WHITELISTED_CHANNELS = (Channels.bot,) MAXIMUM_REMINDERS = 5 diff --git a/bot/cogs/rules.py b/bot/cogs/rules.py index eee506810..1067f2758 100644 --- a/bot/cogs/rules.py +++ b/bot/cogs/rules.py @@ -4,12 +4,10 @@ from typing import Optional from discord import Colour, Embed from discord.ext.commands import Bot, Context, command -from bot.constants import Channels, Roles +from bot.constants import Channels, STAFF_ROLES from bot.decorators import redirect_output from bot.pagination import LinePaginator -STAFF = Roles.admin, Roles.moderator, Roles.owner - class Rules: @@ -56,7 +54,7 @@ class Rules: ) @command(aliases=['r', 'rule'], name='rules') - @redirect_output(destination_channel=Channels.bot, bypass_roles=STAFF) + @redirect_output(destination_channel=Channels.bot, bypass_roles=STAFF_ROLES) async def rules_command(self, ctx: Context, *, rules: Optional[str] = None): """ Provides a link to the `rules` endpoint of the website, or displays |