don't die when channel.topic_setter is null

This commit is contained in:
jesopo 2019-09-17 14:14:30 +01:00
parent 8ca0d30fef
commit 92840f67ee

View file

@ -105,12 +105,15 @@ class Module(ModuleManager.BaseModule):
return servers return servers
def _channel_stats(self, channel): def _channel_stats(self, channel):
setter = None
if not channel.topic_setter == None:
setter = channel.topic_setter.nickname
return { return {
"users": sorted([user.nickname for user in channel.users], "users": sorted([user.nickname for user in channel.users],
key=lambda nickname: nickname.lower()), key=lambda nickname: nickname.lower()),
"topic": channel.topic, "topic": channel.topic,
"topic-set-at": channel.topic_time, "topic-set-at": channel.topic_time,
"topic-set-by": channel.topic_setter.nickname, "topic-set-by": setter,
"modes": channel.mode_str() "modes": channel.mode_str()
} }
@utils.hook("api.get.channels") @utils.hook("api.get.channels")