ball8

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: 8 Imported by: 1

Documentation

Overview

Provides a "yes/no" type reply when executed.

Index

Constants

This section is empty.

Variables

View Source
var SHA_HASH hash.Hash

Functions

func Execute

func Execute(Message string, ReplyToken string, Client *linebot.Client)

Provides an agree/disagree type of reply. This reply must be consistent if and only if the message is the exact same (ignoring the case) as before.

First, the user sends the bot a ball8 command with the message, then it gets evaluated by the commandHandler and eventually go to this Execute function.

Second, this Execute function works as follows: It creates a brand new sha1 hash to write into, then it writes the message into the hash, then finally it creates the SHA1 hash based on the data written.

Finally, it sums up every int value of every character in the sha1 hash string, then doing a modulo operation of length of the choices to get to the answer.

func Initialize

func Initialize()

Initializes the ball8 module; reading the choices file. usually this file is located in vendor/botUtils/commands/ball8/ball8.txt, but I think this hardcoding can be a little bit volatile (see?).

Types

This section is empty.

Jump to

Keyboard shortcuts

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