ALFRED/test.go

41 lines
745 B
Go

package main
import (
tb "gopkg.in/tucnak/telebot.v2"
"log"
)
type plugin string
func (g plugin) GetCommands() []string {
return []string{"ping", "test"}
}
func (g plugin) Load() bool {
log.Println("plugin test loaded!")
return true
}
func (g plugin) HandleMessage(bot *tb.Bot, msg *tb.Message) {
log.Println("plugin test message: " + msg.Text)
}
func (g plugin) HandleCommand(bot *tb.Bot, msg *tb.Message, cmd string, args []string) {
if cmd == "ping" {
bot.Send(msg.Chat, "pong!")
}
argsS := ""
for _, arg := range args {
argsS = argsS + " " + arg
}
log.Print("plugin test cmd: " + cmd + " (args:" + argsS + ")")
}
func (g plugin) Unload() bool {
log.Println("plugin test unloaded!")
return true
}
var Plugin plugin