Hello! I have a bot on my site that automatically responds and has the function of sending a message:
function processMessage($message) { $message = mb_strtolower($message); if ($message === 'hi' || $message === 'hello' || $message === '/start') { return 'Hi, I am a bot . What status you want ?? For example: Love, Joke, about life, friendship'; } elseif ($message === 'love' || $message === 'about love' || $message === '/love') { $statuses = file('telegram_love.txt'); $status_id = array_rand($statuses); return trim($statuses[$status_id]); } elseif ($message === 'joke' || $message === 'about joke' || $message === '/joke') { $statuses = file('telegram_joke.txt'); $status_id = array_rand($statuses); return trim($statuses[$status_id]); } elseif ($message === 'life' || $message === 'about life' || $message === '/life') { $statuses = file('telegram_life.txt'); $status_id = array_rand($statuses); return trim($statuses[$status_id]); } elseif ($message === 'friendship' || $message === 'about friendship' || $message === '/friendship') { $statuses = file('telegram_friendship.txt'); $status_id = array_rand($statuses); return trim($statuses[$status_id]); } elseif ($message === 'about' || $message === '/about' || $message === '/info') { return "v 1.0 Developer Mail @mail @mail"; } else { return 'Or we do not have such type of status, or you make a mistake, use the fast function to find the statuses'; } } The script takes the answer from the .txt file and I want to make sure that the answers are taken from the DATABASE!
If not difficult, tell me where to start ??? Thank you in advance!