fixed sticky message ignoring bot messages
This commit is contained in:
@@ -75,8 +75,10 @@ var sticky_command Command = Command{
|
||||
ModalSubmit: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
text := i.ModalSubmitData().Components[0].(*discordgo.ActionsRow).Components[0].(*discordgo.TextInput).Value
|
||||
message, err := s.ChannelMessageSendEmbed(i.ChannelID, &discordgo.MessageEmbed{
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
Title: ":pushpin: Sticky message",
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
Footer: &discordgo.MessageEmbedFooter{
|
||||
Text: "📌 Sticky message",
|
||||
},
|
||||
Color: hexToDecimal(color["primary"]),
|
||||
Description: text,
|
||||
})
|
||||
|
@@ -5,12 +5,14 @@ import (
|
||||
)
|
||||
|
||||
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
if m.Author.ID != s.State.User.ID {
|
||||
if len(m.Embeds) == 0 || m.Embeds[0].Footer == nil || m.Embeds[0].Footer.Text != "📌 Sticky message" {
|
||||
if hasSticky(m.GuildID, m.ChannelID) {
|
||||
s.ChannelMessageDelete(m.ChannelID, getStickyMessageID(m.GuildID, m.ChannelID))
|
||||
stickyMessage, _ := s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
Title: ":pushpin: Sticky message",
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
Footer: &discordgo.MessageEmbedFooter{
|
||||
Text: "📌 Sticky message",
|
||||
},
|
||||
Color: hexToDecimal(color["primary"]),
|
||||
Description: getStickyMessageContent(m.GuildID, m.ChannelID),
|
||||
})
|
||||
|
Reference in New Issue
Block a user