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:
|
default: typing.Any=None) -> typing.Any:
|
||||||
return self.bot.database.user_channel_settings.get(user_id,
|
return self.bot.database.user_channel_settings.get(user_id,
|
||||||
self.id, setting, default)
|
self.id, setting, default)
|
||||||
def find_user_settings(self, user_id: int, pattern: str,
|
def find_user_settings(self, user_id: int, pattern: str=None,
|
||||||
default: typing.Any=[]) -> typing.List[typing.Any]:
|
prefix: str=None, default: typing.Any=[]
|
||||||
return self.bot.database.user_channel_settings.find(user_id,
|
) -> typing.List[typing.Any]:
|
||||||
self.id, pattern, default)
|
if not pattern == None:
|
||||||
def find_user_settings_prefix(self, user_id: int, prefix: str,
|
return self.bot.database.user_channel_settings.find(user_id,
|
||||||
default: typing.Any=[]) -> typing.List[typing.Any]:
|
self.id, pattern, default)
|
||||||
return self.bot.database.user_channel_settings.find_prefix(
|
elif not prefix == None:
|
||||||
user_id, self.id, prefix, default)
|
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):
|
def del_user_setting(self, user_id: int, setting: str):
|
||||||
self.bot.database.user_channel_settings.delete(user_id, self.id,
|
self.bot.database.user_channel_settings.delete(user_id, self.id,
|
||||||
setting)
|
setting)
|
||||||
|
|
Loading…
Reference in a new issue