handler

package
v0.0.0-...-2e7725e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2017 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Provides a simple way to handle a potential command from a message sent by a user.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCommand

func HandleCommand(Command string)

Handles a command by passing it to a commandHandler with the arguments from Slice(..), a replytoken, and a client. The last two is given by the creator. The client will either be replying with a response message, or none (because of an error/nonexistent command).

Example
//...
switch message := event.Message.(type) {
case *linebot.TextMessage:
	handler.HandleCommand(message.Text, replyToken, bot)
}
Output:

none (nothing)

func InsensitiveSlice

func InsensitiveSlice(Command string) []string

Splits the message into a potential command arguments that is separated based on whitespace. This also makes the command case-insensitive.

func SensitiveSlice

func SensitiveSlice(Command string) []string

Splits the message into a potential command arguments that is separated based on whitespace. The case of the command remains unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL