Skip to content

Commit

Permalink
require_close_reason config, resolves #3107
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Nov 21, 2021
1 parent 1444c1d commit 13a22cf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
### Added

- `use_hoisted_top_role` config to use change how default mod tags work, see `v3.10.0#Added` for details. ([PR #3093](https://github.com/kyb3r/modmail/pull/3093))
- `require_close_reason` to require a reason to close a thread. ([GH #3107](https://github.com/kyb3r/modmail/issues/3107))

### Improved

Expand All @@ -27,9 +28,9 @@ however, insignificant breaking changes do not guarantee a major version bump, s
- Certain cases where fallback categories were not working as intended. ([PR #3109](https://github.com/kyb3r/modmail/pull/3109))
- `?contact` would create in a random category in silent mode. ([GH #3091](https://github.com/kyb3r/modmail/issues/3091), [PR #3092](https://github.com/kyb3r/modmail/pull/3092))
- Certain cases where `?close` would fail if closer isn't in cache. ([GH #3104](https://github.com/kyb3r/modmail/issues/3104), [PR #3105](https://github.com/kyb3r/modmail/pull/3105))
- Stickers were not working in Modmail.
- Stickers now work in Modmail.
- Large server sizes results in Guild.name == None. ([GH #3088](https://github.com/kyb3r/modmail/issues/3088))
- Attachments did not work on plain replies. ([GH #3102](https://github.com/kyb3r/modmail/issues/3102))
- Attachments now work on plain replies. ([GH #3102](https://github.com/kyb3r/modmail/issues/3102))
- Support LOTTIE stickers. ([GH #3119](https://github.com/kyb3r/modmail/issues/3119))
- Editing notes now work. ([GH #3094](https://github.com/kyb3r/modmail/issues/3094))

Expand Down
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.11.0-dev3"
__version__ = "3.11.0-dev2"


import asyncio
Expand Down
3 changes: 3 additions & 0 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ async def close(self, ctx, *, after: UserFriendlyTime = None):

return await ctx.send(embed=embed)

if self.bot.config["require_close_reason"] and message is None:
raise commands.BadArgument("Provide a reason for closing the thread.")

if after and after.dt > now:
await self.send_scheduled_close_message(ctx, after, silent)

Expand Down
2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ConfigManager:
"silent_alert_on_mention": False,
"show_timestamp": True,
"anonymous_snippets": False,
"require_close_reason": False,
# group conversations
"private_added_to_group_title": "New Thread (Group)",
"private_added_to_group_response": "{moderator.name} has added you to a Modmail thread.",
Expand Down Expand Up @@ -206,6 +207,7 @@ class ConfigManager:
"update_notifications",
"thread_contact_silently",
"anonymous_snippets",
"require_close_reason",
"recipient_thread_close",
"thread_show_roles",
"thread_show_account_age",
Expand Down
8 changes: 8 additions & 0 deletions core/config_help.json
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,14 @@
"See also: `anon_avatar_url`, `anon_tag`."
]
},
"require_close_reason": {
"default" : "No",
"description": "Require a reason to close threads.",
"examples": [
"`{prefix}config set require_close_reason yes`"
],
"notes": []
},
"private_added_to_group_title": {
"default": "New Thread (Group)",
"description": "This is the message embed title sent to the recipient that is just added to a thread.",
Expand Down

0 comments on commit 13a22cf

Please sign in to comment.