I found this thread, started by Alhifar about a Cagebot. It was very useful to start my own script. It was obviously out of date, having not been updated in probably 10 years.

I already have a bot that can switch clans, and I've making a new chatbot was simple enough for me to do.

Here's the problem I've run into.
I'm don't think I'm savvy enough to program the bot to do all the things I want. I've run into a few snags. I think the problem lies in the fact that I use preferences in a lot of places.

PHP Code:
    if(contains_text(to_lower_case(message), "cage" ))  
        {
        if(
get_property("cage_bot_running") == true)
            {
            
chat_private(sender"I'm sorry, I'm in someone elses cage right now.  So sad and lonely.");
            return;
            }
        if (
get_property("you_asked") == sender)
            {
            
set_property("I_sent_you_to_the_cage"sender);
            
chat_private(sender"I see you asked for my status first.  Now I will help with your cage.");
            
chat_private(sender"I will now jump into your clan, and become cagebait for 2 hours.  You alone have the power to release me.");
            
set_property("sender"sender);
            
set_property("message"message);
            
cli_execute("call dreadloader.ash");
            return;
            }
        if (
get_property("you_asked") != sender)
            {
            
chat_private(sender"You must ask for my STATUS first.  Then you may put me in a cage.  This is a requirement.");
            return;
            }
        } 
This is just a sample of the code I'm using. There's at least 4 different properties that are set, or looked at in this code.

dreadloader.ash looks at a lot of properties, and sends the bot to where it's supposed to go.

I have the bot set to stay in the clan for up-to 2 hours. It checks every 10 minutes to see if it's been freed, and then reminds the player via PM that it's waiting every 30 minutes. If the 2 hour limit is reached, it will chew, and head home. I've run into issues where the bot doesn't chew, or return to it's home clan when it's supposed to.

Is there a better way to do this that isn't hard to learn? I've done the best I can with what I know how to do. I'm also willing to share more code if what I've given isn't enough.