diff options
| author | 2021-04-04 20:51:15 +0200 | |
|---|---|---|
| committer | 2021-04-04 20:51:15 +0200 | |
| commit | 47d535c82af5463699b7d8e4533ba415fd4e964a (patch) | |
| tree | 2e94d0e8b658b30610bf60b7796facf7723b95c3 | |
| parent | Merge pull request #1497 from python-discord/mbaruh-staff_info (diff) | |
| parent | Merge branch 'main' into limit-nominate-command-channels (diff) | |
Merge pull request #1479 from python-discord/limit-nominate-command-channels
Limit nominate command channels
| -rw-r--r-- | bot/constants.py | 4 | ||||
| -rw-r--r-- | bot/exts/recruitment/talentpool/_cog.py | 28 | ||||
| -rw-r--r-- | config-default.yml | 13 | 
3 files changed, 31 insertions, 14 deletions
| diff --git a/bot/constants.py b/bot/constants.py index 8c42daca6..4884a1278 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -388,6 +388,7 @@ class Categories(metaclass=YAMLGetter):      help_available: int      help_dormant: int      help_in_use: int +    moderators: int      modmail: int      voice: int @@ -433,9 +434,8 @@ class Channels(metaclass=YAMLGetter):      helpers: int      incidents: int      incidents_archive: int -    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 c5e830ec4..b89f1505e 100644 --- a/config-default.yml +++ b/config-default.yml @@ -139,6 +139,7 @@ guild:          help_dormant:                       691405908919451718          help_in_use:                        696958401460043776          logs:               &LOGS           468520609152892958 +        moderators:         &MODS_CATEGORY  749736277464842262          modmail:            &MODMAIL        714494672835444826          voice:                              356013253765234688 @@ -191,12 +192,8 @@ guild:          helpers:            &HELPERS        385474242440986624          incidents:                          714214212200562749          incidents_archive:                  720668923636351037 -        mods:               &MODS           305126844661760000          mod_alerts:                         473092532147060736 -        mod_appeals:        &MOD_APPEALS    808790025688711198 -        mod_meta:           &MOD_META       775412552795947058 -        mod_spam:           &MOD_SPAM       620607373828030464 -        mod_tools:          &MOD_TOOLS      775413915391098921 +        nominations:                        822920136150745168          nomination_voting:                  822853512709931008          organisation:       &ORGANISATION   551789653284356126          staff_lounge:       &STAFF_LOUNGE   464905259261755392 @@ -225,17 +222,13 @@ guild:          talent_pool:        &TALENT_POOL    534321732593647616      moderation_categories: +        - *MODS_CATEGORY          - *MODMAIL          - *LOGS      moderation_channels:          - *ADMINS          - *ADMIN_SPAM -        - *MOD_APPEALS -        - *MOD_META -        - *MOD_TOOLS -        - *MODS -        - *MOD_SPAM      # Modlog cog ignores events which occur in these channels      modlog_blacklist: | 
