Skip to content

Commit df5d8c2

Browse files
committed
Increment version to v2.12.4, added broken cog check in bot.py
1 parent 1c139ee commit df5d8c2

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.12.4
8+
9+
### Added
10+
- Named colors are now supported! Over 900 different common colors names are recognized. A list of color names can be found in [core/_color_data.py](https://github.com/kyb3r/modmail/blob/master/core/_color_data.py).
11+
- Named colors can be set the same way as hex. But this can only be done through `?config set`, which means database modifications will not work.
12+
- For example: `?config set main_color yellowish green`.
13+
- New config var `main_color` allows you to customize the main Modmail color (as requested by many). Defaults to Discord `blurple`.
14+
715
# v2.12.3
816

917
### Fixed

bot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = '2.12.3'
25+
__version__ = '2.12.4'
2626

2727
import asyncio
2828
from datetime import datetime
@@ -127,7 +127,10 @@ def _load_extensions(self):
127127
continue
128128
cog = f'cogs.{file[:-3]}'
129129
print(f'Loading {cog}')
130-
self.load_extension(cog)
130+
try:
131+
self.load_extension(cog)
132+
except Exception:
133+
print(f'Failed to load {cog}')
131134

132135
async def is_owner(self, user):
133136
allowed = {int(x) for x in

core/config.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,30 @@ def populate_cache(self):
102102
}
103103
return self.cache
104104

105-
def clean_data(self, key, value):
106-
value_text = value
107-
clean_value = value
105+
def clean_data(self, key, val):
106+
value_text = val
107+
clean_value = val
108+
108109
# when setting a color
109110
if key in self.colors:
110-
hex_ = ALL_COLORS.get(value)
111+
hex_ = ALL_COLORS.get(val)
111112

112113
if hex_ is None:
113-
if not isinstance(value, str):
114+
if not isinstance(val, str):
114115
raise InvalidConfigError('Invalid color name or hex.')
115-
if value.startswith('#'):
116-
value = value[1:]
117-
if len(value) != 6:
116+
if val.startswith('#'):
117+
val = val[1:]
118+
if len(val) != 6:
118119
raise InvalidConfigError('Invalid color name or hex.')
119-
for v in value:
120+
for v in val:
120121
if v not in {'0', '1', '2', '3', '4', '5', '6', '7',
121122
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}:
122123
raise InvalidConfigError('Invalid color name or hex.')
123-
clean_value = '#' + value
124+
clean_value = '#' + val
124125
value_text = clean_value
125126
else:
126127
clean_value = hex_
127-
value_text = f'{value} ({clean_value})'
128+
value_text = f'{val} ({clean_value})'
128129

129130
return clean_value, value_text
130131

core/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ async def find_or_create(self,
393393

394394
class InvalidConfigError(commands.BadArgument):
395395
def __init__(self, msg):
396+
super().__init__(msg)
396397
self.msg = msg
397398

398399
@property

0 commit comments

Comments
 (0)