added new tool function

This commit is contained in:
2024-03-05 14:38:28 +01:00
parent c90e2d59fc
commit 34b0f95464
6 changed files with 24 additions and 98 deletions

View File

@@ -11,30 +11,12 @@ var cmd_autopublish Command = Command{
channel, _ := s.State.Channel(i.ChannelID)
if channel.Type == discordgo.ChannelTypeGuildNews {
if toggleAutoPublish(i.GuildID, i.ChannelID) {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Autopublishing is now disabled on <#" + i.ChannelID + ">",
Flags: discordgo.MessageFlagsEphemeral,
},
})
respondEphemeral(s, i.Interaction, "Autopublishing is now disabled on <#"+i.ChannelID+">")
} else {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Autopublishing is now enabled on <#" + i.ChannelID + ">",
Flags: discordgo.MessageFlagsEphemeral,
},
})
respondEphemeral(s, i.Interaction, "Autopublishing is now enabled on <#"+i.ChannelID+">")
}
} else {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "This is not an announcement channel!",
Flags: discordgo.MessageFlagsEphemeral,
},
})
respondEphemeral(s, i.Interaction, "This is not an announcement channel!")
}
},
}