MessageHandler
Vocality Documentation › Globals › MessageHandler
Hierarchy
- MessageHandler
Index
Constructors
Properties
Methods
- addCustomListener
- addListeners
- emitCustomEvent
- getCommandFromName
- getSubCommand
- handleMessage
- handleMessageUpdate
- processMessage
- validateMessage
Constructors
constructor
+ new MessageHandler(bot
: BotClient): MessageHandler
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:9
Parameters:
Name | Type |
---|---|
bot | BotClient |
Returns: MessageHandler
Properties
Private
bot
• bot: BotClient
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:9
Methods
addCustomListener
▸ addCustomListener(event
: string, callback
: Function): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:23
Parameters:
Name | Type |
---|---|
event | string |
callback | Function |
Returns: void
Private
addListeners
▸ addListeners(): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:16
Returns: void
emitCustomEvent
▸ emitCustomEvent(event
: string, ...args
: any[]): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:27
Parameters:
Name | Type |
---|---|
event | string |
...args | any[] |
Returns: void
Private
getCommandFromName
▸ getCommandFromName(guildId
: string, commandText
: string): Command | undefined
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:110
Returns the command if found. Also checks for aliases
Parameters:
Name | Type |
---|---|
guildId | string |
commandText | string |
Returns: Command | undefined
Private
getSubCommand
▸ getSubCommand(command
: Command, commandText
: string): Command | undefined
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:128
Returns the subcommand if found. Also checks for aliases. This is needed to limit the search to a commands list of subcommands
Parameters:
Name | Type |
---|---|
command | Command |
commandText | string |
Returns: Command | undefined
handleMessage
▸ handleMessage(message
: Message): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:34
Processes every message sent on the server
Parameters:
Name | Type |
---|---|
message | Message |
Returns: void
Private
handleMessageUpdate
▸ handleMessageUpdate(message
: Message): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:49
Processes edited messages
Parameters:
Name | Type |
---|---|
message | Message |
Returns: void
Private
processMessage
▸ processMessage(message
: Message): void
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:79
Tries to find and execute a command
Parameters:
Name | Type |
---|---|
message | Message |
Returns: void
Private
validateMessage
▸ validateMessage(message
: Message): boolean
Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:63
Checks that the processed message does not come from a bot user and starts with the correct prefix
Parameters:
Name | Type |
---|---|
message | Message |
Returns: boolean