PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Sep 22, 2017 8:32 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Fri Apr 02, 2004 11:30 am 
Offline
Tutorials Group

Joined: Sun Jan 04, 2004 11:30 pm
Posts: 2692
kettle_drum wrote:
In the class constructor set_time_limit(0); means that the script wont timeout by itself due to a maximum execution time (usually 30 seconds). Hope that answers whoevers question that was.

Aha.

So it *is* a persistently running script. Some (most?) virtual hosting companies disable the ability to do set_time_limit. Further, running the script persistently would generally only be usable via CLI.. web browsers close.

kettle_drum wrote:
The other thing is that the bot sometimes disconnects unexpectely if you run if from a browser - but works A LOT better if you run it from a shell/cli.

I would bet its not so unexpected - web has TTL's, and other issues and if the script missed it JUST ONCE, it would time out. So yeah, you'd need to run it from a shell/cli. Since many people don't have that capability, thats why I asked how it worked..

I didn't understand that part, and now I do. Different fundamental assumptions.

kettle_drum wrote:
And finally, im currently updating this bot to make it bigger and better by using modules - so that a framework bot can be made to do whatever you like by adding other modules to it e.g. chanserv, nickserv, operserv, logging, newsserv, search etc - and by adding a "fake stack" to queue commands/processes so it runs like it uses threads and so speeds it up and keeps a constant flow of data coming in through the socket connection - which also helps to ensure that it never pings out, tests so far have had it online for just over 2 days with no interruptions.

Ill keep you posted as to the arrival of the new one incase anybody wants to have a play with it.

I definitely would. While I don't think its appropriate/perfect for all needs, I see signifigant value in it. :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 12:14 pm 
Offline
Forum Contributor

Joined: Tue May 25, 2004 4:28 pm
Posts: 234
Quote:
[13:13:05] -NiceGuyIRCbot- You must be a level 2 user to use this command.


umm how do i get level 2? its my bot..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 12:22 pm 
Offline
DevNet Resident

Joined: Sun Jul 20, 2003 9:25 pm
Posts: 1150
Location: West Yorkshire, England
You set it in the database:

#holds access details to the bots controls
CREATE TABLE access (
user varchar(20) NOT NULL,
level tinyint(1) NOT NULL default '1',
channel varchar(255) NOT NULL,
server varchar(255) NOT NULL
);

First set yourself as level 9, and then you can use the !adduser command.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 2:44 pm 
Offline
Forum Newbie

Joined: Tue Aug 10, 2004 2:44 pm
Posts: 1
There is a designers flaw in the message parsing engine within the core engine, namely this:
Syntax: [ Download ] [ Hide ]
$message = str_replace("$params[2]", "", $message);

This will replace every instance of the word, same as channel or user (wasn't tested on user) with null... Not good... It's better to use
Syntax: [ Download ] [ Hide ]
$message = substr($message,strlen($params[2]));


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 8:55 am 
Offline
Forum Newbie

Joined: Sun Oct 10, 2004 8:36 am
Posts: 7
Just wanted to thank you for that link in your weather function, it was very useful to me. ;)


Top
 Profile  
 
 Post subject: Great!!
PostPosted: Tue Nov 09, 2004 1:12 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 1:05 am
Posts: 53
Wow, this is great.. worked first time and a great base to start messing with PHP bots from IRC.

Couple of questions...

1. Has anyone worked on this - any updates anywhere, or other sites/projects that might be useful for IRC bots?

2. I PMed the author about this, but would like other feedback: when I do !help in channel, the bot messages me the help fine, but it does it at about 1 line per second - and I can't see why that would be from the code.. anyone suggest why it does this? It's not lag, i'm on a single IRC server, and other commands, e.g. !weather pop back their result immediately.

Thanks for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2004 4:10 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 1:05 am
Posts: 53
Just in case anyone's reading this thread, there's a PEAR IRC class called Net_SmartIRC that pretty much makes writing your own PHP IRC class re-inventing the wheel - it does everything I need from a PHP class at the moment and is probably a good base to start from if you need a class to do something else.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 27, 2004 2:39 pm 
Offline
Forum Contributor
User avatar

Joined: Fri Aug 01, 2003 7:40 pm
Posts: 115
Location: Sask, Regina
Does anyone know of any good tutorials on making bots with PHP?

I cant seem to find any.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 27, 2004 3:38 pm 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 1:05 am
Posts: 53
See my previous post ( !!! ) , RTFM for that and you'll be all set to make your own IRC bot.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 27, 2004 4:29 pm 
Offline
DevNet Master

Joined: Thu Jan 30, 2003 9:26 pm
Posts: 2893
Location: Glasgow, Scotland
I believe genetix was asking for some tutorials rather than IRC classes. That may well be a very useful link but telling someone to RTFM is a bit too strong.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 27, 2004 6:19 pm 
Offline
DevNet Resident

Joined: Sun Jul 20, 2003 9:25 pm
Posts: 1150
Location: West Yorkshire, England
When i wrote this bot I couldnt find any tutorials and so just wrote it checking with the RFC to see what the protocol was. Once you have the connection done then it is very simple to interact with an IRC server - just have a play about, try and look at the RFC and see how things are done in the source code to this bot....if you can work your way through the mess.

To help you out a bit ive cleaned the basic code used to connect the bot up and put it into a more simple class to deal with getting the bot connected to the server - you just need to provide a loop for it to run in and then parse the response from the IRC server as you like - you can find the class here:

http://www.redvodkajelly.com/code/5

Again its nothing special, but it will help you get on the right tracks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 28, 2004 4:24 am 
Offline
Forum Commoner

Joined: Tue Nov 09, 2004 1:05 am
Posts: 53
Yeah sorry, RTFM was a bit strong for that, I meant 'rtm', as the docs for Net_SmartIRC include a lot of very useful pretty easy to understand and tweak examples, which would get you going pretty quick. A simple 'bot' that actually does something is 10 lines of code with Net_SmartIRC, so it's very easy to get going.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 08, 2005 6:22 am 
Offline
Forum Newbie

Joined: Sat Jan 08, 2005 6:13 am
Posts: 3
Unfortunatly this IRC bot is incompatable with the common UnrealIRCD IRC server but could be made to work by changing the simple pong reply to a "PONG".substr($msg,6)

as UnrealIRCD sends ping 98590mf and you must reply back pong 98590mf


Top
 Profile  
 
 Post subject: Re: PHP IRC Bot Class
PostPosted: Sat Jun 21, 2008 2:02 pm 
Offline
Forum Newbie

Joined: Sat Jun 21, 2008 2:00 pm
Posts: 1
hm, trying to use the phpurple extension, has anyone already expierienced it?

http://thinker.rubay.de/archives/20-PHP ... l#extended


Top
 Profile  
 
 Post subject: Re: PHP IRC Bot Class
PostPosted: Wed Oct 15, 2008 12:27 am 
Offline
Forum Newbie

Joined: Wed Oct 15, 2008 12:20 am
Posts: 2
this is awesome :)
I'm a former mIRC scripter that finaly decided to move on to php, so the first logical step was to make a php irc bot :]
I've found this tutorial and it was pretty basic and easy to understand, but i have a problem now.
the bot connects and echoes all that is being said in channel, but if i refresh bot.php page in my browser, it gets stuck and bot dies.
so i was wondering how to fix this algorhytm :
Syntax: [ Download ] [ Hide ]
accessing bot.php via browser
if (bot is already connected to server) {
   just start displaying echo msgs from server
}
else {
   connect to irc server
   start echoing msgs from server
}


now, i've noticed that this is quite old thread, so I dont rly know will some1 answer, but it would be great to get some help :)
thanx in advance :]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group