Newer
Older
GoModules / PluginSystem / plugins / example / example_echo.go
root on 25 Jun 2022 525 bytes simple plugin system added
package example

import (
    //"fmt"
    "PluginExample/plugins"
)

func echo(msg string)string {
    result := "returning: " + msg
    return result
}

func init() {

    var commands plugins.Command
    commands.Name = "!echo"
    commands.Callback = func(args ...interface{})(string) {
       result := echo(args[0].(string))
       return result
    }

    var p plugins.PluginInfo
    p.Name = "Example Echo"
    p.About = "Example plugin to repeat what is sent to it"
    p.Commands = commands
    p.AddPluginInfo()
}