Merge branch 'tildeverse' of https://tildegit.org/sose/tcircv1 into tildeverse
This commit is contained in:
commit
2ee6d29846
|
@ -0,0 +1,9 @@
|
|||
#tcircv1
|
||||
|
||||
the bots that relay in-game chat messages from the minecraft server to irc.
|
||||
|
||||
also an exercise in how not to write code.
|
||||
|
||||
please dont look at it.
|
||||
|
||||
thanks to minerobber for the color stuff.
|
|
@ -72,6 +72,14 @@ def safeint(v):
|
|||
def irc_to_mc_colors(m):
|
||||
if m.group(1)=="\x0f":
|
||||
return "\xa7r" # reset
|
||||
elif m.group(1)=="\x02":
|
||||
return "\xa7l" # bold
|
||||
elif m.group(1)=="\x1d":
|
||||
return "\xa7o" # italic
|
||||
elif m.group(1)=="\x1f":
|
||||
return "\xa7n" # underline
|
||||
elif m.group(1)=="\x1e"
|
||||
return "\xa7m" # strikethrough
|
||||
else:
|
||||
return "\xa7"+irc_mc_color_mapping.get(safeint(m.group(2)),"f")
|
||||
|
||||
|
@ -218,7 +226,7 @@ def irc_to_mc():
|
|||
response = str(fsgiven) + ' fs given.'
|
||||
irc.send(bytes('PRIVMSG ' + channel + ' :' + response + '\n', 'utf8'))
|
||||
else:
|
||||
text = re.sub("([\x03\x0f])([0-9A-Fa-f]{1,2}(?:,[0-9A-Fa-f]{1,2})?)?",irc_to_mc_colors,text)
|
||||
text = re.sub("([\x02\x03\x0f\x1d\x1e\x1f])([0-9A-Fa-f]{1,2}(?:,[0-9A-Fa-f]{1,2})?)?",irc_to_mc_colors,text)
|
||||
rcon.command('say ' + text[:-2])
|
||||
if re.search(' (f|F) .*', text) is not None:
|
||||
print('someone paid respects.')
|
||||
|
|
Loading…
Reference in New Issue