You can use the Nightbot Counter API to keep track of check-ins and Google Apps Script (free) to ensure users can only check-in once per day.
1. Go to Google Apps Script.
2. Create a new project.
3. Paste this code:
const NAMESPACE = "checkinbot";
function doGet(e) {
const user = e.parameter.user;
if (!user) return ContentService.createTextOutput("❌ User not defined");
const KEY = `user-${user.toLowerCase()}`;
const baseUrl = `https://api.counterapi.dev/v1/${NAMESPACE}/${KEY}`;
let count = 0;
let lastUpdate = null;
try {
const response = UrlFetchApp.fetch(baseUrl);
const data = JSON.parse(response.getContentText());
count = data.count;
lastUpdate = new Date(data.updated_at);
} catch (error) {
const errorText = error.toString();
if (errorText.includes("record not found")) {
UrlFetchApp.fetch(`${baseUrl}/up`);
return ContentService.createTextOutput(`✅ @${user}, first check-in recorded! You now have 1 check-in.`);
} else {
return ContentService.createTextOutput(`⚠️ Error checking your check-in: ${errorText}`);
}
}
const now = new Date();
if (lastUpdate && lastUpdate.toDateString() === now.toDateString()) {
return ContentService.createTextOutput(`🛑 @${user}, you have already checked in today.`);
}
UrlFetchApp.fetch(`${baseUrl}/up`);
return ContentService.createTextOutput(`✅ @${user}, check-in recorded! You now have ${count + 1} check-ins.`);
}
4. Click Deploy → Manage deployments → New deployment
Type: Web app
Access: Anyone
Copy the generated URL and add a custom command in Nightbot: