mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Topic: allow specifying a commalist of topic numbers in 'remove'
This commit is contained in:
parent
f4425de7c5
commit
e09f2ed815
@ -461,10 +461,10 @@ class Topic(callbacks.Plugin):
|
||||
rest(('topic', False))])
|
||||
|
||||
@internationalizeDocstring
|
||||
def remove(self, irc, msg, args, channel, number):
|
||||
"""[<channel>] <number>
|
||||
def remove(self, irc, msg, args, channel, numbers):
|
||||
"""[<channel>] <comma separated list of numbers>
|
||||
|
||||
Removes topic <number> from the topic for <channel> Topics are
|
||||
Removes topics <numbers> from the topic for <channel> Topics are
|
||||
numbered starting from 1; you can also use negative indexes to refer
|
||||
to topics starting the from the end of the topic. <channel> 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):
|
||||
|
Loading…
Reference in New Issue
Block a user