new ModLog()
Manages moderator logging on guilds.
Listens to Events:
- Command#event:setLogChannel
- Command#event:logChannel
Extends
Classes
Members
-
<private> _settings :object.<ModLog~Settings>
-
Guild settings for raids mapped by their guild id.
Type:
- object.<ModLog~Settings>
-
<nullable> bot :SpikeyBot
-
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:
- Discord~Client
- Inherited From:
- Overrides:
- Source:
-
command :Command
-
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:
- string
- Inherited From:
- Overrides:
- Source:
-
common :Common
-
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:
- Discord
- 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:
- boolean
- 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:
- number
- Inherited From:
- Overrides:
- Source:
-
<protected> myName :string
-
The name of this submodule. Used for differentiating in the log. Should be defined before begin().
Type:
- string
- 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:
- string
- Inherited From:
- Overrides:
- Source:
Methods
-
<private> _actionColor(action)
-
Fetch the color for the given action.
Parameters:
Name Type Description actionstring The action to lookup. Returns:
The color for the given action.- Type
- Discord~ColorResolvable
-
<private> _actionString(action)
-
Fetch the human readable action string.
Parameters:
Name Type Description actionstring The action to find the human readable format of. Returns:
Human readable string.- Type
- string
-
<private> _commandSetLogChannel(msg)
-
Command to set the output logging channel. Changes to the channel the command was run in, or toggles if ran in the same channel.
Parameters:
Name Type Description msgDiscord~Message Message that triggered command. Listens to Events:
- Command#event:setLogChannel
- Command#event:logChannel
-
begin(Discord, client, command, common, bot)
-
Initialize this submodule.
Parameters:
Name Type Description DiscordDiscord The Discord object for the API library. clientDiscord~Client The client that represents this bot. commandCommand The command instance in which to register command listeners. commonCommon Class storing common functions. botSpikeyBot The parent SpikeyBot instance. - Inherited From:
- Overrides:
- Source:
-
<protected> debug(msg)
-
Log using common.logDebug, but automatically set name.
Parameters:
Name Type Description msgstring 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 msgstring The message to log. - Inherited From:
- Overrides:
- Source:
-
getSettings(gId)
-
Obtain reference to settings object for a guild.
Parameters:
Name Type Description gIdstring The ID of the guild to fetch the settings for. Returns:
Settings object, creates one with default settings first if it doesn't exist.- Type
- ModLog~Settings
-
<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 msgstring The message to log. - Inherited From:
- Overrides:
- Source:
-
output(guild, action [, user] [, owner] [, message] [, message2] [, msgs])
-
Log a message in a guild.
Parameters:
Name Type Argument Default Description guildDiscord~Guild The guild the action took place in. actionstring The action that was performed. userDiscord~User <optional>
<nullable>
null User that was affected, or null of no user was affected. ownerDiscord~User <optional>
<nullable>
null User that performed the action. Null is for ourself. messagestring <optional>
null Additional information to attach to the log message. message2string <optional>
null Additional information to attach to the log message. msgsstring <optional>
<repeatable>
Additional messages to attach to the log. -
<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:
-
- SubModule~unloadable
Returns:
True if can be reloaded, false if cannot.- Type
- boolean
-
save( [opt])
-
Saves all data to files necessary for saving current state.
Parameters:
Name Type Argument Default Description optstring <optional>
'sync' Can be 'async', otherwise defaults to synchronous. - Inherited From:
- Overrides:
- Source:
-
setLogChannel(gId, cId)
-
Set the log channel for a guild.
Parameters:
Name Type Argument Description gIdstring ID of the guild to change the setting for. cIdstring <nullable>
The ID of the channel to set as the output channel. -
<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:
-
- SubModule~reloadable
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 msgstring The message to log. - Inherited From:
- Overrides:
- Source: