From b4c94dea9e7b216bef3e58f47422920a742d168a Mon Sep 17 00:00:00 2001 From: sose Date: Sat, 16 Nov 2019 12:11:59 -0800 Subject: [PATCH 1/3] added readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..852ca78 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +#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. From 7a92d8c9b7ba387c3ed46d282f078227fa6d5ea0 Mon Sep 17 00:00:00 2001 From: sose Date: Sat, 16 Nov 2019 12:13:19 -0800 Subject: [PATCH 2/3] fixed spacing --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 852ca78..d7b5e8f 100644 --- a/README.md +++ b/README.md @@ -1,7 +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. From 60ed58d3b67c24282fbd5338808897afaf44d662 Mon Sep 17 00:00:00 2001 From: Robert Miles Date: Mon, 2 Dec 2019 14:02:32 -0500 Subject: [PATCH 3/3] Add bold/italic/underline/strikethrough support --- tcirc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) mode change 100755 => 100644 tcirc.py diff --git a/tcirc.py b/tcirc.py old mode 100755 new mode 100644 index 63338fe..a3097ba --- a/tcirc.py +++ b/tcirc.py @@ -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") @@ -217,7 +225,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.')