用 Python 2 编写的简单 IRC(互联网中继聊天)客户端
特别感谢 Ilie Cebanu (https://github.com/NotQuiteMelvin) 的 Python 3 版本。
要使用选定的用户名加入任何频道(在 Freenode 上),只需运行 irc_client.py 并将所需的用户名作为第一个参数,后跟频道名称(带以下 # 或不带 # ):
./irc_client.py myusername channeltojoin
或者
./irc_client.py myusername #channeltojoin // actually not working :)
似乎是用下面的 # 中断脚本传递通道名称,因为 Python 将 # 视为注释的开头?
这是它现在的样子(左控制台:irc_client.py,右控制台:irssi):
我已添加编译为 Python 字节码文件(扩展名为 .pyc)的版本。编译是通过命令完成的:
$ python -m compileall irc_client.py
获取二进制版本而不是源代码可能会很有用。
多行消息不起作用(与没有其他用户发布消息时服务器没有响应有关)
输出有时会被服务器消息(如 PING)搞乱
缺乏用户体验 - 只能发送简单的一行消息:)
irc.freenode.net(服务器)和端口 6667 硬编码 - 但可以轻松添加为参数
通道名称必须在不带前导的情况下传递#
彩色输出(待定)
https://en.wikipedia.org/wiki/Internet_Relay_Chat
RFC 1459(互联网中继聊天协议)
https://tools.ietf.org/html/rfc1459
IRC 服务器响应代码参考
https://www.alien.net.au/irc/irc2numerics.html
RFC 2812(互联网中继聊天:客户端协议):
https://tools.ietf.org/html/rfc2812
其他资源:
http://chi.cs.uchicago.edu/chirc/irc_examples.html
http://books.msspace.net/mirrorbooks/irchacks/059600687X/irchks-CHP-13-SECT-2.html