diff --git a/cmd_sticky.go b/cmd_sticky.go index b1c2f75..804dc77 100644 --- a/cmd_sticky.go +++ b/cmd_sticky.go @@ -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, }) diff --git a/handle_messages.go b/handle_messages.go index e222dca..cc2bbcd 100644 --- a/handle_messages.go +++ b/handle_messages.go @@ -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), })