RicBot Base and RicBot Google.

This is a discussion on RicBot Base and RicBot Google. within the C++ Programming forums, part of the General Programming Boards category; I started writing an IRC bot in C++ for windows XP. The name came from a typo of ircbot which ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    63

    RicBot Base and RicBot Google.

    I started writing an IRC bot in C++ for windows XP.

    The name came from a typo of ircbot which made friend made, but I liked the sound and kept it as the name.

    Didn't really know what it would do, though I had a few ideas in the TODO file, they are more like notes than actual things to do.

    Well anyway I have a base, and a version with a google search option. I thought I would post both versions as they are. People can tell me areas which are poorly done, or could be changed in some way. Or maybe make suggestions for it.

    If you want to know why I did something a certain way, or how something works just ask.

    It could do with more error checking, and it could also do with more protocol related code, currently it only checks to see if it can join a channel.

    Anyway I thought I would post them.

    TODO from the base.
    1.) Code for when windows shuts down, so the
    bot automatically closes.

    2.) Write some functions for the bot, for example.

    Channel protection bot.
    Trivia bot.
    AI bot.
    Google/News/Image search.
    MSDN search.
    IMDB search.

    3.) Code a little GUI for when the bot opens,
    saying something like "RicBot blah blah" you get the idea
    TODO from the google version
    1.) Code for when windows shuts down, so the
    bot automatically closes.

    2.) Write some functions for the bot, for example.

    Channel protection bot.
    Trivia bot.
    AI bot.
    Google/News/Image search.
    MSDN search.
    IMDB search.
    -----------------------------------------------
    Google search is almost complete, it connects to google,
    searches, retrieves all the webpage and stores it into
    a variable, then parses it. Needs more testing to be done.
    -----------------------------------------------

    3.) Code a little GUI for when the bot opens,
    saying something like "RicBot blah blah" you get the idea

    4.) Now that google search is almost complete,
    thought I would add something else to do hehe.
    How about a global time checker.
    You type !time and it gives a default time zones time,
    like for example GMT.
    But if you supply it with either a country like
    !time FR (france) it will give the time in france or
    if you supply it with something like !time UTC then
    it will use UTC time instead of GMT.

    5.) What about something a bit more cool, how about a
    translator. You supply it with 2 main arguments, and
    the other arguments are the text to be translated.

    !translate english russian Hello how are you?

    The first argument is the language you are translating from,
    the second argument is the language you are translating to.

    6.) Also what about a !define command, to define a word?
    it could use googles define:keyword

    7.)What about spell checker?
    !spell word
    it could connect to dictionary.com
    There should be less to do as it advances but oh well.

    Any type of feedback at all is appreciated.

    (incase you are wondering why it has a readfile and writefile function, well it originally wrote the data it recieved for the webpage to a HTML file called google_file.html and then the file was read, but I decided to store the data directly into a variable (not good for big pages I guess) so rather than just delete the code, I put it in 2 separate functions incase it is needed later.)

    -EDIT-
    I forgot to say, for the address of the IRC server you will have to use an IP not hostname, because it doesn't use a gethostbyname() function. I was intending on reading up on getaddrinfo() and using that, but I forgot all about it.

    Also if anybody decides to do any work on this or use large parts of it, could they put a link to this thread in the comments or readme. Thank you.
    Attached Files Attached Files
    Last edited by John_; 01-31-2006 at 02:16 PM.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    63
    I know that the GoogleSearch() function is quite large and has little/no error checking. Well I just thought if there were other functions that get data from websites and parse it, some of the code from that function could be put into separate functions and reused, like replacing some of the HTML tags for example.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    63
    I have added a translation feature which uses bablefish.

    This code is attached.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    63
    Changes:
    This version has multithreading, it is more practical for the Translate function and google search function.

    Also if the translated text is above 300 bytes it truncates it to 300 bytes. The old version was supposed to do this, but it tried to truncate it to 350 bytes, because I was originally going to check to see if it was bigger than 350 and if it was truncate to 350. But I decided to check if it was bigger than 300 and truncate to 300, but silly me forgot to change it so it truncates to 300.
    In the translated text the characters \r and \n are replaced, so if you are translating a lot of text it will return it all, not just the first line.

    Also I have changed the commands around so that reconnect, stop and raw need auth, but version, google and translate don't. This is for security. It is recommended you use Auth aswell, so by default it is defined.
    ---------------------------------------------------

    TODO:
    Sort out the GoogleSearch() function to make it better. For example if there is no description available it could give title.
    ---------------------------------------------------

    (There is no particular reason why it is called RicBot.Translate2, it isn't version 2, it has a lot of work to go yet before it even gets to version 1.0 hehe, it is just named this, so it is not confused with the older version.)
    Attached Files Attached Files
    Last edited by John_; 02-07-2006 at 01:19 PM.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21