mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Converted to use generic names.
This commit is contained in:
parent
26d41dac6e
commit
62f371d848
@ -67,7 +67,7 @@ class Topic(callbacks.Privmsg):
|
|||||||
topicSeparator = ' || '
|
topicSeparator = ' || '
|
||||||
topicFormatter = '%s (%s)'
|
topicFormatter = '%s (%s)'
|
||||||
topicUnformatter = re.compile('(.*) \((\S+)\)')
|
topicUnformatter = re.compile('(.*) \((\S+)\)')
|
||||||
def addtopic(self, irc, msg, args, channel):
|
def add(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <topic>
|
"""[<channel>] <topic>
|
||||||
|
|
||||||
Adds <topic> to the topics for <channel>. <channel> is only necessary
|
Adds <topic> to the topics for <channel>. <channel> is only necessary
|
||||||
@ -90,9 +90,9 @@ class Topic(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
newTopic = formattedTopic
|
newTopic = formattedTopic
|
||||||
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
||||||
addtopic = privmsgs.checkChannelCapability(addtopic, 'topic')
|
add = privmsgs.checkChannelCapability(add, 'topic')
|
||||||
|
|
||||||
def shuffletopic(self, irc, msg, args, channel):
|
def shuffle(self, irc, msg, args, channel):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
|
||||||
Shuffles the topics in <channel>. <channel> is only necessary if the
|
Shuffles the topics in <channel>. <channel> is only necessary if the
|
||||||
@ -106,9 +106,9 @@ class Topic(callbacks.Privmsg):
|
|||||||
random.shuffle(topics)
|
random.shuffle(topics)
|
||||||
newtopic = self.topicSeparator.join(topics)
|
newtopic = self.topicSeparator.join(topics)
|
||||||
irc.queueMsg(ircmsgs.topic(channel, newtopic))
|
irc.queueMsg(ircmsgs.topic(channel, newtopic))
|
||||||
shuffletopic = privmsgs.checkChannelCapability(shuffletopic, 'topic')
|
shuffle = privmsgs.checkChannelCapability(shuffle, 'topic')
|
||||||
|
|
||||||
def gettopic(self, irc, msg, args, channel):
|
def get(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <number>
|
"""[<channel>] <number>
|
||||||
|
|
||||||
Returns topic number <number> from <channel>. <number> is a one-based
|
Returns topic number <number> from <channel>. <number> is a one-based
|
||||||
@ -129,9 +129,9 @@ class Topic(callbacks.Privmsg):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
irc.error(msg, 'That\'s not a valid topic.')
|
irc.error(msg, 'That\'s not a valid topic.')
|
||||||
return
|
return
|
||||||
gettopic = privmsgs.channel(gettopic)
|
get = privmsgs.channel(get)
|
||||||
|
|
||||||
def changetopic(self, irc, msg, args, channel):
|
def change(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <number> <regexp>
|
"""[<channel>] <number> <regexp>
|
||||||
|
|
||||||
Changes the topic number <number> on <channel> according to the regular
|
Changes the topic number <number> on <channel> according to the regular
|
||||||
@ -178,9 +178,9 @@ class Topic(callbacks.Privmsg):
|
|||||||
topics.insert(number, newTopic)
|
topics.insert(number, newTopic)
|
||||||
newTopic = self.topicSeparator.join(topics)
|
newTopic = self.topicSeparator.join(topics)
|
||||||
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
||||||
changetopic = privmsgs.checkChannelCapability(changetopic, 'topic')
|
change = privmsgs.checkChannelCapability(change, 'topic')
|
||||||
|
|
||||||
def removetopic(self, irc, msg, args, channel):
|
def remove(self, irc, msg, args, channel):
|
||||||
"""[<channel>] <number>
|
"""[<channel>] <number>
|
||||||
|
|
||||||
Removes topic <number> from the topic for <channel> Topics are
|
Removes topic <number> from the topic for <channel> Topics are
|
||||||
@ -217,7 +217,7 @@ class Topic(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
newTopic = self.topicSeparator.join(topics)
|
newTopic = self.topicSeparator.join(topics)
|
||||||
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
irc.queueMsg(ircmsgs.topic(channel, newTopic))
|
||||||
removetopic = privmsgs.checkChannelCapability(removetopic, 'topic')
|
remove = privmsgs.checkChannelCapability(remove, 'topic')
|
||||||
|
|
||||||
|
|
||||||
Class = Topic
|
Class = Topic
|
||||||
|
@ -36,27 +36,27 @@ class TopicTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
def testAddtopic(self):
|
def testAddtopic(self):
|
||||||
_ = self.getMsg('join #foo')
|
_ = self.getMsg('join #foo')
|
||||||
_ = self.getMsg(' ') # Get the WHO.
|
_ = self.getMsg(' ') # Get the WHO.
|
||||||
m = self.getMsg('addtopic #foo foo')
|
m = self.getMsg('topic add #foo foo')
|
||||||
self.assertEqual(m.command, 'TOPIC')
|
self.assertEqual(m.command, 'TOPIC')
|
||||||
self.assertEqual(m.args[0], '#foo')
|
self.assertEqual(m.args[0], '#foo')
|
||||||
self.assertEqual(m.args[1], 'foo (test)')
|
self.assertEqual(m.args[1], 'foo (test)')
|
||||||
m = self.getMsg('addtopic #foo bar')
|
m = self.getMsg('topic add #foo bar')
|
||||||
self.assertEqual(m.command, 'TOPIC')
|
self.assertEqual(m.command, 'TOPIC')
|
||||||
self.assertEqual(m.args[0], '#foo')
|
self.assertEqual(m.args[0], '#foo')
|
||||||
|
|
||||||
def testChangetopic(self):
|
def testChangetopic(self):
|
||||||
_ = self.getMsg('join #foo')
|
_ = self.getMsg('join #foo')
|
||||||
_ = self.getMsg(' ')
|
_ = self.getMsg(' ')
|
||||||
_ = self.getMsg('addtopic #foo foo')
|
_ = self.getMsg('topic add #foo foo')
|
||||||
_ = self.getMsg('addtopic #foo bar')
|
_ = self.getMsg('topic add #foo bar')
|
||||||
_ = self.getMsg('addtopic #foo baz')
|
_ = self.getMsg('topic add #foo baz')
|
||||||
self.assertRegexp('changetopic #foo -1 s/baz/biff/',
|
self.assertRegexp('topic change #foo -1 s/baz/biff/',
|
||||||
r'foo.*bar.*biff')
|
r'foo.*bar.*biff')
|
||||||
self.assertRegexp('changetopic #foo 2 s/bar/baz/',
|
self.assertRegexp('topic change #foo 2 s/bar/baz/',
|
||||||
r'foo.*baz.*biff')
|
r'foo.*baz.*biff')
|
||||||
self.assertRegexp('changetopic #foo 1 s/foo/bar/',
|
self.assertRegexp('topic change #foo 1 s/foo/bar/',
|
||||||
r'bar.*baz.*biff')
|
r'bar.*baz.*biff')
|
||||||
self.assertRegexp('changetopic #foo -2 s/baz/bazz/',
|
self.assertRegexp('topic change #foo -2 s/baz/bazz/',
|
||||||
r'bar.*bazz.*biff')
|
r'bar.*bazz.*biff')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user