GithubHelp home page GithubHelp logo

tomeraberbach / my-groupme-bot-imgflip Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 160 KB

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

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

License: MIT License

JavaScript 100.00%
groupme npm npm-module nodejs imgflip memes chatbot chat bot api

my-groupme-bot-imgflip's Introduction

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

MIT ยฉ Tomer Aberbach

my-groupme-bot-imgflip's People

Contributors

dependabot[bot] avatar tomeraberbach avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.