Skip to content

Commit ec8fb29

Browse files
committed
use_nickname_channel_name, resolves #3112
1 parent e44fb12 commit ec8fb29

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
1919
- `require_close_reason` config to require a reason to close a thread. ([GH #3107](https://github.com/kyb3r/modmail/issues/3107))
2020
- `plain_snippets` config to force all snippets to be plain. ([GH #3083](https://github.com/kyb3r/modmail/issues/3083))
2121
- `?fpareply` and `?fpreply` to reply to messages with variables plainly.
22+
- `use_nickname_channel_name` config to use nicknames instead of usernames for channel names. ([GH #3112](https://github.com/kyb3r/modmail/issues/3112))
2223

2324
### Improved
2425

bot.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.11.0-dev2"
1+
__version__ = "3.11.0-dev3"
22

33

44
import asyncio
@@ -1663,7 +1663,12 @@ def format_channel_name(self, author, exclude_channel=None, force_null=False):
16631663
elif self.config["use_timestamp_channel_name"]:
16641664
name = new_name = author.created_at.isoformat(sep="-", timespec="minutes")
16651665
else:
1666-
name = author.name.lower()
1666+
if self.config["use_nickname_channel_name"]:
1667+
author_member = self.guild.get_member(author.id)
1668+
name = author_member.display_name.lower()
1669+
else:
1670+
name = author.name.lower()
1671+
16671672
if force_null:
16681673
name = "null"
16691674

core/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ConfigManager:
5252
"close_emoji": "\N{LOCK}",
5353
"use_user_id_channel_name": False,
5454
"use_timestamp_channel_name": False,
55+
"use_nickname_channel_name": False,
5556
"recipient_thread_close": False,
5657
"thread_show_roles": True,
5758
"thread_show_account_age": True,
@@ -184,6 +185,7 @@ class ConfigManager:
184185
booleans = {
185186
"use_user_id_channel_name",
186187
"use_timestamp_channel_name",
188+
"use_nickname_channel_name",
187189
"user_typing",
188190
"mod_typing",
189191
"reply_without_command",

core/config_help.json

+17-4
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
],
107107
"notes": [
108108
"This config is suitable for servers in Server Discovery to comply with channel name restrictions.",
109-
"This cannot be applied with `use_timestamp_channel_name`.",
110-
"See also: `use_timestamp_channel_name`."
109+
"This cannot be applied with `use_timestamp_channel_name` or `use_nickname_channel_name`.",
110+
"See also: `use_timestamp_channel_name`, `use_nickname_channel_name`."
111111
]
112112
},
113113
"use_timestamp_channel_name": {
@@ -119,8 +119,21 @@
119119
],
120120
"notes": [
121121
"This config is suitable for servers in Server Discovery to comply with channel name restrictions.",
122-
"This cannot be applied with `use_user_id_channel_name`.",
123-
"See also: `use_user_id_channel_name`."
122+
"This cannot be applied with `use_user_id_channel_name` or `use_nickname_channel_name`.",
123+
"See also: `use_user_id_channel_name`, `use_nickname_channel_name`."
124+
]
125+
},
126+
"use_nickname_channel_name": {
127+
"default": "No",
128+
"description": "When this is set to `yes`, new thread channels will be named with the recipient's nickname instead of the recipient's name.",
129+
"examples": [
130+
"`{prefix}config set use_nickname_channel_name yes`",
131+
"`{prefix}config set use_nickname_channel_name no`"
132+
],
133+
"notes": [
134+
"This config is suitable for servers in Server Discovery to comply with channel name restrictions.",
135+
"This cannot be applied with `use_timestamp_channel_name` or `use_user_id_channel_name`.",
136+
"See also: `use_timestamp_channel_name`, `use_user_id_channel_name`."
124137
]
125138
},
126139
"mod_typing": {

0 commit comments

Comments
 (0)