presence
Online status, activity tracking, and multi-device sync
What this skill does
# Presence - Complete API Reference
Manage online status, track activity across devices, and sync presence information.
---
## Chat Commands
### View Status
```
/presence Show your status
/presence who Who's online
/presence activity Recent activity
```
### Set Status
```
/presence online Set online
/presence away Set away
/presence dnd Do not disturb
/presence offline Appear offline
/presence status "In a meeting" Custom status
```
### Devices
```
/presence devices Your connected devices
/presence sync Force sync all devices
```
---
## TypeScript API Reference
### Create Presence Service
```typescript
import { createPresenceService } from 'clodds/presence';
const presence = createPresenceService({
// Update interval
heartbeatIntervalMs: 30000,
// Auto-away after idle
awayAfterMs: 300000, // 5 minutes
// Storage
storage: 'redis', // 'redis' | 'memory'
redisUrl: process.env.REDIS_URL,
});
```
### Get Status
```typescript
// Get own status
const status = await presence.getStatus(userId);
console.log(`Status: ${status.status}`); // 'online' | 'away' | 'dnd' | 'offline'
console.log(`Custom: ${status.customStatus}`);
console.log(`Last seen: ${status.lastSeen}`);
console.log(`Device: ${status.activeDevice}`);
// Get multiple users
const statuses = await presence.getStatuses(['user-1', 'user-2', 'user-3']);
```
### Set Status
```typescript
// Set status
await presence.setStatus(userId, 'online');
await presence.setStatus(userId, 'away');
await presence.setStatus(userId, 'dnd');
await presence.setStatus(userId, 'offline');
// Set custom status message
await presence.setCustomStatus(userId, 'Trading BTC');
// Clear custom status
await presence.clearCustomStatus(userId);
```
### Activity Tracking
```typescript
// Record activity
await presence.recordActivity(userId, {
type: 'message',
channelId: 'telegram-123',
timestamp: Date.now(),
});
// Get recent activity
const activity = await presence.getActivity(userId, {
limit: 10,
since: Date.now() - 3600000, // Last hour
});
for (const event of activity) {
console.log(`${event.type} at ${event.timestamp}`);
console.log(` Channel: ${event.channelId}`);
}
```
### Device Presence
```typescript
// Get user's devices
const devices = await presence.getDevices(userId);
for (const device of devices) {
console.log(`${device.id}: ${device.name}`);
console.log(` Status: ${device.status}`);
console.log(` Last seen: ${device.lastSeen}`);
console.log(` Active: ${device.isActive}`);
}
// Set device status
await presence.setDeviceStatus(userId, deviceId, 'online');
```
### Who's Online
```typescript
// Get online users
const online = await presence.getOnlineUsers({
channelId: 'telegram-123', // Optional: filter by channel
});
for (const user of online) {
console.log(`${user.name}: ${user.status}`);
}
```
### Event Handlers
```typescript
// Status changes
presence.on('statusChange', (userId, oldStatus, newStatus) => {
console.log(`${userId}: ${oldStatus} -> ${newStatus}`);
});
// User came online
presence.on('online', (userId) => {
console.log(`${userId} is now online`);
});
// User went offline
presence.on('offline', (userId) => {
console.log(`${userId} went offline`);
});
```
### Sync Across Devices
```typescript
// Force sync
await presence.sync(userId);
// Get sync status
const syncStatus = await presence.getSyncStatus(userId);
console.log(`Devices synced: ${syncStatus.synced}/${syncStatus.total}`);
console.log(`Last sync: ${syncStatus.lastSync}`);
```
---
## Status Types
| Status | Description |
|--------|-------------|
| `online` | Active and available |
| `away` | Idle/inactive |
| `dnd` | Do not disturb |
| `offline` | Not available |
---
## Auto-Away
Presence automatically changes to `away` after inactivity:
```typescript
const presence = createPresenceService({
awayAfterMs: 300000, // 5 min idle -> away
offlineAfterMs: 3600000, // 1 hour idle -> offline
});
```
---
## Multi-Device Sync
When user is active on multiple devices:
- Most recent activity determines primary device
- Status syncs across all devices
- Custom status shared everywhere
---
## Best Practices
1. **Use heartbeats** — Keep status accurate
2. **Set away appropriately** — Don't spam status changes
3. **Custom status** — Let others know what you're doing
4. **Review devices** — Keep device list clean
5. **DND for focus** — Mute notifications during trades
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.