Created
February 15, 2017 14:14
-
-
Save wallabra/a6a434ac9639fa6dac08f4d708850b19 to your computer and use it in GitHub Desktop.
String reversing GusPIRC 2 thingie.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@c.global_receiver(regex=":[^\\!]+\\![^\\@]+\\@[^ ]+ PRIVMSG #([^ ]+) :|;reverse( (.+))?") | |
def reverse_string(connection, message, custom_groups): | |
if custom_groups[1] == "": | |
return "PRIVMSG #{} :Syntax: reverse <string to reverse>" | |
r = custom_groups[2] | |
if r is None: | |
return | |
r.reverse() | |
return "PRIVMSG #{} :{}: {}".format(custom_groups[0], message.message_data[0], r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment