-
-
The parent SpikeyBot instance. Defaults to required cache value for
autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- 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:
-
- 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:
-
- Source:
-
-
<constant> commit :string
-
The commit at HEAD at the time this module was loaded. Essentially the
version of this submodule.
Type:
- Inherited From:
-
- Source:
-
-
-
The common object. Defaults to require cache value for editor
autocompletion, updates to current reference at init.
Type:
- Inherited From:
-
- 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:
-
- 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:
-
- Source:
-
-
<protected, readonly> initialized :boolean
-
Has this subModule been initialized yet (Has begin() been called).
Type:
- Inherited From:
-
- 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:
-
- 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:
-
- Source:
-
-
<private, inner, nullable> cmdScheduler :CmdScheduling
-
Stores the current reference to the CmdScheduling subModule. Null if it
doesn't exist.
Type:
- Source:
-
-
<private, inner, nullable> raidBlock :RaidBlock
-
Stores the current reference to the RaidBlock subModule. Null if it doesn't
exist.
Type:
- Source:
-
-
<private, inner, constant> siblingSockets :object.<Socket>
-
Map of all sockets connected that are siblings.
Type:
- Source:
-
-
<private, inner, constant> sockets :object.<Socket>
-
Map of all currently connected sockets.
Type:
- 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:
-
- Source:
-
-
cancelScheduledCommand(userData, socket, gId, cmdId [, cb])
-
Client has requested that a scheduled command be cancelled.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to cancel the
command. |
cmdId |
string
|
|
The ID of the command to cancel. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
changeCommandSetting(userData, socket, gId, cmd, key, value, id, enabled [, cb])
-
Client has requested to change a single command setting for a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to change the
setting. |
cmd |
string
|
|
The name of the command to change the setting for. |
key |
string
|
|
The name of the setting to change. |
value |
string
|
boolean
|
|
The value to set the setting to, or the key
if changing an enabled or disabled category. |
id |
string
|
<nullable>
|
The ID of the channel, user, or role to change
the setting for if changing the enabled or disabled category. |
enabled |
boolean
|
<nullable>
|
The setting to set the value of the ID setting. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
changeModLogSetting(userData, socket, gId, key, value [, cb])
-
Client has requested to change a single ModLog setting for a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to change the
setting. |
key |
string
|
|
The name of the setting to change. |
value |
string
|
boolean
|
|
The value to set the setting to. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
changePrefix(userData, socket, gId, prefix [, cb])
-
Client has requested to change the command prefix for a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to change the
prefix. |
prefix |
string
|
|
The new prefix value to set. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
changeRaidSetting(userData, socket, gId, key, value [, cb])
-
Client has requested to change a single raid setting for a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to change the
setting. |
key |
string
|
|
The name of the setting to change. |
value |
string
|
boolean
|
|
The value to set the setting to. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
<protected> debug(msg)
-
Log using common.logDebug, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Source:
-
-
end()
-
Trigger subModule to shutdown and get ready for process terminating.
- Inherited From:
-
- Source:
-
-
<protected> error(msg)
-
Log using common.error, but automatically set name.
Parameters:
Name |
Type |
Description |
msg |
string
|
The message to log. |
- Inherited From:
-
- Source:
-
-
fetchChannel(userData, socket, gId, cId [, cb])
-
Client has requested data for a specific channel.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
number
|
string
|
|
The ID of the Discord guild where the channel
is. |
cId |
number
|
string
|
|
The ID of the Discord channel to fetch. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchCommandSettings(userData, socket, gId, cmd [, cb])
-
Client has requested settings specific to a single command in a single
guild. This only supplies user settings, if values are default, this will
reply with null.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
|
The guild ID to fetch the settings for. |
cmd |
string
|
<nullable>
|
The name of the command to fetch the setting for, or
null to fetch all settings. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchGuild(userData, socket, gId [, cb])
-
Fetch a single guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The ID of the guild that was requested. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
fetchGuildScheduledCommands(userData, socket, gId [, cb])
-
Client has requested scheduled commands for a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
|
The guild ID to fetch. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchMember(userData, socket, gId, mId [, cb])
-
Fetch data about a member of a guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
number
|
string
|
|
The guild id to look at. |
mId |
number
|
string
|
|
The member's id to lookup. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
-
fetchModLogSettings(userData, socket, gId [, cb])
-
Client has requested settings specific to ModLog for single guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
|
The guild ID to fetch the settings for. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchRaidSettings(userData, socket, gId [, cb])
-
Client has requested settings specific to raids for single guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
|
The guild ID to fetch the settings for. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchScheduledCommands(userData, socket [, cb])
-
Client has requested all scheduled commands for the connected user.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- Source:
-
-
fetchSettings(userData, socket [, cb])
-
Client has requested all settings for all guilds for the connected user.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete and has data, or has failed. |
- 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:
-
- Source:
-
-
registerScheduledCommand(userData, socket, gId, cmd [, cb])
-
Client has created a new scheduled command.
Parameters:
Name |
Type |
Argument |
Description |
userData |
object
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
gId |
string
|
number
|
|
The id of the guild of which to add the command. |
cmd |
object
|
|
The command data of which to make into a
scheduled command and register. |
cb |
WebSettings~basicCB
|
<optional>
|
Callback that fires once the requested
action is complete, or has failed. |
- Source:
-
- See:
-
-
<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:
-
- 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:
-
- Source:
-
-
<protected> shutdown()
-
Shutdown and disable this submodule. Removes all event listeners.
- Inherited From:
-
- Overrides:
- Source:
-
-
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:
-
- Source:
-
-
<private, inner> checkChannelPerm(userData, gId, cId)
-
Check that the given user has permission to see and send messages in the
given channel, as well as manage the games in the given guild.
Parameters:
Name |
Type |
Description |
userData |
UserData
|
The user to check. |
gId |
string
|
The guild id of the guild that contains the channel. |
cId |
string
|
The channel id to check against. |
- Source:
-
Returns:
Whether the user has permission or not to manage the
hungry games in the given guild and has permission to send messages in the
given channel.
-
Type
-
boolean
-
<private, inner> checkMyGuild(gId)
-
Checks if the current shard is responsible for the requested guild.
Parameters:
Name |
Type |
Description |
gId |
number
|
string
|
The guild id to check. |
- Source:
-
Returns:
True if this shard has this guild.
-
Type
-
boolean
-
<private, inner> checkPerm(userData, gId, cId, cmd)
-
Check that the given user has permission to manage the games in the given
guild.
Parameters:
Name |
Type |
Argument |
Description |
userData |
UserData
|
|
The user to check. |
gId |
string
|
|
The guild id to check against. |
cId |
string
|
<nullable>
|
The channel id to check against. |
cmd |
string
|
|
The command being attempted. |
- Source:
-
Returns:
Whether the user has permission or not to manage the
hungry games in the given guild.
-
Type
-
boolean
-
<private, inner> clientSocketConnection(socket)
-
Handler for connecting as a client to the server.
Parameters:
Name |
Type |
Description |
socket |
socketIo~Socket
|
The socket.io socket that connected. |
- Source:
-
-
<private, inner> fetchGuilds(userData, socket [, cb])
-
Fetch all relevant data for all mutual guilds with the user and send it to
the user.
Parameters:
Name |
Type |
Argument |
Description |
userData |
WebUserData
|
|
The current user's session data. |
socket |
socketIo~Socket
|
|
The socket connection to reply on. |
cb |
function
|
<optional>
|
Callback that fires once the requested action is
complete, or has failed. |
- Source:
-
-
<private, inner> getNumClients()
-
Returns the number of connected clients that are not siblings.
- Source:
-
Returns:
Number of sockets.
-
Type
-
number
-
<private, inner> guildBroadcast(gId, event, args)
-
Broadcast a message to all relevant clients.
Parameters:
Name |
Type |
Argument |
Description |
gId |
string
|
|
Guild ID to broadcast message for. |
event |
string
|
|
The name of the event to broadcast. |
args |
*
|
<repeatable>
|
Data to send in broadcast. |
- Source:
-
-
<private, inner> handleCommandCancelled(cmdId, gId)
-
Handle a CmdScheduling.ScheduledCommand being canceled.
Parameters:
Name |
Type |
Description |
cmdId |
string
|
The ID of the command that was cancelled. |
gId |
string
|
number
|
The ID of the guild the command was cancelled
in. |
- Source:
-
Listens to Events:
- CmdScheduling#event:commandCancelled
-
<private, inner> handleCommandRegistered(cmd, gId)
-
Handle new CmdScheduling.ScheduledCommand being registered.
Parameters:
Name |
Type |
Description |
cmd |
CmdScheduling.ScheduledCommand
|
The command that was scheduled. |
gId |
string
|
number
|
The guild ID of which the command was scheduled
in. |
- Source:
-
Listens to Events:
- CmdScheduling#event:commandRegistered
-
<private, inner> handleLockdown(event)
-
Handle a guild going on lockdown.
Parameters:
Name |
Type |
Description |
event |
Object
|
Event
information. |
- Source:
-
Listens to Events:
-
<private, inner> handler(req, res)
-
Handler for all http requests. Should never be called.
Parameters:
Name |
Type |
Description |
req |
http.IncomingMessage
|
The client's request. |
res |
http.ServerResponse
|
Our response to the client. |
- Source:
-
-
<private, inner> handleRaidAction(event)
-
Handle a guild lockdown action being performed.
Parameters:
Name |
Type |
Description |
event |
Object
|
Event
information. |
- Source:
-
Listens to Events:
-
<private, inner> handleRaidShutdown()
-
Handle RaidBlock shutting down.
- Source:
-
Listens to Events:
-
<private, inner> handleSettingsChanged(gId, value, type, id [, id2])
-
Handle Command~CommandSetting value changed.
Parameters:
Name |
Type |
Argument |
Description |
gId |
string
|
<nullable>
|
The ID of the guild this setting was changed in, or
null of not specific to a single guild. |
value |
string
|
|
Value of setting. |
type |
string
|
|
Type of value. |
id |
string
|
|
Setting id. |
id2 |
string
|
<optional>
|
Second setting id. |
- Source:
-
- See:
-
- Command~CommandSetting.set
Listens to Events:
- Command.events#event:settingsChanged
-
<private, inner> handleSettingsReset(gId)
-
Handle Command~CommandSetting was deleted or reset in a guild.
Parameters:
Name |
Type |
Description |
gId |
string
|
The ID of the guild in which the settings were reset. |
- Source:
-
Listens to Events:
- Command.events#event:settingsReset
-
<private, inner> handleShutdown()
-
Handle CmdScheduling shutting down.
- Source:
-
Listens to Events:
- CmdScheduling#event:shutdown
-
<private, inner> makeMember(m)
-
Strips a Discord~GuildMember to only the necessary data that a client will
need.
Parameters:
Name |
Type |
Description |
m |
Discord~GuildMember
|
The guild member to strip the data from. |
- Source:
-
Returns:
The minimal member.
-
Type
-
object
-
<private, inner> makeMessage(uId, gId, cId, msg)
-
Forms a Discord~Message similar object from given IDs.
Parameters:
Name |
Type |
Argument |
Description |
uId |
string
|
|
The id of the user who wrote this message. |
gId |
string
|
|
The id of the guild this message is in. |
cId |
string
|
<nullable>
|
The id of the channel this message was 'sent' in. |
msg |
string
|
<nullable>
|
The message content. |
- Source:
-
Returns:
The created message-like object.
-
Type
-
MessageMaker
-
<private, inner> replyNoPerm(socket, cmd)
-
Send a message to the given socket informing the client that the command
they attempted failed due to insufficient permission.
Parameters:
Name |
Type |
Description |
socket |
Socket
|
The socket.io socket to reply on. |
cmd |
string
|
THe command the client attempted. |
- Source:
-
-
<private, inner> socketConnection(socket)
-
Handler for a new socket connecting.
Parameters:
Name |
Type |
Description |
socket |
socketIo~Socket
|
The socket.io socket that connected. |
- Source:
-
-
<private, inner> startClient()
-
Start a socketio client connection to the primary running server.
- Source:
-
-
<private, inner> stripGuilds(guilds, userData)
-
Strip a Discord~Guild to the basic information the client will need.
Parameters:
Name |
Type |
Description |
guilds |
Array.<Discord~Guild>
|
The array of guilds to strip. |
userData |
object
|
The current user's session data. |
- Source:
-
Returns:
The stripped guilds.
-
Type
-
Array.<object>
-
<private, inner> updateModuleReferences()
-
Update the references to the aplicable subModules.
- Source:
-