用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/shreed27/DAIN --skill presence命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | presence |
| description | Online status, activity tracking, and multi-device sync |
| emoji | 🟢 |
Manage online status, track activity across devices, and sync presence information.
/presence Show your status
/presence who Who's online
/presence activity Recent activity
/presence online Set online
/presence away Set away
/presence dnd Do not disturb
/presence offline Appear offline
/presence status "In a meeting" Custom status
/presence devices Your connected devices
/presence sync Force sync all devices
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 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
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);
// 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}`);
}
// 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');
// 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}`);
}
// 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`);
});
// 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 | Description |
|---|---|
online | Active and available |
away | Idle/inactive |
dnd | Do not disturb |
offline | Not available |
Presence automatically changes to away after inactivity:
const presence = createPresenceService({
awayAfterMs: 300000, // 5 min idle -> away
offlineAfterMs: 3600000, // 1 hour idle -> offline
});
When user is active on multiple devices: