This package has been deprecated

Author message:

abandoned and unmaintained

my-groupme-bot-imgflip

1.0.1 • Public • Published

My Groupme Bot Imgflip

NPM version JavaScript Style Guide

A my-groupme-bot plugin which integrates with Imgflip for meme generation from user input.

Install

Install with npm:

$ npm i my-groupme-bot-imgflip --save

Usage

Example:

User: /pigeon
Bot: Usage: /pigeon guy, butterfly, is this a pigeon?
User: /pigeon groupme bot programmers, a module for a memebot, is this the greatest module ever?
Bot:

Example

Code:

const bot = require('my-groupme-bot')
const imgflip = require('my-groupme-bot-imgflip')
 
bot
  .use(imgflip({
    imgflip: {
      username: 'YOUR_IMGFLIP_USERNAME',
      password: 'YOUR_IMGFLIP_PASSWORD'
    },
    groupme: {
      accessToken: 'YOUR_GROUPME_ACCESS_TOKEN'
    }
  }))
  .config('YOUR_BOT_ID')
  .imgflip(100777631, 'pigeon', 'Is this a pigeon?', ['guy', 'butterfly', 'is this a pigeon?'], a => a.map(i => i.toUpperCase()))
  .listen(process.env.PORT)

Methods

require('my-groupme-bot-imgflip')(opts) -> MyGroupMeBotPlugin

Returns a my-groupme-bot plugin configured with the given options.

Parameters:

  • opts :
    {
      imgflip: {
        username: string,
        password: string
      },
      groupme: {
        accessToken: string
      }
    }
    
    An options object containing your Imgflip username and password, and your GroupMe access token.

bot.imgflip(id, name, desc, example, transform) -> bot

Adds a command to the bot which allows users to fill out the meme with the specified id.

Parameters:

  • id : number - The id of the meme to fill out. The top 100 memes can be found at this link.
  • name : string - The name to use for the command.
  • description : string | undefined | null - A description for the command. Will be displayed by the help command if the help function is called on the bot. Pass null or undefined for no description.
  • example : Array<string> - An array of strings which indicates the number of arguments expected for the meme as well as indicating which argument is for which label of the image. The array is joined by commas for displaying the usage as shown in the example.
  • transform : (args : Array<string>) -> Array<string> (Optional) - A function which maps the arguments given by the user to be used for the labeling the meme. The example above capitalizes the provided strings. The returned array can be of a different length than the original array.

Related

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

Copyright © 2018 Tomer Aberbach Released under the MIT license.

Package Sidebar

Install

npm i my-groupme-bot-imgflip

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

7.52 kB

Total Files

4

Last publish

Collaborators

  • tomeraberbach