-
<static> giphyHost
-
Fetch the default host information for making a request to
giphy.
- Source:
-
-
<static> imgurHost
-
Fetch the default host information for making a request to
imgur.
- Source:
-
-
<private> _giphyCache :object
-
Cached responses from recent requests to Giphy's API. Mapped
by request path.
Type:
- Default Value:
-
- Source:
-
-
<private> _giphyCacheDuration :number
-
Maximum amount of time to cache a request to Giphy before we
purge it.
Type:
- Default Value:
-
- Source:
-
-
<private> _imgurCache :object
-
Cached responses from recent requests to Imgur's API. Mapped
by request path.
Type:
- Default Value:
-
- Source:
-
-
<private> _imgurCacheDuration :number
-
Maximum amount of time to cache a request to Imgur before we
purge it.
Type:
- Default Value:
-
- Source:
-
-
-
The parent SpikeyBot instance. Defaults to required cache value for
autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
client :Discord~Client
-
The current bot client. Defaults to require cache value for editor
autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
-
The command object for registering command listeners. Defaults to require
cache value for editor autocompletion, updates to current reference at
init.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<constant> commit :string
-
The commit at HEAD at the time this module was loaded. Essentially the
version of this submodule.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
-
The common object. Defaults to require cache value for editor
autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
Discord :Discord
-
The current Discord object instance of the bot. Defaults to require cache
value for editor autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<abstract> helpMessage :undefined|string|Discord~EmbedBuilder
-
The help message to show the user in the main help message.
Type:
-
undefined
|
string
|
Discord~EmbedBuilder
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected, readonly> initialized :boolean
-
Has this subModule been initialized yet (Has begin() been called).
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<constant> loadTime :number
-
The time at which this module was loaded for use in checking if the
module needs to be reloaded because the file has been modified since
loading.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> myName :string
-
The name of this submodule. Used for differentiating in the log. Should
be defined before begin().
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<abstract> postPrefix :string
-
The postfix for the global prefix for this subModule. Must be defined
before begin(), otherwise it is ignored.
Type:
- Inherited From:
-
- Overrides:
- Source:
-
-
<private> _commandCookie(msg)
-
Replies with a picture of a cookie.
Parameters:
Name |
Type |
Description |
msg |
Discord~Message
|
Message that triggered command. |
- Source:
-
Listens to Events:
- Command#event:cookie
- Command#event:cookies
-
<private> _commandGiphy(msg [, pages] [, count])
-
Searches Giphy for the given query.
Parameters:
Name |
Type |
Argument |
Default |
Description |
msg |
Discord~Message
|
|
|
Message that triggered command. |
pages |
number
|
<optional>
|
1
|
Number of potential pages to view. |
count |
number
|
<optional>
|
20
|
Number of results per each page. |
- Source:
-
Listens to Events:
-
<private> _commandImgur(msg [, pages])
-
Searches Imgur for the given query.
Parameters:
Name |
Type |
Argument |
Default |
Description |
msg |
Discord~Message
|
|
|
Message that triggered command. |
pages |
number
|
<optional>
|
1
|
Number of potential pages to view. |
- Source:
-
Listens to Events:
-
<private> _giphyGet(path, cb)
-
Performs a get request to Giphy's API at the given path, and
caches the result before returning it through the callback. If a cached
response is available that isn't too old, that will immediately be returned
instead.
Parameters:
Name |
Type |
Description |
path |
string
|
The full API path after the domain and API version.
Includes query parameters. |
cb |
function
|
Callback once completed or failed. First parameter is
optional error, second is otherwise the parsed JSON object from Imgur. |
- Source:
-
-
<private> _imgurGet(path, cb)
-
Performs a get request to Imgur's API at the given path, and
caches the result before returning it through the callback. If a cached
response is available that isn't too old, that will immediately be returned
instead.
Parameters:
Name |
Type |
Description |
path |
string
|
The full API path after the domain and API version.
Includes query parameters. |
cb |
function
|
Callback once completed or failed. First parameter is
optional error, second is otherwise the parsed JSON object from Imgur. |
- Source:
-
-
begin(Discord, client, command, common, bot)
-
Initialize this submodule.
Parameters:
Name |
Type |
Description |
Discord |
Discord
|
The Discord object for the API library. |
client |
Discord~Client
|
The client that represents this bot. |
command |
Command
|
The command instance in which to
register command listeners. |
common |
Common
|
Class storing common functions. |
bot |
SpikeyBot
|
The parent SpikeyBot instance. |
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> debug(msg)
-
Log using common.logDebug, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Overrides:
- Source:
-
-
end()
-
Trigger subModule to shutdown and get ready for process terminating.
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> error(msg)
-
Log using common.error, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> initialize()
-
The function called at the end of begin() for further initialization
specific to the subModule. Must be defined before begin() is called.
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> log(msg)
-
Log using common.log, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Overrides:
- Source:
-
-
<abstract> reloadable()
-
Check if this module is in a state that is ready to be
reloaded. If false is returned, this module should not be unloaded and
doing such may risk putting the module into an uncontrollable state. This
is different from unloadable, which checks if this module can be stopped
completely, this checks if the module can be stopped and restarted.
- Inherited From:
-
- Overrides:
- Source:
-
- See:
-
Returns:
True if can be reloaded, false if cannot.
-
Type
-
boolean
-
<abstract> save( [opt])
-
Saves all data to files necessary for saving current state.
Parameters:
Name |
Type |
Argument |
Default |
Description |
opt |
string
|
<optional>
|
'sync'
|
Can be 'async', otherwise defaults to
synchronous. |
- Inherited From:
-
- Overrides:
- Source:
-
-
<protected> shutdown()
-
Shutdown and disable this submodule. Removes all event listeners.
- Inherited From:
-
- Overrides:
- Source:
-
-
<abstract> unloadable()
-
Check if this module is in a state that is ready to be
unloaded. If false is returned, this module should not be unloaded and
doing such may risk putting the module into an uncontrollable state.
- Inherited From:
-
- Overrides:
- Source:
-
- See:
-
Returns:
True if can be unloaded, false if cannot.
-
Type
-
boolean
-
<protected> warn(msg)
-
Log using common.logWarning, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Overrides:
- Source:
-