forked from zgrep/happybot
zgrep
8b6c9697e0
The Earth revolves around the God. The God gives you a world full of viral diseases. You curse God. You revolve around God. God revolves around a door. The door opens. This is going nowhere, you can stop reading now. I said you could stop. Okay, that's it, I'm really ending it now.
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
|
|
special = {
|
|
'heart': '\u2764',
|
|
'zwsp': '\u200b',
|
|
}
|
|
|
|
colors = {name: code for code, *names in map(str.split, '''
|
|
00 white w
|
|
01 black b
|
|
02 blue navy navyblue
|
|
03 green
|
|
04 red 05 brown maroon
|
|
06 purple
|
|
07 orange olive
|
|
08 yellow
|
|
09 lightgreen lime
|
|
10 teal greenbluecyan
|
|
11 lightcyan cyan aqua
|
|
12 lightblue royalblue royal
|
|
13 pink lightpurple fuchsia
|
|
14 grey gray
|
|
15 lightgrey lightgray silver
|
|
99 default
|
|
'''.strip().split('\n')) for name in names}
|
|
|
|
from sys import argv
|
|
chan = argv[1]
|
|
output = ''
|
|
for arg in argv[2:]:
|
|
try:
|
|
if arg[0] == '-':
|
|
arg = arg[1:]
|
|
if arg[0] == '-':
|
|
output += arg
|
|
elif arg in special:
|
|
output += special[arg]
|
|
elif arg[0] == 'x':
|
|
output += chr(int(arg[1:]))
|
|
elif ',' in arg:
|
|
a, b = arg.split(',')
|
|
output += '\x03' + colors[a] + ',' + colors[b]
|
|
else:
|
|
output += '\x03' + colors[arg]
|
|
else:
|
|
output += arg
|
|
except:
|
|
continue
|
|
|
|
with open('/home/zgrep/offtopiabday/irc.freenode.net/' + chan + '/in', 'w') as fh:
|
|
fh.write(output + '\n')
|