def should_log(self, location):
if self.settings.get('everything', False):
return True
default = self.settings.get('default', False)
if type(location) is discord.Server:
if location.id in self.settings:
loc = self.settings[location.id]
return loc.get('all', False) or loc.get('events', default)
elif type(location) is discord.Channel:
if location.server.id in self.settings:
loc = self.settings[location.server.id]
opts = [loc.get('all', False), loc.get(location.id, default)]
if location.type is discord.ChannelType.voice:
opts.append(loc.get('voice', False))
return any(opts)
elif type(location) is discord.PrivateChannel:
return self.settings.get('direct', default)
else: # can't log other types
return False
评论列表
文章目录