Newer
Older
GoModules / PluginSystem / plugins / misc / help.go
root on 25 Jun 2022 835 bytes simple plugin system added
package misc

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

func misc_help(msg string)string {
    var result string
        for _, element := range plugins.Plugins {

            result += "cmd:" + element.Commands.Name + ", "
            result += "name:" + element.Name + "\n"
            result += "about:" + element.About + "\n\n"
            //element.Commands[0].Callback()

            //result += "cmd:", key, "=>", "info:", element
        }

    return result
}

func init() {

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

    var p plugins.PluginInfo
    p.Name = "Help"
    p.About = "Display all plugins informaion"
    p.Commands = commands
    p.AddPluginInfo()
}