IRC Bots don't connect [+REP]
#1

Hey guys,
I'm using IRC bots to log my server but for some reason some of the bots do not login into the channel.
I'm using 6 bots at the moment when only 2 are online at a time. Here are some of the scripts


PHP код:
OnGameModeInit()
{
echo_Init();
/... 
Publics and whatnot:
PHP код:
forward echo_Init();
public 
echo_Init()
{
    if(
TEST_MODE == 0)
    {
        
SetTimerEx("9Delay"5000"d"1); // Connect the first bot with a delay of 2 seconds
        
SetTimerEx("IRC_ConnectDelay"7500"d"2); // Connect the second bot with a delay of 3 seconds
        
SetTimerEx("IRC_ConnectDelay"10000"d"3);
        
SetTimerEx("IRC_ConnectDelay"12500"d"4);
        
SetTimerEx("IRC_ConnectDelay"15000"d"5);
        
SetTimerEx("IRC_ConnectDelay"17500"d"6); // Connect the second bot with a delay of 4 seconds
    
}
    
gGroupID IRC_CreateGroup(); // Create a group (the bots will be added to it upon connect)
}
forward echo_Exit();
public 
echo_Exit()
{
    
IRC_Quit(gBotID[0], "TEST->> www.TEST.com"); // Disconnect the first bot
    
IRC_Quit(gBotID[1], "TEST->> www.TEST.com"); // Disconnect the second bot
    
IRC_Quit(gBotID[2], "TEST->> www.TEST.com"); // Disconnect the second bot
    
IRC_Quit(gBotID[3], "TEST->> www.TEST.com");
    
IRC_Quit(gBotID[4], "TEST->> www.TEST.com");
    
IRC_Quit(gBotID[5], "TEST->> www.TEST.com");
    
IRC_DestroyGroup(gGroupID); // Destroy the group
}
forward IRC_ConnectDelay(tempid);
public 
IRC_ConnectDelay(tempid)
{
    switch (
tempid)
    {
        case 
1:
        {
            
gBotID[0] = IRC_Connect(IRC_SERVERIRC_PORTBOT_1_MAIN_NICKNAMEBOT_1_REALNAMEBOT_1_USERNAME);
        }
        case 
2:
        {
            
gBotID[1] = IRC_Connect(IRC_SERVERIRC_PORTBOT_2_MAIN_NICKNAMEBOT_2_REALNAMEBOT_2_USERNAME);
        }
        case 
3:
        {
            
gBotID[2] = IRC_Connect(IRC_SERVERIRC_PORTBOT_3_NICKNAMEBOT_3_REALNAMEBOT_3_USERNAME);
        }
                case 
4:
        {
            
gBotID[3] = IRC_Connect(IRC_SERVERIRC_PORTBOT_4_NICKNAMEBOT_4_REALNAMEBOT_4_USERNAME);
        }
                case 
5:
        {
            
gBotID[4] = IRC_Connect(IRC_SERVERIRC_PORTBOT_5_NICKNAMEBOT_5_REALNAMEBOT_5_USERNAME);
        }
                case 
6:
        {
            
gBotID[5] = IRC_Connect(IRC_SERVERIRC_PORTBOT_6_NICKNAMEBOT_6_REALNAMEBOT_6_USERNAME);
        }
    }
    return 
1;
}
/*
    The IRC callbacks are below. Many of these are simply derived from parsed
    raw messages received from the IRC server. They can be used to inform the
    bot of new activity in any of the channels it has joined.
*/
public IRC_OnConnect(botid)
{
    
printf("*** IRC_OnConnect: Bot ID %d connected!"botid);
    
SetTimerEx("IRC_JoinDelay"10000"d"botid);
    
IRC_JoinChannel(botidIRC_CHANNEL"TEST");
    
IRC_JoinChannel(botidIRC_IDLE);
    
IRC_JoinChannel(botidIRC_LIVE"TEST");
    
IRC_JoinChannel(botidIRC_CMD"TEST");
    
IRC_JoinChannel(botidIRC_DMG"TEST");
    
IRC_AddToGroup(gGroupIDbotid); // Add the IRC bot to the group
    
return 1;
}
forward IRC_JoinDelay(botid);
public 
IRC_JoinDelay(botid)
{
    
IRC_JoinChannel(botidIRC_CHANNEL"TEST");
    
IRC_JoinChannel(botidIRC_IDLE);
    
IRC_JoinChannel(botidIRC_LIVE"TEST");
        
IRC_JoinChannel(botidIRC_CMD"TEST");
        
IRC_JoinChannel(botidIRC_DMG"TEST");
}
/*
    Note that this callback is executed whenever a current connection is closed
    OR whenever a connection attempt fails. Reconnecting too fast can flood the
    IRC server and possibly result in a ban. It is recommended to set up
    connection reattempts on a timer, as demonstrated here.
*/
public IRC_OnDisconnect(botid)
{
//    printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
    
if (botid == gBotID[0])
    {
        
SetTimerEx("IRC_ConnectDelay"10000"d"1); // Wait 10 seconds for the first bot
    
}
    else if (
botid == gBotID[1])
    {
        
SetTimerEx("IRC_ConnectDelay"15000"d"2); // Wait 15 seconds for the second bot
    
}
    else if (
botid == gBotID[2])
    {
        
SetTimerEx("IRC_ConnectDelay"20000"d"3); // Wait 15 seconds for the third bot
    
}
        else if (
botid == gBotID[3])
    {
        
SetTimerEx("IRC_ConnectDelay"25000"d"4); // Wait 15 seconds for the third bot
    
}
        else if (
botid == gBotID[4])
    {
        
SetTimerEx("IRC_ConnectDelay"30000"d"5); // Wait 15 seconds for the third bot
    
}
     else if (
botid == gBotID[5])
    {
        
SetTimerEx("IRC_ConnectDelay"35000"d"6); // Wait 15 seconds for the third bot
    
}
//    printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
    
IRC_RemoveFromGroup(gGroupIDbotid); // Remove the IRC bot from the group
    
return 1;
}
public 
IRC_OnJoinChannel(botidchannel[])
{
    
printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!"botidchannel);
    return 
1;

Defines:
PHP код:
#define BOT_1_MAIN_NICKNAME "[1]TEST"
#define BOT_1_NICKNAME "[1]TEST"
#define BOT_1_REALNAME "[1]TEST" // This is the name that will only be visible in a whois
#define BOT_1_USERNAME "[1]TEST" // This will be in front of the hostname (username@hostname)
#define BOT_1_ALTERNATE_NICKNAME "[1]TEST"
#define BOT_2_MAIN_NICKNAME "[2]TEST"
#define BOT_2_REALNAME "[2]TEST"
#define BOT_2_USERNAME "[2]TEST"
#define BOT_2_ALTERNATE_NICKNAME "[2]TEST"
#define BOT_2_NICKNAME "[2]TEST"
#define BOT_3_MAIN_NICKNAME "[3]TEST"
#define BOT_3_NICKNAME "[3]TEST"
#define BOT_3_REALNAME "[3]TEST"
#define BOT_3_USERNAME "[3]TEST"
#define BOT_3_ALTERNATE_NICKNAME "[3]TEST"
#define BOT_4_MAIN_NICKNAME "[4]TEST"
#define BOT_4_NICKNAME "[4]TEST"
#define BOT_4_REALNAME "[4]TEST"
#define BOT_4_USERNAME "[4]TEST"
#define BOT_4_ALTERNATE_NICKNAME "[4]TEST"
#define BOT_5_MAIN_NICKNAME "[5]TEST"
#define BOT_5_NICKNAME "[5]TEST"
#define BOT_5_REALNAME "[5]TEST"
#define BOT_5_USERNAME "[5]TEST"
#define BOT_5_ALTERNATE_NICKNAME "[5]TEST"
#define BOT_6_MAIN_NICKNAME "[6]TEST"
#define BOT_6_NICKNAME "[6]TEST"
#define BOT_6_REALNAME "[6]TEST"
#define BOT_6_USERNAME "[6]TEST"
#define BOT_6_ALTERNATE_NICKNAME "[6]TEST"
#define IRC_SERVER "irc.opera.com"
#define IRC_PORT 6667
#define IRC_CHANNEL "#TEST.echo"
#define IRC_IDLE "#TEST"
#define IRC_LIVE "#TEST.live"
#define IRC_CMD "#TEST.cmd"
#define IRC_DMG "#TEST.dmg" 
+REPing the helpers
Reply
#2

You'll probably find the IRC server you use is not accepting more than 2 connections per IP.

Many IRC networks don't like having too many clones from one address.


Someone may know for sure if what I am saying is correct on the network you provided. (irc.opera.com)

You may want to mind out too as that network doesn't allow bots.

irc.tl is the general go-to for this situation, but also, do you REALLY NEED _6_ bots...
Reply
#3

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
You'll probably find the IRC server you use is not accepting more than 2 connections per IP.

Many IRC networks don't like having too many clones from one address.


Someone may know for sure if what I am saying is correct on the network you provided. (irc.opera.com)

You may want to mind out too as that network doesn't allow bots.

irc.tl is the general go-to for this situation, but also, do you REALLY NEED _6_ bots...
Ty
It works fine after changing a network. Hmm, another quick question:
Is there a way to log the chats even if I'm offline ?
Reply
#4

Quote:
Originally Posted by Amit1998
Посмотреть сообщение
Ty
It works fine after changing a network. Hmm, another quick question:
Is there a way to log the chats even if I'm offline ?
You Mean admin logs?
Reply
#5

There's a couple of ways to do that.

People usually use IRC Bouncers, but you could just have mIRC running, constantly connected.

Another thing to beware of, is that you should put an IRC Bot in there (Eggdrop, or Services bot), even just to control your channel so no-one takes it over.

Register your username with the services bot, then register your channel, register your bots, give them op/voice on your channel via the services bots, and yea.


You'll need to make the bots login to services once they are connected.


It all depends on what the network has. But to log it directly, you'd more likely benefit from the IRC Bouncer, but it'd be cheaper, and easier to just use mIRC with Services login for yourself.
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
There's a couple of ways to do that.

People usually use IRC Bouncers, but you could just have mIRC running, constantly connected.

Another thing to beware of, is that you should put an IRC Bot in there (Eggdrop, or Services bot), even just to control your channel so no-one takes it over.

Register your username with the services bot, then register your channel, register your bots, give them op/voice on your channel via the services bots, and yea.


You'll need to make the bots login to services once they are connected.


It all depends on what the network has. But to log it directly, you'd more likely benefit from the IRC Bouncer, but it'd be cheaper, and easier to just use mIRC with Services login for yourself.

Hmm the bots fail to connect now and this got printed on the console:
[02:58:40] *** IRC Plugin: Could not resolve server address (No space left on device)
Reply
#7

That's a resolution issue.

Check the irc server address. From searching I found one other that showed this. When you connect to "irc.whatever.com", you're getting put to a more local IRC server. If you find that node and use a direct connect to it, that may help it.


You may benefit from re-writing the code and focusing on simply 2 bots, in 2 channels. 1 being an admin channel, 1 being a user channel.

Just from scratch and knowing what you know now.
Reply
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
That's a resolution issue.

Check the irc server address.


You may benefit from re-writing the code and focusing on simply 2 bots, in 2 channels. 1 being an admin channel, 1 being a user channel.
It works fine on my localhost o-o

PHP код:
#define IRC_SERVER "irc.foonetic.net"
#define IRC_PORT 6667 
Reply
#9

Works fine on the localhost because it is simply connecting to the same address. It's not being forwarded to another node.

Some networks show their nodelists and that could help you select a better, closer one to you.

on foonetic.com it says about anchor.foonetic.com being in the UK. There are 3 others in the US.

Try anchor.
Reply
#10

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Works fine on the localhost because it is simply connecting to the same address. It's not being forwarded to another node.

Some networks show their nodelists and that could help you select a better, closer one to you.

on foonetic.com it says about anchor.foonetic.com being in the UK. There are 3 others in the US.

Try anchor.
I'm getting a new error:
[03:14:11] *** IRC Plugin: Could not resolve server address (Success)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)