Jump to content

php include


Kingy

Recommended Posts

i have recently built myself a php irc bot. in this bot are commands like `say `kick etc etc. my question is when i edit the bot.php file would there be a way for me to rehash the contents without having to kill the bot and restart it?

 

eg: the bot is running on the irc channel.. but i then edit the php file to add the command `deop, what i would then like to do is rehash the file so that the `deop command would work but without disconnecting my bot from the irc network.

 

i've been kind of thinking that maybe if i included the commands in a seperate php file called commands.php, and when the bot first connects it would include the file.. and then when i update commands.php i would just do the command `rehash and it would update. but is there anyway of unincluding the first commands.php and then just including the new one? or something along those lines.

 

I really have no idea but would appreciate any help that is given. if you dont understand any of what i just said lol ask some questions and i'll do my best to explain. I've kinda confused myself in all of this too

Link to comment
Share on other sites

not sure if i understand correctly but, say everytime you add new commands (e.g. script) then you could just overwrite the file (commands.php), the bot stores the modified date, when it's time comes it compares it's date with the file's date and if the file's is newer it then parses (prolly want a file lock in place).

 

Any Robin Hood?

Link to comment
Share on other sites

This is what I would do:

 

Have a file with commands (could be an XML file for instance). When the bot loads it would parse the file and store all the commands you can use. Then you can update the commands file and run a command to the bot (reload_commands or something like that) and the bot would parse the commands file again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.