Documentation
¶
Overview ¶
Provides a "yes/no" type reply when executed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SHA_HASH hash.Hash
Functions ¶
func Execute ¶
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.