mirror-nourybot/pkg/commands/ping.go

19 lines
408 B
Go
Raw Normal View History

2021-10-19 22:39:22 +02:00
package commands
import (
"fmt"
"github.com/lyx0/nourybot/cmd/bot"
2021-10-19 22:45:01 +02:00
"github.com/lyx0/nourybot/pkg/humanize"
"github.com/lyx0/nourybot/pkg/utils"
2021-10-19 22:39:22 +02:00
)
func Ping(target string, nb *bot.Bot) {
2021-10-19 22:45:01 +02:00
commandCount := fmt.Sprint(utils.GetCommandsUsed())
botUptime := humanize.Time(nb.Uptime)
2021-10-19 22:39:22 +02:00
2021-10-20 00:33:31 +02:00
reply := fmt.Sprintf("Pong! :) Commands used: %v, Last restart: %v", commandCount, botUptime)
2021-10-19 22:39:22 +02:00
nb.Send(target, reply)
}