# Default Template
The default template is the starter bot that comes with General Bots, providing essential utility tools like weather forecasts, email sending, SMS messaging, calculations, and translations.
## Topic: Starter Bot with Essential Tools
This template is perfect for:
- Quick start with General Bots
- Basic utility functions
- Learning BASIC syntax
- Foundation for custom bots
## Available Tools
The default template includes these ready-to-use tools:
| Tool | File | Description |
|------|------|-------------|
| Weather | `weather.bas` | Get weather forecasts for any city |
| Send Email | `send-email.bas` | Send emails to any address |
| Send SMS | `send-sms.bas` | Send text messages to mobile phones |
| Calculate | `calculate.bas` | Perform mathematical calculations |
| Translate | `translate.bas` | Translate text between languages |
## The Code: weather.bas
```basic
PARAM location AS STRING LIKE "New York" DESCRIPTION "City or location to get weather forecast"
DESCRIPTION "Get current weather forecast for any city or location"
lat = 40.7128
lon = -74.0060
location_lower = LCASE(location)
IF INSTR(location_lower, "new york") > 0 THEN
lat = 40.7128
lon = -74.0060
ELSE IF INSTR(location_lower, "london") > 0 THEN
lat = 51.5074
lon = -0.1278
ELSE IF INSTR(location_lower, "tokyo") > 0 THEN
lat = 35.6762
lon = 139.6503
ELSE IF INSTR(location_lower, "sao paulo") > 0 THEN
lat = -23.5505
lon = -46.6333
END IF
weather_url = "https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "¤t_weather=true"
weather_data = GET weather_url
IF weather_data.current_weather THEN
current = weather_data.current_weather
code = current.weathercode
condition = "Clear"
icon = "☀️"
IF code = 0 THEN
condition = "Clear sky"
icon = "☀️"
ELSE IF code >= 1 AND code <= 3 THEN
condition = "Partly cloudy"
icon = "⛅"
ELSE IF code >= 51 AND code <= 67 THEN
condition = "Rainy"
icon = "🌧️"
ELSE IF code >= 95 AND code <= 99 THEN
condition = "Thunderstorm"
icon = "⛈️"
END IF
TALK icon + " Weather for " + location + ":"
TALK "Temperature: " + current.temperature + "°C"
TALK "Condition: " + condition
TALK "Wind: " + current.windspeed + " km/h"
ELSE
TALK "Could not fetch weather for: " + location
END IF
```
## Sample Dialogs
These conversations show how the default template works in real-world scenarios.
### Dialog 1: Weather Forecast
Today
What's the weather in Tokyo?
10:00
General Bot
☀️ Weather for Tokyo:
Temperature: 18°C
Condition: Clear sky
Wind: 12 km/h
10:00
### Dialog 2: Send Email
Send an email to john@example.com
11:30
Sure! What should be the subject of the email?
11:30
Got it. What would you like to say in the email?
11:31
Hi John, just a reminder about our meeting tomorrow at 2 PM. See you then!
11:32
✅ Email sent successfully!
📧 To: john@example.com
📋 Subject: Meeting Tomorrow
11:32
### Dialog 3: Translation
Translate "Good morning, how are you?" to Spanish
09:00
🌐 Translation (English → Spanish):
"Buenos días, ¿cómo estás?"
09:00
### Dialog 4: Calculation
Calculate 15% of 850
14:15
🔢 15% of 850 = 127.50
14:15
## Template Structure
```
default.gbai/
├── default.gbdialog/
│ ├── calculate.bas # Math calculations
│ ├── send-email.bas # Email sending
│ ├── send-sms.bas # SMS messaging
│ ├── translate.bas # Text translation
│ └── weather.bas # Weather forecasts
└── default.gbot/
└── config.csv # Bot configuration
```
## Keywords Used
| Keyword | Purpose |
|---------|---------|
| `PARAM` | Define tool parameters |
| `DESCRIPTION` | Tool description for AI |
| `GET` | HTTP GET request |
| `TALK` | Send message to user |
| `SEND MAIL` | Send email |
| `SEND SMS` | Send text message |
| `INSTR` | Find substring position |
| `LCASE` | Convert to lowercase |
## Supported Cities (Weather)
The weather tool includes coordinates for these cities:
- New York, Los Angeles, Chicago (USA)
- London, Paris, Berlin, Madrid (Europe)
- Tokyo, Beijing, Singapore, Mumbai, Dubai (Asia)
- Sydney (Australia)
- São Paulo, Rio de Janeiro (Brazil)
- Toronto (Canada)
## Customization Ideas
### Add More Cities
```basic
ELSE IF INSTR(location_lower, "amsterdam") > 0 THEN
lat = 52.3676
lon = 4.9041
ELSE IF INSTR(location_lower, "moscow") > 0 THEN
lat = 55.7558
lon = 37.6173
END IF
```
### Add Extended Forecast
```basic
' Get 7-day forecast
weather_url = weather_url + "&daily=temperature_2m_max,temperature_2m_min&forecast_days=7"
weather_data = GET weather_url
TALK "📅 7-Day Forecast for " + location + ":"
FOR i = 1 TO 7
TALK "Day " + i + ": " + weather_data.daily.temperature_2m_max[i] + "°C / " + weather_data.daily.temperature_2m_min[i] + "°C"
NEXT
```
### Add Email Templates
```basic
PARAM template AS STRING LIKE "meeting-reminder" DESCRIPTION "Email template to use"
IF template = "meeting-reminder" THEN
subject = "Meeting Reminder"
body = "Hi {name},\n\nThis is a reminder about our upcoming meeting.\n\nBest regards"
body = REPLACE(body, "{name}", recipient_name)
END IF
SEND MAIL recipient, subject, body
```
### Add SMS Confirmation
```basic
PARAM phone AS PHONE DESCRIPTION "Phone number with country code"
PARAM message AS STRING DESCRIPTION "Message to send"
DESCRIPTION "Send SMS with delivery confirmation"
SEND SMS phone, message
TALK "📱 SMS sent to " + phone
TALK "Message: " + LEFT(message, 50) + "..."
' Log the message
WITH smsLog
timestamp = NOW()
recipient = phone
content = message
status = "sent"
END WITH
SAVE "sms_log.csv", smsLog
```
## Using as a Base Template
The default template is designed to be extended. Here's how to build on it:
### 1. Copy the Template
```bash
cp -r templates/default.gbai packages/my-bot.gbai
```
### 2. Add Your Tools
Create new `.bas` files in the `.gbdialog` folder for your custom functionality.
### 3. Add a Start Script
Create `start.bas` to configure your bot:
```basic
ADD TOOL "weather"
ADD TOOL "send-email"
ADD TOOL "send-sms"
ADD TOOL "calculate"
ADD TOOL "translate"
' Add your custom tools
ADD TOOL "my-custom-tool"
CLEAR SUGGESTIONS
ADD SUGGESTION "weather" AS "Check weather"
ADD SUGGESTION "email" AS "Send email"
ADD SUGGESTION "translate" AS "Translate text"
BEGIN TALK
Welcome! I can help you with weather, emails, translations, and more.
END TALK
```
## Related Templates
- [start.bas](./start.md) - Basic greeting flow
- [broadcast.bas](./broadcast.md) - Mass messaging
- [store.bas](./store.md) - E-commerce features
---