Skip to content

Commit 08ab537

Browse files
committed
v3.3.0-dev1
1 parent c236b60 commit 08ab537

File tree

10 files changed

+262
-211
lines changed

10 files changed

+262
-211
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.
77
however, insignificant breaking changes does not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319).
88

99

10-
# [UNRELEASED]
10+
# v3.3.0-dev1
11+
12+
### Added
13+
14+
- Two new config vars:
15+
- `ENABLE_PLUGINS` (yes/no default yes), when set to no, plugins will not be loaded into the bot.
16+
- `ERROR_COLOR` (color format, defaults discord red), the color of error messages.
1117

1218
### Changed
1319

@@ -19,6 +25,7 @@ however, insignificant breaking changes does not guarantee a major version bump,
1925
- Logging / plugin-related messages changes.
2026
- Updating one plugin will not update all other plugins (plugins are no longer separated by repos, but the plugin name itself).
2127
- Help command is in alphabetical order grouped by permissions.
28+
- Notes are no longer always blurple, its set to `MAIN_COLOR` now.
2229

2330
### Internal
2431

bot.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.3.0-dev"
1+
__version__ = "3.3.0-dev1"
22

33
import asyncio
44
import logging
@@ -376,6 +376,10 @@ def recipient_color(self) -> int:
376376
def main_color(self) -> int:
377377
return self.config.get("main_color")
378378

379+
@property
380+
def error_color(self) -> int:
381+
return self.config.get("error_color")
382+
379383
def command_perm(self, command_name: str) -> PermissionLevel:
380384
level = self.config["override_command_level"].get(command_name)
381385
if level is not None:
@@ -608,7 +612,7 @@ async def _process_blocked(self, message: discord.Message) -> bool:
608612
title="Message not sent!",
609613
description=f"Your must wait for {delta} "
610614
f"before you can contact me.",
611-
color=discord.Color.red(),
615+
color=self.error_color,
612616
)
613617
)
614618

@@ -632,7 +636,7 @@ async def _process_blocked(self, message: discord.Message) -> bool:
632636
title="Message not sent!",
633637
description=f"Your must wait for {delta} "
634638
f"before you can contact me.",
635-
color=discord.Color.red(),
639+
color=self.error_color,
636640
)
637641
)
638642

@@ -950,7 +954,7 @@ async def on_member_remove(self, member):
950954
if thread:
951955
embed = discord.Embed(
952956
description="The recipient has left the server.",
953-
color=discord.Color.red(),
957+
color=self.error_color,
954958
)
955959
await thread.channel.send(embed=embed)
956960

@@ -1008,14 +1012,14 @@ async def on_command_error(self, context, exception):
10081012
)
10091013
await context.trigger_typing()
10101014
await context.send(
1011-
embed=discord.Embed(color=discord.Color.red(), description=msg)
1015+
embed=discord.Embed(color=self.error_color, description=msg)
10121016
)
10131017

10141018
elif isinstance(exception, commands.BadArgument):
10151019
await context.trigger_typing()
10161020
await context.send(
10171021
embed=discord.Embed(
1018-
color=discord.Color.red(), description=str(exception)
1022+
color=self.error_color, description=str(exception)
10191023
)
10201024
)
10211025
elif isinstance(exception, commands.CommandNotFound):
@@ -1028,7 +1032,7 @@ async def on_command_error(self, context, exception):
10281032
if hasattr(check, "fail_msg"):
10291033
await context.send(
10301034
embed=discord.Embed(
1031-
color=discord.Color.red(), description=check.fail_msg
1035+
color=self.error_color, description=check.fail_msg
10321036
)
10331037
)
10341038
if hasattr(check, "permission_level"):

cogs/modmail.py

+24-29
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def setup(self, ctx):
5252
embed = discord.Embed(
5353
title="Error",
5454
description="Modmail functioning guild not found.",
55-
color=discord.Color.red(),
55+
color=self.bot.error_color,
5656
)
5757
return await ctx.send(embed=embed)
5858

@@ -165,7 +165,7 @@ async def snippet(self, ctx, *, name: str.lower = None):
165165

166166
if not self.bot.snippets:
167167
embed = discord.Embed(
168-
color=discord.Color.red(),
168+
color=self.bot.error_color,
169169
description="You dont have any snippets at the moment.",
170170
)
171171
embed.set_footer(
@@ -212,23 +212,23 @@ async def snippet_add(self, ctx, name: str.lower, *, value: commands.clean_conte
212212
if name in self.bot.snippets:
213213
embed = discord.Embed(
214214
title="Error",
215-
color=discord.Color.red(),
215+
color=self.bot.error_color,
216216
description=f"Snippet `{name}` already exists.",
217217
)
218218
return await ctx.send(embed=embed)
219219

220220
if name in self.bot.aliases:
221221
embed = discord.Embed(
222222
title="Error",
223-
color=discord.Color.red(),
223+
color=self.bot.error_color,
224224
description=f"An alias with the same name already exists: `{name}`.",
225225
)
226226
return await ctx.send(embed=embed)
227227

228228
if len(name) > 120:
229229
embed = discord.Embed(
230230
title="Error",
231-
color=discord.Color.red(),
231+
color=self.bot.error_color,
232232
description=f"Snippet names cannot be longer than 120 characters.",
233233
)
234234
return await ctx.send(embed=embed)
@@ -316,16 +316,15 @@ async def move(self, ctx, category: discord.CategoryChannel, *, specifics: str =
316316
except (discord.HTTPException, discord.InvalidArgument):
317317
pass
318318

319-
@staticmethod
320-
async def send_scheduled_close_message(ctx, after, silent=False):
319+
async def send_scheduled_close_message(self, ctx, after, silent=False):
321320
human_delta = human_timedelta(after.dt)
322321

323322
silent = "*silently* " if silent else ""
324323

325324
embed = discord.Embed(
326325
title="Scheduled close",
327326
description=f"This thread will close {silent}in {human_delta}.",
328-
color=discord.Color.red(),
327+
color=self.bot.error_color,
329328
)
330329

331330
if after.arg and not silent:
@@ -375,12 +374,12 @@ async def close(self, ctx, *, after: UserFriendlyTime = None):
375374
if thread.close_task is not None or thread.auto_close_task is not None:
376375
await thread.cancel_closure(all=True)
377376
embed = discord.Embed(
378-
color=discord.Color.red(),
377+
color=self.bot.error_color,
379378
description="Scheduled close has been cancelled.",
380379
)
381380
else:
382381
embed = discord.Embed(
383-
color=discord.Color.red(),
382+
color=self.bot.error_color,
384383
description="This thread has not already been scheduled to close.",
385384
)
386385

@@ -432,7 +431,7 @@ async def notify(
432431

433432
if mention in mentions:
434433
embed = discord.Embed(
435-
color=discord.Color.red(),
434+
color=self.bot.error_color,
436435
description=f"{mention} is already going to be mentioned.",
437436
)
438437
else:
@@ -471,7 +470,7 @@ async def unnotify(
471470

472471
if mention not in mentions:
473472
embed = discord.Embed(
474-
color=discord.Color.red(),
473+
color=self.bot.error_color,
475474
description=f"{mention} does not have a pending notification.",
476475
)
477476
else:
@@ -511,7 +510,7 @@ async def subscribe(
511510

512511
if mention in mentions:
513512
embed = discord.Embed(
514-
color=discord.Color.red(),
513+
color=self.bot.error_color,
515514
description=f"{mention} is already " "subscribed to this thread.",
516515
)
517516
else:
@@ -550,7 +549,7 @@ async def unsubscribe(
550549

551550
if mention not in mentions:
552551
embed = discord.Embed(
553-
color=discord.Color.red(),
552+
color=self.bot.error_color,
554553
description=f"{mention} is not already " "subscribed to this thread.",
555554
)
556555
else:
@@ -659,7 +658,7 @@ async def logs(self, ctx, *, user: User = None):
659658

660659
if not any(not log["open"] for log in logs):
661660
embed = discord.Embed(
662-
color=discord.Color.red(),
661+
color=self.bot.error_color,
663662
description="This user does not " "have any previous logs.",
664663
)
665664
return await ctx.send(embed=embed)
@@ -696,7 +695,7 @@ async def logs_closed_by(self, ctx, *, user: User = None):
696695

697696
if not embeds:
698697
embed = discord.Embed(
699-
color=discord.Color.red(),
698+
color=self.bot.error_color,
700699
description="No log entries have been found for that query",
701700
)
702701
return await ctx.send(embed=embed)
@@ -729,7 +728,7 @@ async def logs_search(self, ctx, limit: Optional[int] = None, *, query):
729728

730729
if not embeds:
731730
embed = discord.Embed(
732-
color=discord.Color.red(),
731+
color=self.bot.error_color,
733732
description="No log entries have been found for that query.",
734733
)
735734
return await ctx.send(embed=embed)
@@ -788,11 +787,7 @@ async def find_linked_message(self, ctx, message_id):
788787
async for msg in ctx.channel.history():
789788
if message_id is None and msg.embeds:
790789
embed = msg.embeds[0]
791-
if isinstance(self.bot.mod_color, discord.Color):
792-
mod_color = self.bot.mod_color.value
793-
else:
794-
mod_color = self.bot.mod_color
795-
if embed.color.value != mod_color or not embed.author.url:
790+
if embed.color.value != self.bot.mod_color or not embed.author.url:
796791
continue
797792
# TODO: use regex to find the linked message id
798793
linked_message_id = str(embed.author.url).split("/")[-1]
@@ -823,7 +818,7 @@ async def edit(self, ctx, message_id: Optional[int] = None, *, message: str):
823818
embed=discord.Embed(
824819
title="Failed",
825820
description="Cannot find a message to edit.",
826-
color=discord.Color.red(),
821+
color=self.bot.error_color,
827822
)
828823
)
829824

@@ -859,15 +854,15 @@ async def contact(
859854

860855
if user.bot:
861856
embed = discord.Embed(
862-
color=discord.Color.red(),
857+
color=self.bot.error_color,
863858
description="Cannot start a thread with a bot.",
864859
)
865860
return await ctx.send(embed=embed)
866861

867862
exists = await self.bot.threads.find(recipient=user)
868863
if exists:
869864
embed = discord.Embed(
870-
color=discord.Color.red(),
865+
color=self.bot.error_color,
871866
description="A thread for this user already "
872867
f"exists in {exists.channel.mention}.",
873868
)
@@ -1031,7 +1026,7 @@ async def block(
10311026
embed = discord.Embed(
10321027
title="Error",
10331028
description=f"Cannot block {mention}, user is whitelisted.",
1034-
color=discord.Color.red(),
1029+
color=self.bot.error_color,
10351030
)
10361031
return await ctx.send(embed=embed)
10371032

@@ -1079,7 +1074,7 @@ async def block(
10791074
else:
10801075
embed = discord.Embed(
10811076
title="Error",
1082-
color=discord.Color.red(),
1077+
color=self.bot.error_color,
10831078
description=f"{mention} is already blocked.",
10841079
)
10851080

@@ -1136,7 +1131,7 @@ async def unblock(self, ctx, *, user: User = None):
11361131
embed = discord.Embed(
11371132
title="Error",
11381133
description=f"{mention} is not blocked.",
1139-
color=discord.Color.red(),
1134+
color=self.bot.error_color,
11401135
)
11411136

11421137
return await ctx.send(embed=embed)
@@ -1168,7 +1163,7 @@ async def delete(self, ctx, message_id: Optional[int] = None):
11681163
embed=discord.Embed(
11691164
title="Failed",
11701165
description="Cannot find a message to delete.",
1171-
color=discord.Color.red(),
1166+
color=self.bot.error_color,
11721167
)
11731168
)
11741169

0 commit comments

Comments
 (0)