Function
Static Public Summary | ||
public |
Provides a bridge to provide configuration data for command configurators. |
|
public |
expectDM(): middlewareLayer Middleware which filters out messages not received in a DM context. |
|
public |
expectGroupDM(): middlewareLayer Middleware which filters out messages not received in a group DM context. |
|
public |
expectGuild(): middlewareLayer Middleware which filters out messages not received in a guild context. |
|
public |
expectPermissions(permissions: ...PermissionResolvable): middlewareLayer Middleware which filters out messages based on user permissions. |
|
public |
expectRole(identifiers: ...string): middlewareLayer Middleware which filters out messages based on user role IDs or names. |
|
public |
expectUser(identifiers: ...string): middlewareLayer Middleware which filters out messages based on user IDs or usernames and discriminators. |
Static Public
public configure(configuration: Object): Function source
import configure from 'ghastly/src/core/configure.js'
Provides a bridge to provide configuration data for command configurators.
Consumes a config object containing the configuration data and produces a
function. This function consumes a configurator and returns another configurator
with the given configuration applied to it.
Several configure()
calls can be made successively on the returned configurator,
with the outer config objects overwriting the keys in the innermost configs.
Params:
Name | Type | Attribute | Description |
configuration | Object | An object containing the configuration data to pass to the command configurator. |
Return:
Function | A function consuming a configurator and producing another configurator with the provided config applied to it. |
Throw:
Thrown if the given configuration is not a plain object. |
public expectDM(): middlewareLayer source
import expectDM from 'ghastly/src/middleware/expectDM.js'
Middleware which filters out messages not received in a DM context.
Return:
middlewareLayer | The layer which filters the messages. |
public expectGroupDM(): middlewareLayer source
import expectGroupDM from 'ghastly/src/middleware/expectGroupDM.js'
Middleware which filters out messages not received in a group DM context.
Return:
middlewareLayer | The layer which filters the messages. |
public expectGuild(): middlewareLayer source
import expectGuild from 'ghastly/src/middleware/expectGuild.js'
Middleware which filters out messages not received in a guild context.
Return:
middlewareLayer | The layer which filters the messages. |
public expectPermissions(permissions: ...PermissionResolvable): middlewareLayer source
import expectPermissions from 'ghastly/src/middleware/expectPermissions.js'
Middleware which filters out messages based on user permissions. Members must possess all of the given permissions to pass the filter. Only filters out messages if in a guild context.
Params:
Name | Type | Attribute | Description |
permissions | ...PermissionResolvable | The permissions required to pass the filter. |
Return:
middlewareLayer | The layer which filters the messages. |
Throw:
Thrown if the permissions aren't the right type. |
Example:
expectPermissions(
'MUTE_MEMBERS',
'DEAFEN_MEMBERS',
);
public expectRole(identifiers: ...string): middlewareLayer source
import expectRole from 'ghastly/src/middleware/expectRole.js'
Middleware which filters out messages based on user role IDs or names. Only filters out messages if in a guild context.
Params:
Name | Type | Attribute | Description |
identifiers | ...string | The role IDs or names which are allowed to pass the filter. |
Return:
middlewareLayer | The layer which filters the messages. |
Throw:
Thrown if the identifiers aren't strings. |
Example:
expectRole(
'750315226641451132',
'Batman',
);
public expectUser(identifiers: ...string): middlewareLayer source
import expectUser from 'ghastly/src/middleware/expectUser.js'
Middleware which filters out messages based on user IDs or usernames and discriminators.
Params:
Name | Type | Attribute | Description |
identifiers | ...string | The user IDs or username/discriminator values that are allowed to pass the filter. |
Return:
middlewareLayer | The layer which filters the messages. |
Throw:
Thrown if the identifiers aren't strings. |
Example:
expectUser(
'275532051244111663',
'LiamNeeson#5364',
);