constructor

Abstract class

Every feature that will be used on Raccoon must be extends to the Feature class

new constructor(id: any)
Parameters
id (any) A unique identity that distinguishes each feature from a different owner

start

Abstract Method Methods must be implemented in classes that extend to the Feature class.

The start method is the method used to initialize the first response of a feature instance. Returns the response template.

start()

run

Executes the methods available on the feature Object by using the method name

run(method: string, params: string, context: any)
Parameters
method (string)
params (string)
context (any)

durration

calculate how long a method is running

durration

isSessionExpired

Returns true if the method has been running longer than session time

isSessionExpired()

cleanupActivity

Tells 'Raccoons' to immediately remove expired methods from the activity state

cleanupActivity()

constructor

Raccoon constructor

constructor(token: string, options: Object)
Parameters
token (string)
options (Object)

registerFeature

Register features to ActivityState to be called later

registerFeature(owner: any, feature: Feature)
Parameters
owner (any) owner of features
feature (Feature) instance of Feature Class

getToken

create token

getToken(owner: any, featureName: any)
Parameters
owner (any)
featureName (any)

isActivityActive

check token is active

isActivityActive(token: string)
Parameters
token (string)

activateActivity

activate token

activateActivity(token: string)
Parameters
token (string)

deactivateActivity

deactivate token

deactivateActivity(token: string)
Parameters
token (string)

start

Starting a feature as an activity

start(token: string, feature: Feature)
Parameters
token (string)
feature (Feature)

watchFeatureCallback

Watch callback queries from every keyboard in the feature class

watchFeatureCallback()

getActivity

Returns activities based on owner and feature names

getActivity(owner: string, name: string)
Parameters
owner (string)
name (string)

_handleCallbackQuery

Handles actions from callback data

_handleCallbackQuery(context: Object)
Parameters
context (Object)

_handleResponse

Handling responses based on a template

_handleResponse(response: Object, context: Object)
Parameters
response (Object)
context (Object)

$send

Send messages to the telegram

$send(resp: Object)
Parameters
resp (Object)

$edit

Edit telegram message

$edit(resp: Object, context: Object)
Parameters
resp (Object)
context (Object)

$delete

Delete telegram message

$delete(resp: Object, context: Object)
Parameters
resp (Object)
context (Object)

$answer

Send answer callbackQuery

$answer(resp: Object, context: Object)
Parameters
resp (Object)
context (Object)

cleanup

Remove activity from state

cleanup(owner: string, name: string)
Parameters
owner (string)
name (string)

makeButton

Make Inline Button

makeButton(text: string, callbackData: Object)
Parameters
text (string)
callbackData (Object)

toogleCheckIcon

Toogle check icon from given text

toogleCheckIcon(text: string)
Parameters
text (string)

encodePosition

Encode keyboard positition to string formated

encodePosition(row: int, col: int)
Parameters
row (int)
col (int)

decodePosition

Decode params to keyboard postition

decodePosition(dataPosition: string)
Parameters
dataPosition (string)

decodeCallbackData

decode callback data

decodeCallbackData(data: string)
Parameters
data (string)