A simple GroupMe bot building and hosting module.
Install with npm:
$ npm i my-groupme-bot --save
The bot, inspired by dads everywhere, takes any declarations about yourself very literally.
Example:
User: I'm feeling great today
Bot: Hi feeling great today, I'm dad!
Code:
const bot = require('my-groupme-bot')
bot.config('YOUR_BOT_ID')
.pattern(
/(i'?m|i\s+am)\s+[^.?!]*[.?!]?/gi,
(message, matches) => bot.send(matches.map(match =>
`Hi ${match.trim().replace(/^(i'?m|i\s+am)\s+/gi, '')}, I'm dad!`
).join('\n'))
).listen(process.env.PORT)
The bot, inpired by How I Met Your Mother, salutes any army, navy, etc. officer mentioned in a chat!
Example:
User: Well yeah, that's the general idea
Bot: *salutes* general idea
Code:
const bot = require('my-groupme-bot')
bot.config('YOUR_BOT_ID')
.pattern(new RegExp(`(${[
'general',
'private',
'corporal',
'lieutenant',
'major',
'captain',
'admiral',
'colonel',
'kernel',
'sergeant',
'specialist',
'marine',
'officer'
].join('|')})[^.]*\\.?`, 'gi'),
(message, matches) => bot.send(matches.map(match => `*salutes* ${match.trim()}`).join('\n'))
).listen(process.env.PORT)
Documentation for the all the functions can be found here and some more examples can be found in the 'examples' folder.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
$ npm i -d && npm test
Tomer Aberbach