Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &commands.YAGCommand{ CmdCategory: commands.CategoryTool, Name: "Calc", Aliases: []string{"c", "calculate"}, Description: "Calculator 2+2=5", RunInDM: true, RequiredArgs: 1, Arguments: []*dcmd.ArgDef{ &dcmd.ArgDef{Name: "Expression", Type: dcmd.String}, }, RunFunc: func(data *dcmd.Data) (interface{}, error) { computeLock.Lock() defer computeLock.Unlock() toCompute := data.Args[0].Str() toCompute = replacer.Replace(toCompute) result, err := compute.Evaluate(toCompute) if err != nil { return err, err } return fmt.Sprintf("Result: `%f`", result), nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.