A skill that tells you who is currently on call.
About Abbot
Abbot is a programmable bot that turns your team chat into a shared command center. We handle all the boilerplate of building and running these conmmands so that you can focus on making tools that help you ship faster.
We built Abbot because we saw the power of this style of work (called ChatOps), when we worked at GitHub. ChatOps made it possible for GitHub to work productively without meetings, while globally distributed. We think it’s a pretty great way to work, so we made it easy to use in Slack, Discord, and Microsoft Teams.
You can read more about Abbot here, check out our blog, or take a look at some of the other cool packages available as a one-click install from Abbot’s Package Directory.
README
The oncall
skill is more for demonstrative purposes than anything else. It shows how to store and retrieve data specific to the skill. Having said that, there’s nothing stopping you from using it as a super simple tool to track who is on call.
Usage
@abbot oncall
Tells you the current person on call.
@abbot oncall @phil
Sets @phil as the person on call if @phil references a user in the system.
Code
if (Bot.Arguments is { Count: 0 }) {
var oncall = await Bot.Brain.GetAsync(category);
if (oncall is null) {
await Bot.ReplyAsync(“Nobody is on call. To set someone to be on call, just type `@abbot oncall NAME`.”);
}
else {
await Bot.ReplyAsync($”{oncall} is on call.”);
}
}
else if (Bot.Mentions is { Count: 0 }) {
await Bot.ReplyAsync($”Sorry, you did not mention anyone to be on call.”);
}
else if (Bot.Mentions is { Count: 1 }) {
var mentioned = Bot.Mentions[0];
if (mentioned.Id == Bot.Id) {
await Bot.ReplyAsync($”Unfortunately I am a bot and am not yet able to be put on call.”);
}
else {
await Bot.Brain.WriteAsync(category, mentioned);
await Bot.ReplyAsync($”Ok, {mentioned} is now on call.”);
}
}
else {
await Bot.ReplyAsync(“Only one person may be on call at a time. Or, you can change the `oncall` skill to allow more.”);
}