diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index 1419d3cc8..b48ed7bf3 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -461,10 +461,10 @@ class Topic(callbacks.Plugin): rest(('topic', False))]) @internationalizeDocstring - def remove(self, irc, msg, args, channel, number): - """[] + def remove(self, irc, msg, args, channel, numbers): + """[] - Removes topic from the topic for Topics are + Removes topics from the topic for Topics are numbered starting from 1; you can also use negative indexes to refer to topics starting the from the end of the topic. is only necessary if the message isn't sent in the channel itself. @@ -473,9 +473,15 @@ class Topic(callbacks.Plugin): capabilities = self.registryValue('requireManageCapability') irc.errorNoCapability(capabilities, Raise=True) topics = self._splitTopic(irc.state.getTopic(channel), channel) - topic = topics.pop(number) + numbers = set(numbers) + for n in numbers: + # Equivalent of marking the topic for deletion; there's no + # simple, easy way of removing multiple items from a list. + # pop() will shift the indices after every run. + topics[n] = '' + topics = [topic for topic in topics if topic != ''] self._sendTopics(irc, channel, topics) - remove = wrap(remove, ['canChangeTopic', 'topicNumber']) + remove = wrap(remove, ['canChangeTopic', commalist('topicNumber')]) @internationalizeDocstring def lock(self, irc, msg, args, channel):