Update plugin.py

This commit is contained in:
Gordon Shumway 2020-02-17 13:16:22 -05:00 committed by GitHub
parent 5b19c86657
commit 020dbd5914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1681,69 +1681,4 @@ class TextArt(callbacks.Plugin):
irc.reply("\x031,8888\x031,8989\x031,9090\x031,9191\x031,9292\x031,9393\x031,9494\x031,9595\x031,9696\x031,9797\x031,9898\x031,9999", prefixNick=False)
codes = wrap(codes)
def rainbow(self, irc, msg, args, channel, optlist):
"""[channel] [--delay <float>] [--mode <1|2>]
Scroll a rainbow. Mode 1 squiggle. Mode 2 zig-zag.
"""
if not channel:
channel = msg.args[0]
if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'):
irc.errorNoCapability('admin')
return
self.stopped[channel] = False
optlist = dict(optlist)
if 'delay' in optlist:
delay = optlist.get('delay')
else:
delay = self.registryValue('delay', channel)
if 'mode' in optlist:
mode = optlist.get('mode')
else:
mode = 1
if mode > 2 or mode < 1:
mode = 1
if mode == 1:
indent = 10 # How many spaces to indent.
else:
indent = 0
indentIncreasing = True # Whether the indentation is increasing or not.
while True: # Main program loop.
if self.stopped[channel]:
break
line = ''
line += ' ' * indent
line += '\x034###'
line += '\x037###'
line += '\x038###'
line += '\x039###'
line += '\x0312###'
line += '\x0311###'
line += '\x036###'
if not self.stopped[channel]:
time.sleep(delay)
irc.reply(line, prefixNick=False)
if mode == 1 and random.randint(0, 1) == 0:
# Increase the number of spaces:
indent = indent + 1
if indent > 60:
indent = 60
elif mode == 1:
# Decrease the number of spaces:
indent = indent - 1
if indent < 0:
indent = 0
if mode == 2 and indentIncreasing:
# Increase the number of spaces:
indent = indent + 1
if indent == 60:
# Change direction:
indentIncreasing = False
elif mode == 2:
# Decrease the number of spaces:
indent = indent - 1
if indent == 0:
# Change direction:
indentIncreasing = True
rainbow = wrap(rainbow, [optional('channel'), getopts({'delay':'float', 'mode':'int'})])
Class = TextArt