Newer
Older
GoModules / PluginSystem / plugins / misc / help.go
root on 25 Jun 2022 835 bytes simple plugin system added
  1. package misc
  2.  
  3. import (
  4. //"fmt"
  5. "PluginExample/plugins"
  6. )
  7.  
  8. func misc_help(msg string)string {
  9. var result string
  10. for _, element := range plugins.Plugins {
  11.  
  12. result += "cmd:" + element.Commands.Name + ", "
  13. result += "name:" + element.Name + "\n"
  14. result += "about:" + element.About + "\n\n"
  15. //element.Commands[0].Callback()
  16.  
  17. //result += "cmd:", key, "=>", "info:", element
  18. }
  19.  
  20. return result
  21. }
  22.  
  23. func init() {
  24.  
  25. var commands plugins.Command
  26. commands.Name = "!help"
  27. commands.Callback = func(args ...interface{})(string) {
  28. result := misc_help(args[0].(string))
  29. return result
  30. }
  31.  
  32. var p plugins.PluginInfo
  33. p.Name = "Help"
  34. p.About = "Display all plugins informaion"
  35. p.Commands = commands
  36. p.AddPluginInfo()
  37. }
Buy Me A Coffee