@@ -52,6 +52,7 @@ async def check_filters_messages(self, message: discord.Message):
52
52
"""Check all the filters for a certain message (with it's guild)"""
53
53
if message .author .id == self .bot .user .id or not hasattr (message .author , 'roles' ):
54
54
return
55
+
55
56
roles = await self .word_filter_role_whitelist .query_all (guild_id = message .guild .id )
56
57
whitelisted_ids = set (role .role_id for role in roles )
57
58
if any (x .id in whitelisted_ids for x in message .author .roles ):
@@ -236,14 +237,14 @@ async def remove(self, ctx: DozerContext, filter_id: int):
236
237
@guild_only ()
237
238
@has_permissions (manage_guild = True )
238
239
@filter .command (name = "dm" )
239
- async def dm_config (self , ctx : DozerContext , config : bool ):
240
+ async def dm_config (self , ctx : DozerContext , config : str ):
240
241
"""Set whether filter words should be DMed when used in bot messages"""
241
- config = str (int (config )) # turns into "1" or "0" idk man
242
+ config : str = str (int (config )) # turns into "1" or "0" idk man
242
243
results = await WordFilterSetting .get_by (guild_id = ctx .guild .id , setting_type = "dm" )
243
244
if results :
244
245
before_setting = results [0 ].value
245
246
# Due to the settings table having a serial ID, inserts always succeed, so update_or_add can't be used to
246
- # update in place. Instead we have to delete and reinsert the record.
247
+ # update in place. Instead, we have to delete and reinsert the record.
247
248
await WordFilterSetting .delete (guild_id = results [0 ].guild_id , setting_type = results [0 ].setting_type )
248
249
else :
249
250
before_setting = None
@@ -254,7 +255,8 @@ async def dm_config(self, ctx: DozerContext, config: bool):
254
255
"The DM setting for this guild has been changed from {} to {}." .format (before_setting == "1" ,
255
256
result .value == "1" ))
256
257
257
- dm_config .example_usage = "`{prefix}filter dm_config True` - Makes all messages containining filter lists to be sent through DMs"
258
+ dm_config .example_usage = "`{prefix}filter dm_config True` - Makes all messages containining filter lists to be " \
259
+ "sent through DMs "
258
260
259
261
@guild_only ()
260
262
@filter .group (invoke_without_command = True )
@@ -316,7 +318,7 @@ def setup(bot):
316
318
class WordFilter (db .DatabaseTable ):
317
319
"""Object for each filter"""
318
320
__tablename__ = 'word_filters'
319
- __uniques__ = 'filter_id'
321
+ __uniques__ = [ 'filter_id' ]
320
322
321
323
@classmethod
322
324
async def initial_create (cls ):
@@ -354,7 +356,7 @@ async def get_by(cls, **kwargs):
354
356
class WordFilterSetting (db .DatabaseTable ):
355
357
"""Each filter-related setting"""
356
358
__tablename__ = 'word_filter_settings'
357
- __uniques__ = 'id'
359
+ __uniques__ = [ 'id' ]
358
360
359
361
@classmethod
360
362
async def initial_create (cls ):
@@ -388,7 +390,7 @@ async def get_by(cls, **kwargs):
388
390
class WordFilterRoleWhitelist (db .DatabaseTable ):
389
391
"""Object for each whitelisted role"""
390
392
__tablename__ = 'word_filter_role_whitelist'
391
- __uniques__ = 'role_id'
393
+ __uniques__ = [ 'role_id' ]
392
394
393
395
@classmethod
394
396
async def initial_create (cls ):
0 commit comments