Skip to content

Commit 84a7910

Browse files
committedDec 9, 2019
Changed disable to disable new
1 parent 6d15d8f commit 84a7910

File tree

4 files changed

+47
-22
lines changed

4 files changed

+47
-22
lines changed
 

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ however, insignificant breaking changes does not guarantee a major version bump,
3333
- Swapped the position of user and category for `?contact`.
3434
- The log file will no longer grow infinitely large.
3535
- Hard limit of maximum 25 steps for alias.
36+
- `?disable` is now `?disable new`.
3637

3738
### Fixed
3839

‎cogs/modmail.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ async def snippet(self, ctx, *, name: str.lower = None):
153153
embed = create_not_found_embed(name, self.bot.snippets.keys(), "Snippet")
154154
else:
155155
embed = discord.Embed(
156-
title=f'Snippet - "{name}":',
157-
description=val,
158-
color=self.bot.main_color
156+
title=f'Snippet - "{name}":', description=val, color=self.bot.main_color
159157
)
160158
return await ctx.send(embed=embed)
161159

@@ -189,9 +187,11 @@ async def snippet_raw(self, ctx, *, name: str.lower):
189187
embed = create_not_found_embed(name, self.bot.snippets.keys(), "Snippet")
190188
else:
191189
val = truncate(escape_code_block(val), 2048 - 7)
192-
embed = discord.Embed(title=f'Raw snippet - "{name}":',
193-
description=f"```\n{val}```",
194-
color=self.bot.main_color)
190+
embed = discord.Embed(
191+
title=f'Raw snippet - "{name}":',
192+
description=f"```\n{val}```",
193+
color=self.bot.main_color,
194+
)
195195

196196
return await ctx.send(embed=embed)
197197

@@ -1309,11 +1309,22 @@ async def enable(self, ctx):
13091309
@commands.group(invoke_without_command=True)
13101310
@checks.has_permissions(PermissionLevel.ADMINISTRATOR)
13111311
async def disable(self, ctx):
1312+
"""
1313+
Disable partial or full Modmail thread functions.
1314+
1315+
To stop all new threads from being created, do `{prefix}disable new`.
1316+
To stop all existing threads from DMing Modmail, do `{prefix}disable all`.
1317+
To check if the DM function for Modmail is enabled, do `{prefix}isenable`.
1318+
"""
1319+
await ctx.send_help(ctx.command)
1320+
1321+
@disable.command(name="new")
1322+
@checks.has_permissions(PermissionLevel.ADMINISTRATOR)
1323+
async def disable_new(self, ctx):
13121324
"""
13131325
Stop accepting new Modmail threads.
13141326
13151327
No new threads can be created through DM.
1316-
To stop all existing threads from DMing Modmail, do `{prefix}disable all`.
13171328
"""
13181329
embed = discord.Embed(
13191330
title="Success",

‎cogs/utility.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -923,9 +923,7 @@ async def alias(self, ctx, *, name: str.lower = None):
923923

924924
if len(values) == 1:
925925
embed = discord.Embed(
926-
title=f'Alias - "{name}":',
927-
description=values[0],
928-
color=self.bot.main_color
926+
title=f'Alias - "{name}":', description=values[0], color=self.bot.main_color
929927
)
930928
return await ctx.send(embed=embed)
931929

@@ -935,7 +933,7 @@ async def alias(self, ctx, *, name: str.lower = None):
935933
embed = discord.Embed(
936934
color=self.bot.main_color,
937935
title=f'Alias - "{name}" - Step {i}:',
938-
description=val
936+
description=val,
939937
)
940938
embeds += [embed]
941939
session = EmbedPaginatorSession(ctx, *embeds)
@@ -971,10 +969,10 @@ async def alias_raw(self, ctx, *, name: str.lower):
971969
embed = utils.create_not_found_embed(name, self.bot.aliases.keys(), "Alias")
972970
return await ctx.send(embed=embed)
973971

974-
val = utils.truncate(utils.escape_code_block(val), 2048-7)
975-
embed = discord.Embed(title=f'Raw alias - "{name}":',
976-
description=f"```\n{val}```",
977-
color=self.bot.main_color)
972+
val = utils.truncate(utils.escape_code_block(val), 2048 - 7)
973+
embed = discord.Embed(
974+
title=f'Raw alias - "{name}":', description=f"```\n{val}```", color=self.bot.main_color
975+
)
978976

979977
return await ctx.send(embed=embed)
980978

@@ -990,9 +988,9 @@ async def make_alias(self, name, value, action):
990988
return embed
991989

992990
if len(values) > 25:
993-
embed = discord.Embed(title="Error",
994-
description="Too many steps, max=25.",
995-
color=self.bot.error_color)
991+
embed = discord.Embed(
992+
title="Error", description="Too many steps, max=25.", color=self.bot.error_color
993+
)
996994
return embed
997995

998996
save_aliases = []

‎core/utils.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,25 @@
1111
import discord
1212
from discord.ext import commands
1313

14-
__all__ = ['strtobool', 'User', 'truncate', 'format_preview', 'is_image_url',
15-
'parse_image_url', 'human_join', 'days', 'cleanup_code', 'match_user_id',
16-
'create_not_found_embed', 'parse_alias', 'normalize_alias', 'format_description', 'trigger_typing',
17-
'escape_code_block', 'format_channel_name']
14+
__all__ = [
15+
"strtobool",
16+
"User",
17+
"truncate",
18+
"format_preview",
19+
"is_image_url",
20+
"parse_image_url",
21+
"human_join",
22+
"days",
23+
"cleanup_code",
24+
"match_user_id",
25+
"create_not_found_embed",
26+
"parse_alias",
27+
"normalize_alias",
28+
"format_description",
29+
"trigger_typing",
30+
"escape_code_block",
31+
"format_channel_name",
32+
]
1833

1934

2035
def strtobool(val):

0 commit comments

Comments
 (0)
Please sign in to comment.