combine find_user_settings() and find_user_settings_prefix()
This commit is contained in:
parent
50d1eb6b8c
commit
257042ac2c
1 changed files with 11 additions and 8 deletions
|
@ -187,14 +187,17 @@ class Channel(IRCObject.Object):
|
|||
default: typing.Any=None) -> typing.Any:
|
||||
return self.bot.database.user_channel_settings.get(user_id,
|
||||
self.id, setting, default)
|
||||
def find_user_settings(self, user_id: int, pattern: str,
|
||||
default: typing.Any=[]) -> typing.List[typing.Any]:
|
||||
def find_user_settings(self, user_id: int, pattern: str=None,
|
||||
prefix: str=None, default: typing.Any=[]
|
||||
) -> typing.List[typing.Any]:
|
||||
if not pattern == None:
|
||||
return self.bot.database.user_channel_settings.find(user_id,
|
||||
self.id, pattern, default)
|
||||
def find_user_settings_prefix(self, user_id: int, prefix: str,
|
||||
default: typing.Any=[]) -> typing.List[typing.Any]:
|
||||
return self.bot.database.user_channel_settings.find_prefix(
|
||||
user_id, self.id, prefix, default)
|
||||
elif not prefix == None:
|
||||
return self.bot.database.user_channel_settings.find_prefix(user_id,
|
||||
self.id, prefix, default)
|
||||
else:
|
||||
raise ValueError("Please provide 'pattern' or 'prefix'")
|
||||
def del_user_setting(self, user_id: int, setting: str):
|
||||
self.bot.database.user_channel_settings.delete(user_id, self.id,
|
||||
setting)
|
||||
|
|
Loading…
Reference in a new issue