|
|
@@ -31,18 +31,16 @@ class ConfigCog(BaseCog, name='Configuration'):
|
|
31
|
31
|
default_permissions=Permissions(Permissions.manage_messages.flag)
|
|
32
|
32
|
)
|
|
33
|
33
|
|
|
34
|
|
- @config.command(
|
|
35
|
|
- description='Sets the mod warning channel',
|
|
36
|
|
- extras={
|
|
37
|
|
- 'long_description': 'Run this command in the channel where bot messages ' +
|
|
38
|
|
- 'intended for server moderators should be sent. Other bot ' +
|
|
39
|
|
- 'messages may still be posted in the channel a command was ' +
|
|
40
|
|
- 'invoked in. If no output channel is set, mod-related messages ' +
|
|
41
|
|
- 'will not be posted!',
|
|
42
|
|
- }
|
|
43
|
|
- )
|
|
44
|
|
- async def setwarningchannel(self, interaction: Interaction) -> None:
|
|
45
|
|
- """Command handler"""
|
|
|
34
|
+ @config.command()
|
|
|
35
|
+ async def set_warning_channel(self, interaction: Interaction) -> None:
|
|
|
36
|
+ """
|
|
|
37
|
+ Sets mod warnings to post in the current channel.
|
|
|
38
|
+
|
|
|
39
|
+ Run this command in the channel where bot messages intended for server
|
|
|
40
|
+ moderators should be sent. Other bot messages may still be posted in
|
|
|
41
|
+ the channel a command was invoked in. If no output channel is set,
|
|
|
42
|
+ mod-related messages will not be posted!
|
|
|
43
|
+ """
|
|
46
|
44
|
guild: Guild = interaction.guild
|
|
47
|
45
|
channel: TextChannel = interaction.channel
|
|
48
|
46
|
Storage.set_config_value(guild, ConfigKey.WARNING_CHANNEL_ID,
|
|
|
@@ -52,15 +50,14 @@ class ConfigCog(BaseCog, name='Configuration'):
|
|
52
|
50
|
ephemeral=True,
|
|
53
|
51
|
)
|
|
54
|
52
|
|
|
55
|
|
- @config.command(
|
|
56
|
|
- description='Shows the mod warning channel',
|
|
57
|
|
- extras={
|
|
58
|
|
- 'long_description': 'Shows the configured channel (if any) where mod ' + \
|
|
59
|
|
- 'warnings will be posted.',
|
|
60
|
|
- },
|
|
61
|
|
- )
|
|
62
|
|
- async def getwarningchannel(self, interaction: Interaction) -> None:
|
|
63
|
|
- """Command handler"""
|
|
|
53
|
+ @config.command()
|
|
|
54
|
+ async def get_warning_channel(self, interaction: Interaction) -> None:
|
|
|
55
|
+ """
|
|
|
56
|
+ Shows the mod warning channel, if any.
|
|
|
57
|
+
|
|
|
58
|
+ Shows the configured channel (if any) where mod warnings and other bot
|
|
|
59
|
+ output will be posted.
|
|
|
60
|
+ """
|
|
64
|
61
|
guild: Guild = interaction.guild
|
|
65
|
62
|
channel_id = Storage.get_config_value(guild, ConfigKey.WARNING_CHANNEL_ID)
|
|
66
|
63
|
if channel_id is None:
|
|
|
@@ -75,20 +72,23 @@ class ConfigCog(BaseCog, name='Configuration'):
|
|
75
|
72
|
ephemeral=True,
|
|
76
|
73
|
)
|
|
77
|
74
|
|
|
78
|
|
- @config.command(
|
|
79
|
|
- description='Sets a user/role to mention in warning messages',
|
|
80
|
|
- extras={
|
|
81
|
|
- 'usage': '<@user|@role>',
|
|
82
|
|
- 'long_description': 'Configures an role or other prefix to include at the ' +
|
|
83
|
|
- 'beginning of warning messages. If the intent is to get the ' +
|
|
84
|
|
- 'attention of certain users, be sure to specify a properly ' +
|
|
85
|
|
- 'formed @ tag, not just the name of the user/role.',
|
|
86
|
|
- },
|
|
87
|
|
- )
|
|
88
|
|
- async def setwarningmention(self,
|
|
|
75
|
+ @config.command()
|
|
|
76
|
+ async def set_warning_mention(self,
|
|
89
|
77
|
interaction: Interaction,
|
|
90
|
78
|
mention: Optional[Union[User, Role]] = None) -> None:
|
|
91
|
|
- """Command handler"""
|
|
|
79
|
+ """
|
|
|
80
|
+ Sets a user/role to mention in warning messages.
|
|
|
81
|
+
|
|
|
82
|
+ Configures an role or other prefix to include at the beginning of
|
|
|
83
|
+ warning messages. The intent is to get the attention of certain users
|
|
|
84
|
+ in case action is needed. Leave blank to tag no one.
|
|
|
85
|
+
|
|
|
86
|
+ Parameters
|
|
|
87
|
+ ----------
|
|
|
88
|
+ interaction: Interaction
|
|
|
89
|
+ mention: User or Role
|
|
|
90
|
+ The user or role to mention in warning messages
|
|
|
91
|
+ """
|
|
92
|
92
|
guild: Guild = interaction.guild
|
|
93
|
93
|
Storage.set_config_value(guild, ConfigKey.WARNING_MENTION, mention.mention if mention else None)
|
|
94
|
94
|
if mention is None:
|
|
|
@@ -98,19 +98,15 @@ class ConfigCog(BaseCog, name='Configuration'):
|
|
98
|
98
|
)
|
|
99
|
99
|
else:
|
|
100
|
100
|
await interaction.response.send_message(
|
|
101
|
|
- f'{CONFIG["success_emoji"]} Warning messages will now tag {mention}.',
|
|
|
101
|
+ f'{CONFIG["success_emoji"]} Warning messages will now tag {mention.mention}.',
|
|
102
|
102
|
ephemeral=True,
|
|
103
|
103
|
)
|
|
104
|
104
|
|
|
105
|
|
- @config.command(
|
|
106
|
|
- description='Shows the user/role to mention in warning messages',
|
|
107
|
|
- extras={
|
|
108
|
|
- 'long_description': 'Shows the text, if any, that will be prefixed on any ' +
|
|
109
|
|
- 'warning messages.',
|
|
110
|
|
- },
|
|
111
|
|
- )
|
|
112
|
|
- async def getwarningmention(self, interaction: Interaction) -> None:
|
|
113
|
|
- """Command handler"""
|
|
|
105
|
+ @config.command()
|
|
|
106
|
+ async def get_warning_mention(self, interaction: Interaction) -> None:
|
|
|
107
|
+ """
|
|
|
108
|
+ Shows the configured user/role to mention in warning messages.
|
|
|
109
|
+ """
|
|
114
|
110
|
guild: Guild = interaction.guild
|
|
115
|
111
|
mention: str = Storage.get_config_value(guild, ConfigKey.WARNING_MENTION)
|
|
116
|
112
|
if mention is None:
|