don't die when channel.topic_setter is null
This commit is contained in:
parent
8ca0d30fef
commit
92840f67ee
1 changed files with 4 additions and 1 deletions
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue