Add /about command
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
4a3bf65100
commit
dfe53d2f6a
|
@ -0,0 +1,39 @@
|
|||
package about
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"go.elara.ws/owobot/internal/systems/commands"
|
||||
)
|
||||
|
||||
const aboutTmpl = `**Copyright © %d owobot contributors**
|
||||
|
||||
This program comes with **ABSOLUTELY NO WARRANTY**. This is free software, and you are welcome to redistribute it under certain conditions. See [here](https://www.gnu.org/licenses/agpl-3.0.html) for details.
|
||||
|
||||
**Source Code:**
|
||||
https://gitea.elara.ws/owobot/owobot
|
||||
**GitHub Mirror:**
|
||||
https://github.com/owobot-org/owobot`
|
||||
|
||||
func Init(s *discordgo.Session) error {
|
||||
commands.Register(s, aboutCmd, &discordgo.ApplicationCommand{
|
||||
Name: "about",
|
||||
Description: "Information about owobot",
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func aboutCmd(s *discordgo.Session, i *discordgo.InteractionCreate) error {
|
||||
return s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
Embeds: []*discordgo.MessageEmbed{{
|
||||
Title: "About owobot",
|
||||
Description: fmt.Sprintf(aboutTmpl, time.Now().Year()),
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
2
main.go
2
main.go
|
@ -28,6 +28,7 @@ import (
|
|||
"go.elara.ws/logger"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/owobot/internal/db"
|
||||
"go.elara.ws/owobot/internal/systems/about"
|
||||
"go.elara.ws/owobot/internal/systems/commands"
|
||||
"go.elara.ws/owobot/internal/systems/eventlog"
|
||||
"go.elara.ws/owobot/internal/systems/guilds"
|
||||
|
@ -94,6 +95,7 @@ func main() {
|
|||
vetting.Init,
|
||||
reactions.Init,
|
||||
roles.Init,
|
||||
about.Init,
|
||||
commands.Init, // The commands system should always go last
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue