GithubHelp home page GithubHelp logo

tomeraberbach / my-groupme-bot Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 491 KB

๐Ÿ’ฌ A simple GroupMe bot building and hosting module.

Home Page: http://npm.im/my-groupme-bot

License: MIT License

JavaScript 100.00%
groupme groupme-bot groupme-api node-js npm npm-module javascript chatbot

my-groupme-bot's Introduction

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

my-groupme-bot's People

Contributors

dependabot[bot] avatar tomeraberbach avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fossabot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.