From 5871cfde9e0e64a3e5c1c6536393c3225c340fe5 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Tue, 29 Nov 2016 04:18:01 +0000 Subject: [PATCH] Added 666 support, memes. Tweaked runloop --- TrueScrollUtil.py | 23 ++++++++++++++++++++++- runloop.sh | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/TrueScrollUtil.py b/TrueScrollUtil.py index 3a7209b..adb4150 100644 --- a/TrueScrollUtil.py +++ b/TrueScrollUtil.py @@ -16,9 +16,27 @@ def handleTrueScrollMsg(slack, msg): response = "Could not parse your query. Please invoke as \"truescroll \"" else: num = m.group(1) + + brotherScroll = getBrotherScroll(num) trueScroll = getTrueScroll(num) + #Correct for 666 (thanks TREVOR) + #Offset broscroll by one if >= 666 + if int(brotherScroll) >= 666: + brotherScroll = getBrotherScroll(str(int(num) + 1)) + + #Offset truescroll in opposite direction + if int(num) > 666: + trueScroll -= 1 + + + #Memes + if int(num) == 666: + trueScroll = "spookiest" + elif "3" in num: + trueScroll = "worst" + response = "The brother with scroll {0} is in fact the {1} brother to sign\n" response += "The {2} brother to sign will have scroll {3}\n" @@ -30,14 +48,17 @@ def handleTrueScrollMsg(slack, msg): brotherNums = [str(x) for x in range(10) if (not x == 3)] trueNums = [str(x) for x in range(10)] +#Returns string def getTrueScroll(brotherScroll): return convertBase(brotherScroll, brotherNums, trueNums) +#Returns string def getBrotherScroll(trueScroll): return convertBase(trueScroll, trueNums, brotherNums) +#Returns string def convertBase(numStr, srcBaseNums, targBaseNums): #Returns int value def numberFromBase(ns, numerals): @@ -57,7 +78,7 @@ def convertBase(numStr, srcBaseNums, targBaseNums): return total - #Returns string array, each elt is the corresponding numeral + #Returns string, each elt is the corresponding numeral def numberToBase(n, numerals): if n==0: return [0] diff --git a/runloop.sh b/runloop.sh index b8b8a85..0c84cfa 100755 --- a/runloop.sh +++ b/runloop.sh @@ -6,8 +6,8 @@ while : do echo "Press [CTRL+C] to stop..." - sleep 5 - python3 WaitonBot.py sleep 1 + python3 WaitonBot.py + sleep 3 python3 CallOfTheVoid.py done