update and code refactoring focused on: 1. Adding new documentation pages to the table of contents 2. Restructuring the bot templates documentation 3. Changing keyword syntax from underscore format to space format (e.g., `SET_BOT_MEMORY` → `SET BOT MEMORY`) 4. Updating compiler and keyword registration to support the new space-based syntax 5. Adding new keyword modules (social media, lead scoring, templates, etc.) Refactor BASIC keywords to use spaces instead of underscores Change keyword syntax from underscore format (SET_BOT_MEMORY) to more natural space-separated format (SET BOT MEMORY) throughout the codebase. Key changes: - Update Rhai custom syntax registration to use space tokens - Simplify compiler preprocessing (fewer replacements needed) - Update all template .bas files to use new syntax - Expand documentation with consolidated examples and new sections - Add new keyword modules: social_media, lead_scoring, send_template, core_functions, qrcode, sms, procedures, import_export, llm_macros, on_form_submit
85 lines
2.8 KiB
QBasic
85 lines
2.8 KiB
QBasic
PARAM firstname AS STRING LIKE "John" DESCRIPTION "First name of the contact"
|
|
PARAM lastname AS STRING LIKE "Smith" DESCRIPTION "Last name of the contact"
|
|
PARAM email AS STRING LIKE "john.smith@company.com" DESCRIPTION "Email address of the contact"
|
|
PARAM phone AS STRING LIKE "+1-555-123-4567" DESCRIPTION "Phone number of the contact"
|
|
PARAM companyname AS STRING LIKE "Acme Corporation" DESCRIPTION "Company or organization name"
|
|
PARAM jobtitle AS STRING LIKE "Sales Manager" DESCRIPTION "Job title or role"
|
|
PARAM tags AS STRING LIKE "customer,vip" DESCRIPTION "Optional comma-separated tags"
|
|
PARAM notes AS STRING LIKE "Met at conference" DESCRIPTION "Optional notes about the contact"
|
|
|
|
DESCRIPTION "Adds a new contact to the directory. Collects contact information and saves to the contacts database."
|
|
|
|
' Validate required fields
|
|
IF firstname = "" THEN
|
|
TALK "What is the contact's first name?"
|
|
HEAR firstname AS STRING
|
|
END IF
|
|
|
|
IF lastname = "" THEN
|
|
TALK "What is the contact's last name?"
|
|
HEAR lastname AS STRING
|
|
END IF
|
|
|
|
IF email = "" THEN
|
|
TALK "What is the contact's email address?"
|
|
HEAR email AS EMAIL
|
|
END IF
|
|
|
|
' Generate contact ID
|
|
let contactid = "CON-" + FORMAT NOW() AS "YYYYMMDD" + "-" + FORMAT RANDOM(1000, 9999)
|
|
|
|
' Set timestamps
|
|
let createdat = FORMAT NOW() AS "YYYY-MM-DD HH:mm:ss"
|
|
let createdby = GET "session.user_email"
|
|
|
|
' Build full name
|
|
let fullname = firstname + " " + lastname
|
|
|
|
' Save the contact
|
|
SAVE "contacts.csv", contactid, firstname, lastname, fullname, email, phone, companyname, jobtitle, tags, notes, createdby, createdat
|
|
|
|
' Store in bot memory
|
|
SET BOT MEMORY "last_contact", contactid
|
|
|
|
' If company provided, check if it exists and add if not
|
|
IF companyname != "" THEN
|
|
let existingcompany = FIND "companies.csv", "name=" + companyname
|
|
let companycount = AGGREGATE "COUNT", existingcompany, "id"
|
|
|
|
IF companycount = 0 THEN
|
|
let companyid = "COMP-" + FORMAT NOW() AS "YYYYMMDD" + "-" + FORMAT RANDOM(1000, 9999)
|
|
SAVE "companies.csv", companyid, companyname, createdat
|
|
TALK "📝 Note: Company '" + companyname + "' was also added to the directory."
|
|
END IF
|
|
END IF
|
|
|
|
' Log activity
|
|
let activity = "Contact created: " + fullname
|
|
SAVE "contact_activities.csv", contactid, activity, createdby, createdat
|
|
|
|
' Respond to user
|
|
TALK "✅ **Contact Added Successfully!**"
|
|
TALK ""
|
|
TALK "**Contact Details:**"
|
|
TALK "📋 **ID:** " + contactid
|
|
TALK "👤 **Name:** " + fullname
|
|
TALK "📧 **Email:** " + email
|
|
|
|
IF phone != "" THEN
|
|
TALK "📱 **Phone:** " + phone
|
|
END IF
|
|
|
|
IF companyname != "" THEN
|
|
TALK "🏢 **Company:** " + companyname
|
|
END IF
|
|
|
|
IF jobtitle != "" THEN
|
|
TALK "💼 **Title:** " + jobtitle
|
|
END IF
|
|
|
|
IF tags != "" THEN
|
|
TALK "🏷️ **Tags:** " + tags
|
|
END IF
|
|
|
|
TALK ""
|
|
TALK "You can find this contact anytime by searching for their name or email."
|