xtcanything
Hello does anyone have a source of a small irc bot written in c++. All I need for it to do is connect to irc server and join channel. I need the source as an example and to practice c++. Thanks.
Tyrano
how about you use eggdrop and then create your own TCL script for your bot.
StreetZone_
bleh .... i need a eggdrop or a bnc =) ..... heheh ....but yeah ......use a eggdrop for scripts =) ...very good ....
sevenvirtues
try racbot.org

mod version of eggdrop.
very easy. can be insatlled as hidden and run as service.
so you dont need to start your bot casue it starst automatically..thats if youdont have a 24/7 connection

thanks
niko.noname
To connect to irc network use the following code-snippet ..
you can also search google for keywords "irc bot skeleton filetype:c"

I can't give you my bot, because it has a lot of functions i won't share ;o)
It's based on an irc-bot skeleton, but I don't have any link for you. Try
google with the keywords i mentioned, i found it there.

Have fun!

CODE

int irc_connect() {
struct sockaddr_in addr;
char *buffer = malloc(256);
char *botname = malloc(256);

addr.sin_addr.s_addr = inet_addr(host_addr(irc_serv));
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short)irc_port);
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
sprintf(buffer, "USER %s . . :%s\r\nNICK %s\r\n\0", botname, BOT_VERSION, botname);
send(sock, buffer, strlen(buffer), 0);
#ifdef DEBUG_MODE
printf("<- %s\n", buffer);
#endif
sprintf(buffer, "JOIN %s\r\n\0", irc_chan);
send(sock, buffer, strlen(buffer), 0);
#ifdef DEBUG_MODE
printf("<- %s\n", buffer);
#endif
return 0;
}
CereBrums
Oh... Good old bots! wink.gif
I've also finished working on mine about a month ago...
So far so good...

By the way...
This:
CODE
int irc_connect() {
struct sockaddr_in addr;
char *buffer = malloc(256);
char *botname = malloc(256);

addr.sin_addr.s_addr = inet_addr(host_addr(irc_serv));
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short)irc_port);
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
sprintf(buffer, "USER %s . . :%s\r\nNICK %s\r\n\0", botname, BOT_VERSION, botname);
send(sock, buffer, strlen(buffer), 0);
#ifdef DEBUG_MODE
printf("<- %s\n", buffer);
#endif
sprintf(buffer, "JOIN %s\r\n\0", irc_chan);
send(sock, buffer, strlen(buffer), 0);
#ifdef DEBUG_MODE
printf("<- %s\n", buffer);
#endif
return 0;
}

Won't work...
It will connect to server.
but there are lots of thing to do after that,
such as: Ping Response, Changing Nicks if the nick is taken and so on..
I suggest you to learn to connect to an IRC server by Telnet,
and then You'll understand how to do it right!

Hope i helped...
niko.noname
This code snippets works as requested. I only wrote him what he wanted, just connection to irc-server and join a channel. for the whole code he should search for irc bot skeleton in google. ;-)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.