Two developers accidentally deploying over each other on a shared staging server can burn an entire afternoon of debugging. Instead of managing a third-party dashboard or screaming in Slack, we turned our Telegram team chat into an instant deploy locker with shared bot state and smart in-place callback edits. Anyone can see live server occupancy and toggle locks with a single tap.
📁 Filename:
command/staging.js👨💻 Code:
const holder = await BOT.getProp("staging_locked_by").value();
if (holder) {
sendMessage(`🔴 *Staging 1 is LOCKED* by ${holder}`, {
buttons: [{ text: "🔓 Release Staging", command: "/unlock_staging" }]
});
} else {
sendMessage("🟢 *Staging 1 is AVAILABLE* for testing.", {
buttons: [{ text: "🔒 Claim Staging", command: "/lock_staging" }]
});
}📁 Filename:
command/lock_staging.js👨💻 Code:
if (isCallback) {
answerCallback("Environment claimed!", false);
}
const claimant = user.first_name || user.username || "Anonymous Dev";
BOT.setProp("staging_locked_by", claimant);
editCallbackMessage(`🔴 *Staging 1 is LOCKED* by ${claimant}`, [
{ text: "🔓 Release Staging", command: "/unlock_staging" }
]);📁 Filename:
command/unlock_staging.js👨💻 Code:
if (isCallback) {
answerCallback("Environment released!", false);
}
BOT.deleteProp("staging_locked_by");
editCallbackMessage("🟢 *Staging 1 is AVAILABLE* for testing.", [
{ text: "🔒 Claim Staging", command: "/lock_staging" }
]);💡 Always call
answerCallback first in your callback handlers to dismiss the Telegram button loading spinner immediately.⚠️ Note: Shared status across all users is handled automatically via BOT.setProp, which syncs to your configured Firebase Realtime DB without any manual database setup.#FlexGram
