Newer
Older
GoModules / PluginSystem / plugins / example / example_echo.go
root on 25 Jun 2022 525 bytes simple plugin system added
  1. package example
  2.  
  3. import (
  4. //"fmt"
  5. "PluginExample/plugins"
  6. )
  7.  
  8. func echo(msg string)string {
  9. result := "returning: " + msg
  10. return result
  11. }
  12.  
  13. func init() {
  14.  
  15. var commands plugins.Command
  16. commands.Name = "!echo"
  17. commands.Callback = func(args ...interface{})(string) {
  18. result := echo(args[0].(string))
  19. return result
  20. }
  21.  
  22. var p plugins.PluginInfo
  23. p.Name = "Example Echo"
  24. p.About = "Example plugin to repeat what is sent to it"
  25. p.Commands = commands
  26. p.AddPluginInfo()
  27. }
Buy Me A Coffee