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
Read the room is a skill for Abbot to realize that the world is much larger than it is. If Abbot isn’t aware of the fact that it’s a BIG news day, maybe tell Abbot to read the room. This will cause Abbot to go on the New York Times website, pick one of the headlines, and apologize for missing out on the important news. Abbot doesn’t do anything to differentiate the news, so it might treat good news as bad news!
Usage
This package has no usage examples
Code
def handle_starttag(self, tag, attrs):
real_headline = attrs and len(attrs) and len(attrs[0]) and attrs[0][0] == ‘size’
if tag == ‘h3’ and not (self.get_headline) and real_headline:
if not self.headline:
self.get_headline = True
self.attrs = attrs
elif random.randint(1, 10) == 2:
self.get_headline = True
def handle_data(self, data):
if self.get_headline:
self.headline = data
self.get_headline = False
r = requests.get(‘https://www.nytimes.com/’)
q = NewsParser()
q.feed(r.text)
z = [‘I\’m sorry. ‘, ‘My apologies. ‘, ‘Oh. ‘, ‘Wow my bad. ‘, “Shit. “, “Damn 😕. “]
y = [‘You all must be reeling from the fact that ‘, ‘It must be a big day because ‘, ‘I wasn\’t really thinking about ‘, ‘I only just realized that ‘, ‘I hadn\’t heard that ‘]
x = [‘exciting’, ‘traumatizing’, ‘awful’, ‘threatening’, ‘drastic’, ‘world-changing’]
w = [‘I\’ll try to do better next time.’, ‘I promise it won\’t happen again.’, ”, ”, ‘I\’ll use my head before I speak in the future.’, ‘I\’m gonna sign off and take a quick walk.’, ”, ”]
response = f”{random.choice(z)}{random.choice(y)}{q.headline}. That must be very {random.choice(x)} news! {random.choice(w)}”
bot.reply(response)