MessageHandler

Vocality DocumentationGlobalsMessageHandler

Hierarchy

  • MessageHandler

Index

Constructors

Properties

Methods

Constructors

constructor

+ new MessageHandler(bot: BotClient): MessageHandler

Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:9

Parameters:

NameType
botBotClient

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:

NameType
eventstring
callbackFunction

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:

NameType
eventstring
...argsany[]

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:

NameType
guildIdstring
commandTextstring

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:

NameType
commandCommand
commandTextstring

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:

NameType
messageMessage

Returns: void


Private handleMessageUpdate

handleMessageUpdate(message: Message): void

Defined in packages/vocality-core/src/bot/input-handlers/MessageHandler.ts:49

Processes edited messages

Parameters:

NameType
messageMessage

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:

NameType
messageMessage

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:

NameType
messageMessage

Returns: boolean