Module: my-groupme-bot

A simple GroupMe bot building and hosting module.
Source:
See:

Methods

(static) command(name, descopt, sepopt, respond) → {*}

Adds a command in the form of '/ [arguments]' for the bot to look for in messages and respond to.
Returns the module itself to allow for builder pattern.
Parameters:
Name Type Attributes Description
name string A name for the command which will be called as follows: '/name'.
desc string <optional>
A description of the command to be added.
sep string <optional>
A RegExp or string to separate the command arguments.
respond commandRespond A callback which uses the bot to respond to a user command message.
Source:
Returns:
Type
*

(static) config(id) → {*}

Configures the module with the ID of the bot.
Returns the module itself to allow for builder pattern.
Parameters:
Name Type Description
id string The GroupMe ID of the bot.
Source:
Returns:
Type
*

(static) feature(descopt, check, respond) → {*}

Adds a feature to the bot.
Returns the module itself to allow for builder pattern.
Parameters:
Name Type Attributes Description
desc string <optional>
A description of the feature to be added.
check check A callback which checks if a message should be responded to by the bot.
respond respond A callback which uses the bot to respond to a message and which is only called if 'check' returned true.
Source:
Returns:
Type
*

(static) help() → {*}

Adds a '/help' command which displays all of the bot's commands and its other described features.
Returns the module itself to allow for builder pattern.
Source:
Returns:
Type
*

(static) listen(args)

Parameters:
Name Type Description
args Arguments, such as a simple port number, passed to the 'listen' function of the 'Server' provided by 'http.createServer'.
Source:

(static) pattern(descopt, pattern, respond) → {*}

Adds a regular expression pattern or literal string for the bot to look for in messages and respond to.
Returns the module itself to allow for builder pattern.
Parameters:
Name Type Attributes Description
desc string <optional>
A description of the feature to be added.
pattern RegExp | string A regular expression pattern or literal string for the bot to look for in messages.
respond patternRespond A callback which uses the bot to respond to a message if the pattern matches in it.
Source:
Returns:
Type
*

(static) random(name, descopt, supply) → {*}

Adds a command in the form of '/ [arguments]' for the bot to look for in messages and respond to.
Great for querying random quotes or frequently changing input.
Returns the module itself to allow for builder pattern.
Parameters:
Name Type Attributes Description
name string A name for the command which will be called as follows: '/name'.
desc string <optional>
A description of the command to be added.
supply Array.<string> | stringSupplier A string array to randomly pick a string from or a string supplier to get a string from for the bot to send.
Source:
Returns:
Type
*

(static) send(message, imageUrlopt, cbopt)

Sends a message as the bot to its GroupMe chat.
Parameters:
Name Type Attributes Description
message string A message to send as the bot to its GroupMe chat.
imageUrl string <optional>
An image URL to send as an attachment with the bot's message.
cb send <optional>
A callback which receives the potential error result of sending a GroupMe bot message.
Source:

(static) use(plugins)

Uses an arbitrary number of plugins.
Parameters:
Name Type Description
plugins Array.<Plugin> An array of plugins.
Source:

Type Definitions

check(message) → {boolean}

A callback which checks if a message should be responded to by the bot.
Parameters:
Name Type Description
message Message The message which was sent by a user.
Source:
Returns:
Type
boolean

commandRespond(message)

A callback which uses the bot to respond to a user command message.
Parameters:
Name Type Description
message Message The message which was sent by a user.
Array.<string> An array of the whitespace separated arguments provided by user after the command.
Source:

Message

A GroupMe message object.
Go to the GroupMe website for more information.
Type:
  • Object
Properties:
Name Type Description
attachments Array Array of URLs attached to the message.
avatar_url string Avatar URL of the user which sent the message.
created_at number Number indicating when the message was sent.
group_id string ID of the group where the message was sent.
id string ID of the message.
name string Name of the user which sent the message.
sender_id string
sender_type string Will always be user (bot does not respond to other bots).
source_guid string
system boolean
text string Actual text of the message.
user_id string ID of the user which sent the message.
Source:

patternRespond(message)

A callback which uses the bot to respond to a message and pattern matches in it.
Parameters:
Name Type Description
message Message The message which was sent by a user.
RegExpMatchArray An array of the pattern matches in the message sent by the user.
Source:

Plugin

A plugin.
Type:
  • Object
Properties:
Name Type Description
name string A name for the plugin.
fn function A function to add to the module's members the module as `this`.
Source:

respond(message)

A callback which uses the bot to respond to a message.
Parameters:
Name Type Description
message Message The message which was sent by a user.
Source:

send(erropt)

A callback which receives the potential error result of sending a GroupMe bot message.
Parameters:
Name Type Attributes Description
err Error <optional>
Error object indicating why the message could not be sent or undefined if it sent successfully.
Source:

stringSupplier() → {string}

A callback which supplies a message for the bot to send.
Source:
Returns:
Type
string