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
WHY IS EVERYONE YELLING?
This skill listens for people TYPING IN ALL CAPS. When they do, it stores what they said and shouts something back at them. Trolling level 100.
This skill requires a RegularExpression pattern:
^([A-Z"][A-Z0-9 .,'’"()\?!&%$#@+-]+)$
Usage
@abbot yelling remove <phrase>
– remove a phrase from Abbot’s dictionary of shouts.
@abbot yelling remove_all
– wipe the dictionary of shouts and start over.
Code
words = bot.arguments.split(” “)
# Get all the prior responses. Create a new one if none exists already.
all_responses = bot.brain.get(“shouts”)
if all_responses is None:
all_responses = []
# Allow users to remove things from the brain
if words[0] == “remove”:
rest = ” “.join(words[1::])
try:
all_responses.remove(rest)
bot.brain.write(“shouts”, all_responses)
bot.reply(“Okay, I’ll stop yelling `{}`”.format(rest))
except ValueError:
bot.reply(“Who’s yelling that? So far it looks like it’s just you.”)
elif words[0] == “remove_all”:
bot.brain.write(“shouts”, [])
bot.reply(“All shouts have been wiped. My mind is blank.”)
# Add a new shout to the brain, and send a prior one in
else:
if len(all_responses) > 0:
bot.reply(random.choice(all_responses))
if bot.arguments not in all_responses:
all_responses.append(bot.arguments)
bot.brain.write(“shouts”, all_responses)