mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Merge pull request #363 from nyuszika7h/progval-testing
Topic: Add save command. Closes GH-332.
This commit is contained in:
commit
c17d0760e6
@ -573,6 +573,24 @@ class Topic(callbacks.Plugin):
|
||||
self._sendTopics(irc, channel, topics)
|
||||
swap = wrap(swap, ['canChangeTopic', 'topicNumber', 'topicNumber'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def save(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
||||
Saves the topic in <channel> to be restored with @topic default
|
||||
later. <channel> is only necessary if the message isn't sent in
|
||||
the channel itself.
|
||||
"""
|
||||
if not self._checkManageCapabilities(irc, msg, channel):
|
||||
capabilities = self.registryValue('requireManageCapability')
|
||||
irc.errorNoCapability(capabilities, Raise=True)
|
||||
topic = irc.state.getTopic(channel)
|
||||
if topic:
|
||||
self.setRegistryValue('default', value=topic, channel=channel)
|
||||
else:
|
||||
self.setRegistryValue('default', value='', channel=channel)
|
||||
save = wrap(save, ['canChangeTopic'])
|
||||
|
||||
@internationalizeDocstring
|
||||
def default(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
Loading…
Reference in New Issue
Block a user