Jabber/XMPP conference bot & framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
brathuhn/modules/active/upsidedown.py

27 lines
761 B

import brathuhn
# -*- coding: utf-8 -*-
TEXT=u"ABCDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
text=u"zʎxʍʌnʇsɹbdouɯlʞɾᴉɥƃɟǝpɔqɐZ⅄XMΛ∩┴SɹQԀOW˥ʞſIHפℲƎpƆq∀"[::-1]
assert(len(TEXT)==len(text))
upside_down = {}
for i in xrange(len(TEXT)):
T,t = TEXT[i],text[i]
upside_down[T]=t
def turn(s):
ret = u""
for c in s:
if c in upside_down:
ret = upside_down[c] + ret
else:
ret = " " + ret
return ret
def upside_down_func(msg,args):
if len(args)!=2:
brathuhn.sendMsg(brathuhn.ROOM,"Usage: "+args[0]+" text",'groupchat')
brathuhn.sendMsg(brathuhn.ROOM, turn(args[1]) ,'groupchat')
brathuhn.addCommand("upsidedown","Usage: !upsidedown text",upside_down_func)