Skip to content

Commit 181a3ae

Browse files
committed
Fix unsetting in selfhosted config update
1 parent 8e2dd50 commit 181a3ae

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ 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.5
8+
9+
### Fixed
10+
11+
- `config del` command will now work properly on selfhosted db bots.
12+
13+
714
# v2.12.4
815

916
### Added

core/clients.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,17 @@ async def get_config(self):
452452
return conf
453453

454454
async def update_config(self, data):
455-
data = self.filter_valid(data)
456-
return await self.db.config.update_one({'bot_id': self.bot.user.id},
457-
{'$set': data})
455+
valid_keys = self.bot.config.valid_keys.difference(
456+
self.bot.config.protected_keys
457+
)
458+
459+
toset = {k: v for k, v in data.items() if k in valid_keys}
460+
unset = {k: 1 for k in valid_keys if k not in data}
461+
462+
return await self.db.config.update_one(
463+
{'bot_id': self.bot.user.id},
464+
{'$set': toset, '$unset': unset}
465+
)
458466

459467
async def edit_message(self, message_id, new_content):
460468
await self.logs.update_one({

core/thread.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ async def send(self, message, destination=None,
363363

364364
img_embed = discord.Embed(color=color)
365365
img_embed.set_image(url=att[0])
366+
img_embed.title = att[1]
367+
img_embed.url = att[0]
366368
img_embed.set_footer(
367369
text=f'Additional Image Upload ({additional_count})'
368370
)

0 commit comments

Comments
 (0)