Files
acecore/cmd_autopublish.go
2024-03-05 14:38:28 +01:00

23 lines
783 B
Go

package main
import "github.com/bwmarrin/discordgo"
var cmd_autopublish Command = Command{
Definition: discordgo.ApplicationCommand{
Name: "autopublish",
Description: "Toggle automatically publishing every post in a announcement channel",
},
Interact: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
channel, _ := s.State.Channel(i.ChannelID)
if channel.Type == discordgo.ChannelTypeGuildNews {
if toggleAutoPublish(i.GuildID, i.ChannelID) {
respondEphemeral(s, i.Interaction, "Autopublishing is now disabled on <#"+i.ChannelID+">")
} else {
respondEphemeral(s, i.Interaction, "Autopublishing is now enabled on <#"+i.ChannelID+">")
}
} else {
respondEphemeral(s, i.Interaction, "This is not an announcement channel!")
}
},
}