Skip to content

Commit 022407e

Browse files
committed
Add support for keys with log search
1 parent d8af5f4 commit 022407e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

CHANGELOG.md

+7
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.17.2
8+
9+
### Changed
10+
11+
- Logs search command will search through log keys as well now.
12+
13+
e.g. `?logs search e7499e82f8ff`
714

815
# v2.17.1
916

bot.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = '2.17.1'
25+
__version__ = '2.17.2'
2626

2727
import asyncio
2828
import logging
@@ -364,12 +364,12 @@ async def on_connect(self):
364364
async def setup_indexes(self):
365365
"""Setup text indexes so we can use the $search operator"""
366366
coll = self.db.logs
367-
index_name = 'messages.content_text_messages.author.name_text'
367+
index_name = 'messages.content_text_messages.author.name_text_key_text'
368368

369369
index_info = await coll.index_information()
370370

371371
# Backwards compatibility
372-
old_index = 'messages.content_text'
372+
old_index = 'messages.content_text_messages.author.name_text'
373373
if old_index in index_info:
374374
logger.info(info(f'Dropping old index: {old_index}'))
375375
await coll.drop_index(old_index)
@@ -379,7 +379,8 @@ async def setup_indexes(self):
379379
logger.info(info('Name: ' + index_name))
380380
await coll.create_index([
381381
('messages.content', 'text'),
382-
('messages.author.name', 'text')
382+
('messages.author.name', 'text'),
383+
('key', 'text')
383384
])
384385

385386
async def on_ready(self):

cogs/modmail.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ async def contact(self, ctx,
640640

641641
@commands.command()
642642
@trigger_typing
643-
@checks.has_permissions(manage_channels=True)
643+
@checks.has_permissions(kick_members=True)
644644
async def blocked(self, ctx):
645645
"""Returns a list of blocked users"""
646646
embed = discord.Embed(title='Blocked Users',
@@ -673,7 +673,7 @@ async def blocked(self, ctx):
673673

674674
@commands.command()
675675
@trigger_typing
676-
@checks.has_permissions(manage_channels=True)
676+
@checks.has_permissions(kick_members=True)
677677
async def block(self, ctx, user: Optional[User] = None, *,
678678
after: UserFriendlyTime = None):
679679
"""
@@ -739,7 +739,7 @@ async def block(self, ctx, user: Optional[User] = None, *,
739739

740740
@commands.command()
741741
@trigger_typing
742-
@checks.has_permissions(manage_channels=True)
742+
@checks.has_permissions(kick_members=True)
743743
async def unblock(self, ctx, *, user: User = None):
744744
"""
745745
Unblocks a user from using Modmail.

0 commit comments

Comments
 (0)