diff options
| author | 2021-03-21 13:50:41 +0000 | |
|---|---|---|
| committer | 2021-03-21 13:50:41 +0000 | |
| commit | 5590a2fa66b3af7d0a4f8aa35f122247c8b7521d (patch) | |
| tree | 9977e21252dee390a7960764868db4cecaa1d1a1 | |
| parent | Added moderators category to config (diff) | |
Limit nominate to nominations channel
Added a forcenominate command to allow mods to override this if necessary
Diffstat (limited to '')
| -rw-r--r-- | bot/constants.py | 1 | ||||
| -rw-r--r-- | bot/exts/recruitment/talentpool/_cog.py | 28 | ||||
| -rw-r--r-- | config-default.yml | 1 | 
3 files changed, 28 insertions, 2 deletions
| diff --git a/bot/constants.py b/bot/constants.py index 467a4a2c4..fbb73d489 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -438,6 +438,7 @@ class Channels(metaclass=YAMLGetter):      mods: int      mod_alerts: int      mod_spam: int +    nominations: int      nomination_voting: int      organisation: int diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index b809cea17..fbe79382d 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -113,15 +113,39 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"):          """          await ctx.invoke(self.watched_command, oldest_first=True, update_cache=update_cache) +    @nomination_group.command(name='forcewatch', aliases=('fw', 'forceadd', 'fa'), root_aliases=("forcenominate",)) +    @has_any_role(*MODERATION_ROLES) +    async def force_watch_command(self, ctx: Context, user: FetchedMember, *, reason: str = '') -> None: +        """ +        Adds the given `user` to the talent pool, from any channel. + +        A `reason` for adding the user to the talent pool is optional. +        """ +        await self._watch_user(ctx, user, reason) +      @nomination_group.command(name='watch', aliases=('w', 'add', 'a'), root_aliases=("nominate",))      @has_any_role(*STAFF_ROLES)      async def watch_command(self, ctx: Context, user: FetchedMember, *, reason: str = '') -> None:          """ -        Relay messages sent by the given `user` to the `#talent-pool` channel. +        Adds the given `user` to the talent pool.          A `reason` for adding the user to the talent pool is optional. -        If given, it will be displayed in the header when relaying messages of this user to the channel. +        This command can only be used in the `#nominations` channel.          """ +        if ctx.channel.id != Channels.nominations: +            if any(role.id in MODERATION_ROLES for role in ctx.author.roles): +                await ctx.send( +                    f":x: Nominations should be run in the <#{Channels.nominations}> channel. " +                    "Use `!tp forcewatch` to override this check." +                ) +            else: +                await ctx.send(f":x: Nominations must be run in the <#{Channels.nominations}> channel") +            return + +        await self._watch_user(ctx, user, reason) + +    async def _watch_user(self, ctx: Context, user: FetchedMember, reason: str) -> None: +        """Adds the given user to the talent pool."""          if user.bot:              await ctx.send(f":x: I'm sorry {ctx.author}, I'm afraid I can't do that. I only watch humans.")              return diff --git a/config-default.yml b/config-default.yml index 3da6fe629..a25826b5e 100644 --- a/config-default.yml +++ b/config-default.yml @@ -197,6 +197,7 @@ guild:          mods:                               305126844661760000          mod_alerts:                         473092532147060736          mod_spam:                           620607373828030464 +        nominations:                        822920136150745168          nomination_voting:                  822853512709931008          organisation:       &ORGANISATION   551789653284356126          staff_lounge:       &STAFF_LOUNGE   464905259261755392 | 
