Thread: IRC Bot

  1. #1
    Registered User eam's Avatar
    Join Date
    Oct 2003
    Posts
    53

    IRC Bot

    Does anyone have an IRC bot written in C++ that I could look at? I'm trying to make one but I'm not getting anywhere with it.

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well have you read this yet?
    ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt

    I'm assuming that you've reached the stage where you can send and receive network messages.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User eam's Avatar
    Join Date
    Oct 2003
    Posts
    53
    I'm assuming that you've reached the stage where you can send and receive network messages.
    That's the part I'm having trouble with. I could get the bot to start connecting but I can't seem to send anything to the server no matter what I try. I've read two tutorials so don't just paste a link to one please. I really learn better by looking at working examples. I couldn't find any code for simple bots on google though.

    All I need is code that connects and then maybe joins a channel or something. I think I could figure it out from there...

    Oh, and yeah I've read some of ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User eam's Avatar
    Join Date
    Oct 2003
    Posts
    53
    I said no tutorials

    I want some code, if you don't have any don't post.

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >I want some code,
    Then write some, and post it here when you have troubles. We'd like to help, but most people only do so when shown that you've attempted on your own first.

    Also, our friend Google will undoubtably know where some source code is...

    My recommendation: Break your problem down into bite-sized chunks, get each chuck working, and post it here when you can't.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Registered User eam's Avatar
    Join Date
    Oct 2003
    Posts
    53
    I just asked if someone knew where I could get a sample IRC bot. I didn't beg for one to be made for me. If no one knows about one, fine. And I said I tried google.

    But I'm made some progress. It stops are pong though. Here is my code for it. It just stops, no response from the server, and no error until I get disconnected for a ping timeout.

    Code:
    sprintf(msg,"PONG :%c%c%c%c%c%c%c%c%c%c",
     buf[i+6], buf[i+7], buf[i+8], buf[i+9], buf[i+10], buf[i+11], buf[i+12],buf[i+13],13,10);
    
    printf("\n\n--> %s",msg);
    
    if (send(sockfd, msg, strlen(msg) + 1, 0) == -1) {
    perror("send");
    exit(1);
    }
    Last edited by eam; 07-05-2004 at 09:44 PM.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well that's because you should be sending a "PING"
    You send a PING, the server at the other end sends a "PONG"

    Oh, and get http://www.ethereal.com/
    It will allow you to compare message trafffic your real IRC client generates, and the traffic your bot generates.

    > I just asked if someone knew where I could get a sample IRC bot
    Oh there's plenty of code - whether any of it is of the required simplicity is another matter.
    Google "irc source code" for example.
    A bot is simply a client without a user interface IMO
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User eam's Avatar
    Join Date
    Oct 2003
    Posts
    53
    No, I'm replying to the server's PING with a PONG. I used putty and entered all the exact stuff my code does and I connected. It has to be a problem in code...

    And you don't need to teach me how to use google. I know how. I searched for a long time before I even thought about posting here. Google didn't find what I needed, so I asked if anyone could show me where to get it. Telling me to go back to google does not help me...

  10. #10
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Apparently you need not only a lesson on how to use google, but an attitude adjustment.

    http://www.google.com/search?num=30&...va&btnG=Search

    http://virtus.ath.cx/elendil/index.php?sec=dl

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well the usual thing to do when it "doesn't work" is to post something approaching a complete program which doesn't work so we can all see exactly what you are doing.

    That is, after you've cut out as much irrelevant detail which has no bearing on the bit which doesn't work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Design guidelines advice - IRC Bot class
    By IceDane in forum C# Programming
    Replies: 2
    Last Post: 12-05-2008, 01:21 AM
  2. Need some help with making irc bot
    By kazz in forum C++ Programming
    Replies: 6
    Last Post: 11-23-2007, 11:47 AM
  3. IRC, reading the stream
    By Iyouboushi in forum C# Programming
    Replies: 6
    Last Post: 08-03-2006, 05:34 PM
  4. Whats wrong with my IRC Bot??
    By peradox in forum Networking/Device Communication
    Replies: 8
    Last Post: 05-23-2005, 05:16 PM