Kingy Posted December 22, 2007 Share Posted December 22, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82766-php-include/ Share on other sites More sharing options...
rarebit Posted December 22, 2007 Share Posted December 22, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/82766-php-include/#findComment-420975 Share on other sites More sharing options...
Kingy Posted December 22, 2007 Author Share Posted December 22, 2007 yeah that sounds like it could work.. and how exactly would i get get the modified dates and get it to recognize the fact that it has changed etc? Quote Link to comment https://forums.phpfreaks.com/topic/82766-php-include/#findComment-421003 Share on other sites More sharing options...
Daniel0 Posted December 22, 2007 Share Posted December 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/82766-php-include/#findComment-421110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.