Building an IRC bot to use with Xchat

Questions about programming languages and debugging
Post Reply
User avatar
Still_Learning
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 1040
Joined: 11 Jun 2008, 16:00
15
Location: Trigger City

Building an IRC bot to use with Xchat

Post by Still_Learning »

I've tried so far on Linux Konversation, Xchat, and Xchat-gnome, my favorite out the box is Konversation but it seems to be limited in abilitys, so i went to X-chat as my main IRC program and stubled across a chanel #botwars or #robotwars or something like that , where everyone creates their own bots and would like to learn how. Xchat seems to support Python, Perl, and Thc or tlc? or something like that? for languages..


I just got back from the library and have a bunch of good books on Perl, Visual C++, XML, and Java, im thinking of making my first bot in Perl, but how is it done? Do i just code what i want it to do and add it into my perl xchat preferences? do i have to compile it? remember this is my first real programming project in like 8 years, I want to do it to learn. Also how can i run my xchat threw a irc or socks5 proxy? I really dont like logging into an irc channel with everyone seing my real IP and network adress.

I know how to do it in windows with mIRC but want to move more towards linux and anonymity on irc is important to me. I dont want everybody in the world being able to see what my address is for a hack target, any help is appriciated, thank you!

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Well, i don't know if you have been around long enough to know, but i ran a bot for a long time here on the suck-o irc server, names G7. Since i'm currently at my military training location, i don't have his code on me, but i made him in PHP. I ran it from my own computer, all you have to do is download and install php from the php.net website.

PHP and Perl are very similar languages. The structure, general syntax, code format, etc. are all basically the same. The only thing i'm not going to help you with is connecting through a proxy, because i have never done that for IRC.

http://code.suck-o.com/61

I didn't test this code directly, so there may be mistakes, but this is the skeleton code i start with whenever i create a new irc bot. Good luck.
¯\_(ツ)_/¯ It works on my machine...

User avatar
Still_Learning
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 1040
Joined: 11 Jun 2008, 16:00
15
Location: Trigger City

Post by Still_Learning »

Thanks man, i never thought of useing php as a bot code, does html work as well?, guess i need to learn more still. I am just learning X-Chat and how to use plugins and scripts with it, I have a bunch of books from the library to reference for help build a bot plus the code you helped me with. So is it safe to say that i can build a irc bot without it even being considered as a plugin for xchat or mirc or whatever? meaning i can build a bot and it doesnt even use my irc program (mirc, xchat, xchat-gnome, konersation, irssi, ect..)

Any good tutorials on how to build a good irc bot from a noob perspective? from what i understand python and perl are the best for building irc bots, but what do i know

thanks again

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Right, if you code the bot in php, perl, python, or whatever other language, it will be independent of your irc client. (unless you want to send it commands in the channel...)

Really, any language you use has it's own advantages and disadvantages. I know that with c++ you can handle simultaneous connections to the bot better than with php or perl, but php takes a lot less code to create network connections, and for a newbie, it may be easier to understand example code.

In the end, the choice is yours.
¯\_(ツ)_/¯ It works on my machine...

User avatar
Still_Learning
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 1040
Joined: 11 Jun 2008, 16:00
15
Location: Trigger City

Post by Still_Learning »

gogeta70 wrote:Right, if you code the bot in php, perl, python, or whatever other language, it will be independent of your irc client. (unless you want to send it commands in the channel...)

Really, any language you use has it's own advantages and disadvantages. I know that with c++ you can handle simultaneous connections to the bot better than with php or perl, but php takes a lot less code to create network connections, and for a newbie, it may be easier to understand example code.

In the end, the choice is yours.
I see..

I am going to make my first bot and then reply with the code in here, so everyone can chew it apart. So say my irc client supports python, perl or C++ does that mean that any "bot" or "script" i run in that language will work in the channel? unless of course theres another bot the prevents it? I need newb details, i have plenty of time to code and learn, i want to take advantage of that now while i can.thanks

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Your irc client does not have control over what programming language you use. That would be like saying visual basic programs work on windows, but not C++ programs. Basically, i mean that the programming language you use dictates the amount of time the bot will take to create, and the capabilities of the bot (somewhat). So to answer your question, your bot will work in most channels on most servers, regardless of the language you create it in.
¯\_(ツ)_/¯ It works on my machine...

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

I am so looking forward to G7 coming back...umm...wait, to gogeta coming back... :lol: :wink:
I think it'll be an easy job for you what is keeping me busy (and annoyed) since a while: a "who is on IRC" block for the site... :)

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Looks like my bot has created a reputation around here, maybe he'll be the next staff member... :lol:

Yeah, i think i actually saved the code i created for suck-o a while ago for checking who's on irc, but it's on my computer at home, which isn't a walk away, heheh. I'll see if i can't make one for you while i'm here.
¯\_(ツ)_/¯ It works on my machine...

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

no need to hurry buddy, better spend your little spare time to relax... :wink:

User avatar
Still_Learning
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 1040
Joined: 11 Jun 2008, 16:00
15
Location: Trigger City

Post by Still_Learning »

gogeta70 wrote:Looks like my bot has created a reputation around here, maybe he'll be the next staff member... :lol:

Yeah, i think i actually saved the code i created for suck-o a while ago for checking who's on irc, but it's on my computer at home, which isn't a walk away, heheh. I'll see if i can't make one for you while i'm here.
I see.. so bots serve many purpose, i had a forum bot one time with phpbb2 but it was someone elses code i just added what the responses would be and such, i am intrested more in the irc bots right now, and always thought php was more for http / forum bots, never thought of useing it for an irc bot. I will have to read ALOT more i guess.. i have been useing php with dreamweaver and always thought of it as a web page creation type language, i just got a book on perl and am trying to learn that i guess now.. but have no idea how to intergrate it with irc, i am at the point of making basic applications to do equations that someone types in and forms and such, not how to make it say "Hello" everytime someone else in the irc channel says "Hey" or kick ban anyone that says "fuck you" or whatever any links would be appricaited or perl code since thats what im trying to learn, thanks

Post Reply