Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

💬 A simple GroupMe bot building and hosting module.

License

Notifications You must be signed in to change notification settings

TomerAberbach/my-groupme-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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