Added !source command
This commit is contained in:
parent
2674645475
commit
b852b02aed
@ -33,6 +33,7 @@ var (
|
|||||||
command.NewPingHandler(),
|
command.NewPingHandler(),
|
||||||
command.NewRollHandler(),
|
command.NewRollHandler(),
|
||||||
command.NewRouletteHandler(),
|
command.NewRouletteHandler(),
|
||||||
|
command.NewSourceHandler(),
|
||||||
command.NewTimeHandler(),
|
command.NewTimeHandler(),
|
||||||
command.NewWeatherHandler(),
|
command.NewWeatherHandler(),
|
||||||
}
|
}
|
||||||
|
37
command/source.go
Normal file
37
command/source.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/bwmarrin/discordgo"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SourceURI = "https://git.kill0.net/chill9/bb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
SourceHandler struct {
|
||||||
|
config Config
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewSourceHandler() *SourceHandler {
|
||||||
|
return new(SourceHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *SourceHandler) SetConfig(config Config) {
|
||||||
|
h.config = config
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *SourceHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
|
if m.Author.ID == s.State.User.ID {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.HasPrefix(m.Content, "!source") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
s.ChannelMessageSend(m.ChannelID, SourceURI)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user