Skip to content

Commit eb05fa8

Browse files
authored
Merge pull request CloudBotIRC#183 from linuxdaemon/gonzobot+fix-flip
Fix random 'None' response in flip.fix
2 parents 3b2d92b + 2ae87bf commit eb05fa8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

plugins/flip.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
'[': ']',
4343
'{': '}',
4444
'\'': ',',
45-
'_': '‾'}
45+
'_': '‾',
46+
}
4647

4748
# append an inverted form of replacements to itself, so flipping works both ways
4849
replacements.update(dict((v, k) for k, v in replacements.items()))
@@ -54,8 +55,6 @@
5455
@hook.command
5556
def flip(text, reply, message, chan):
5657
"""<text> - Flips <text> over."""
57-
global table_status
58-
# table_status = defaultdict(False)
5958
if USE_FLIPPERS:
6059
if text in ['table', 'tables']:
6160
message(random.choice([random.choice(flippers) + " ︵ " + "\u253B\u2501\u253B", table_flipper]))
@@ -72,7 +71,7 @@ def flip(text, reply, message, chan):
7271
reply(formatting.multi_replace(text[::-1], replacements))
7372

7473

75-
@hook.command(autohelp=False)
74+
@hook.command
7675
def table(text, message):
7776
"""<text> - (╯°□°)╯︵ <ʇxǝʇ>"""
7877
message(random.choice(flippers) + " ︵ " + formatting.multi_replace(text[::-1].lower(), replacements))
@@ -83,10 +82,9 @@ def fix(text, reply, message, chan):
8382
"""<text> - fixes a flipped over table. ┬─┬ノ(ಠ_ಠノ)"""
8483
global table_status
8584
if text in ['table', 'tables']:
86-
if table_status[chan] is True:
85+
if table_status.pop(chan, False) is True:
8786
message("┬─┬ノ(ಠ_ಠノ)")
88-
table_status[chan] = False
8987
else:
9088
message("no tables have been turned over in {}, thanks for checking!".format(chan))
9189
else:
92-
message(flip(text, reply, message, chan))
90+
flip(text, reply, message, chan)

0 commit comments

Comments
 (0)