Neutral, Plus or Minus

    mebots

    1.1.0 • Public • Published

    mebots

    NPM package summary for markipsum

    A JavaScript interface to the MeBots API.

    Usage

    First install with npm or your favorite package manager:

    npm install mebots

    Import into your project:

    const mebots = require('mebots');
    // Alternative:
    const Bot = require('mebots').Bot;
    // If you choose this option, simply instantiate the bot as `new Bot(...)` below.

    Instantiate your bot by passing the shortname and token:

    // var or let should work too
    const bot = mebots.Bot('your_bot_shortname', 'token (at top of page while editing your bot)')

    You will likely want to store the token in an environment variable or config file of some sort. At any rate, don't commit it to GitHub! :)

    Finally, use a promise structure to fetch the instance and post a message, using the id field to fulfill the bot_id key as discussed in GroupMe's documentation here!

    bot.getInstance(receivedGroupId).then((instance) => {
        options = { // the parameters you're passing to
            // ...
            'bot_id': instance.id,
        };
        // Perform request just like you normally would!
    });

    Feel free to open an issue if you need help!

    Authorship

    Erik Boesen

    Install

    npm i mebots

    DownloadsWeekly Downloads

    1

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    2.65 kB

    Total Files

    3

    Last publish

    Collaborators

    • erikboesen