My Groupme Bot Imgflip
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:
Code:
const bot = const imgflip = bot
Methods
require('my-groupme-bot-imgflip')(opts) -> MyGroupMeBotPlugin
Returns a my-groupme-bot plugin configured with the given options.
Parameters:
opts
:
An options object containing your Imgflip username and password, and your GroupMe access token.{ imgflip: { username: string, password: string }, groupme: { accessToken: string } }
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 thehelp
function is called on the bot. Passnull
orundefined
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.