//A conversation with a different name has been opened, unset the DB one and recreate a new one
return$this->exists();
$this->cancel();
returnfalse;
}
}
$this->conversation=null;
/**
returnfalse;
* Check if the conversation already exists
*
* @return bool
*/
publicfunctionexists()
{
return($this->conversation!==null);
}
}
/**
/**
* Check if a conversation has already been created in the database. If the conversation is not found, a new conversation is created. Start fetches the data stored in the database.
* Start a new conversation if the current command doesn't have one yet
@@ -140,8 +140,7 @@ CREATE TABLE IF NOT EXISTS `conversation` (
...
@@ -140,8 +140,7 @@ CREATE TABLE IF NOT EXISTS `conversation` (
`user_id`bigintNULLDEFAULTNULLCOMMENT'User id',
`user_id`bigintNULLDEFAULTNULLCOMMENT'User id',
`chat_id`bigintNULLDEFAULTNULLCOMMENT'Telegram chat_id can be a the user id or the chat id ',
`chat_id`bigintNULLDEFAULTNULLCOMMENT'Telegram chat_id can be a the user id or the chat id ',
`status`ENUM('active','cancelled','stopped')NOTNULLDEFAULT'active'COMMENT'active conversation is active, cancelled conversation has been truncated before end, stopped conversation has end',
`status`ENUM('active','cancelled','stopped')NOTNULLDEFAULT'active'COMMENT'active conversation is active, cancelled conversation has been truncated before end, stopped conversation has end',
`conversation_command`varchar(160)DEFAULT''COMMENT'Default Command to execute',
`command`varchar(160)DEFAULT''COMMENT'Default Command to execute',
`conversation_name`varchar(160)NOTNULLDEFAULT''COMMENT'Name of the conversation can be the command name or a generic name for conversation between multiple commands',
`data`varchar(1000)DEFAULT'NULL'COMMENT'Data stored from command',
`data`varchar(1000)DEFAULT'NULL'COMMENT'Data stored from command',