UnrealIRCd 上的 IRC Bot 问题
IRC Bot problems on UnrealIRCd
我一直在用 C# 开发机器人(使用 Amrykid.Web.IRC 库——我知道它有问题,但这与它无关——我想)
而我运行今天遇到了小问题
当我尝试加入 localhost IRC (unrealircd 4) 时,它在日志中给我这个(用户加入服务器但没有加入频道)
:cisco.1337 NOTICE * :*** Looking up your hostname...
:cisco.1337 NOTICE * :*** Found your hostname
PING :9574792D
PONG :9574792D
:cisco.1337 451 MODE :You have not registered
:cisco.1337 451 JOIN :You have not registered
:cisco.1337 001 NoNameService :Welcome to the Cisco Localhost IRC Network NoNameService!NoNameServ@localhost
当我尝试加入 'irc.freenode.net' 时,一切都成功了,用户加入了频道
:weber.freenode.net NOTICE * :*** Looking up your hostname...
:weber.freenode.net NOTICE * :*** Checking Ident
:weber.freenode.net NOTICE * :*** Found your hostname
:weber.freenode.net NOTICE * :*** Got Ident response
:weber.freenode.net 001 NoNameService :Welcome to the freenode Internet Relay Chat Network NoNameService
这是我正在使用的代码(只是更改 IRCServer 字符串)
#region Server Variables
static string IRCServer = "irc.freenode.net";
static int IRCPort = 6667;
static string IRCChan = "#ciscobot";
static string _password = "adminPassword";
static string trigger = ".";
#endregion
static string nick = "NoNameService";
static IRC _irc;
static List<string> users = new List<string>();
static void Main(string[] args)
{
_irc = new IRC(nick);
_irc.Nick = nick;
_irc.Connect(IRCServer, IRCPort);
_irc.Logon(nick, nick);
_irc.Join(IRCChan);
_irc.IRCUserJoin += new IRC.IRCUserJoinHandler(_irc_IRCUserJoinHandler);
_irc.IRCUserQuit += new IRC.IRCUserQuitHandler(_irc_IRCUserQuitHandler);
_irc.IRCUserKick += new IRC.IRCUserKickHandler(_irc_IRCUserKickHandler);
_irc.IRCPrivateMSGRecieved += new IRC.IRCPrivateMSGRecievedHandler(_irc_IRCPrivateMSGRecieved);
while (true)
{
_irc.ProcessEvents(0);
}
}
我一直在搜索一整天,但我似乎找不到问题所在...
这可能与尝试使用本地 IRC 服务器上的注册帐户有关。您可以尝试不登录服务器。 Anope服务将允许您使用用户注册。
您发送命令的时间过早。 "you have not registered" 消息表示服务器不知道您是谁,但您正在尝试设置模式并加入频道。
我没有弄清楚哪里出了问题,所以我使用 SmartIrc4Net 而不是 Amrykid 的库,它可以工作...我只需要做一些更改...
我一直在用 C# 开发机器人(使用 Amrykid.Web.IRC 库——我知道它有问题,但这与它无关——我想) 而我运行今天遇到了小问题
当我尝试加入 localhost IRC (unrealircd 4) 时,它在日志中给我这个(用户加入服务器但没有加入频道)
:cisco.1337 NOTICE * :*** Looking up your hostname...
:cisco.1337 NOTICE * :*** Found your hostname
PING :9574792D
PONG :9574792D
:cisco.1337 451 MODE :You have not registered
:cisco.1337 451 JOIN :You have not registered
:cisco.1337 001 NoNameService :Welcome to the Cisco Localhost IRC Network NoNameService!NoNameServ@localhost
当我尝试加入 'irc.freenode.net' 时,一切都成功了,用户加入了频道
:weber.freenode.net NOTICE * :*** Looking up your hostname...
:weber.freenode.net NOTICE * :*** Checking Ident
:weber.freenode.net NOTICE * :*** Found your hostname
:weber.freenode.net NOTICE * :*** Got Ident response
:weber.freenode.net 001 NoNameService :Welcome to the freenode Internet Relay Chat Network NoNameService
这是我正在使用的代码(只是更改 IRCServer 字符串)
#region Server Variables
static string IRCServer = "irc.freenode.net";
static int IRCPort = 6667;
static string IRCChan = "#ciscobot";
static string _password = "adminPassword";
static string trigger = ".";
#endregion
static string nick = "NoNameService";
static IRC _irc;
static List<string> users = new List<string>();
static void Main(string[] args)
{
_irc = new IRC(nick);
_irc.Nick = nick;
_irc.Connect(IRCServer, IRCPort);
_irc.Logon(nick, nick);
_irc.Join(IRCChan);
_irc.IRCUserJoin += new IRC.IRCUserJoinHandler(_irc_IRCUserJoinHandler);
_irc.IRCUserQuit += new IRC.IRCUserQuitHandler(_irc_IRCUserQuitHandler);
_irc.IRCUserKick += new IRC.IRCUserKickHandler(_irc_IRCUserKickHandler);
_irc.IRCPrivateMSGRecieved += new IRC.IRCPrivateMSGRecievedHandler(_irc_IRCPrivateMSGRecieved);
while (true)
{
_irc.ProcessEvents(0);
}
}
我一直在搜索一整天,但我似乎找不到问题所在...
这可能与尝试使用本地 IRC 服务器上的注册帐户有关。您可以尝试不登录服务器。 Anope服务将允许您使用用户注册。
您发送命令的时间过早。 "you have not registered" 消息表示服务器不知道您是谁,但您正在尝试设置模式并加入频道。
我没有弄清楚哪里出了问题,所以我使用 SmartIrc4Net 而不是 Amrykid 的库,它可以工作...我只需要做一些更改...