Skip to content
main
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

My Groupme Bot

NPM version JavaScript Style Guide

A simple GroupMe bot building and hosting module.

Install

Install with npm:

$ npm i my-groupme-bot --save

Usage

Dad Bot

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)

Ted and Robin Bot

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.

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Install dev dependencies:

$ npm i -d && npm test

Author

Tomer Aberbach

License

MIT Β© Tomer Aberbach