fixed sticky message ignoring bot messages
This commit is contained in:
@@ -76,7 +76,9 @@ var sticky_command Command = Command{
|
|||||||
text := i.ModalSubmitData().Components[0].(*discordgo.ActionsRow).Components[0].(*discordgo.TextInput).Value
|
text := i.ModalSubmitData().Components[0].(*discordgo.ActionsRow).Components[0].(*discordgo.TextInput).Value
|
||||||
message, err := s.ChannelMessageSendEmbed(i.ChannelID, &discordgo.MessageEmbed{
|
message, err := s.ChannelMessageSendEmbed(i.ChannelID, &discordgo.MessageEmbed{
|
||||||
Type: discordgo.EmbedTypeArticle,
|
Type: discordgo.EmbedTypeArticle,
|
||||||
Title: ":pushpin: Sticky message",
|
Footer: &discordgo.MessageEmbedFooter{
|
||||||
|
Text: "📌 Sticky message",
|
||||||
|
},
|
||||||
Color: hexToDecimal(color["primary"]),
|
Color: hexToDecimal(color["primary"]),
|
||||||
Description: text,
|
Description: text,
|
||||||
})
|
})
|
||||||
|
@@ -5,12 +5,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
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) {
|
if hasSticky(m.GuildID, m.ChannelID) {
|
||||||
s.ChannelMessageDelete(m.ChannelID, getStickyMessageID(m.GuildID, m.ChannelID))
|
s.ChannelMessageDelete(m.ChannelID, getStickyMessageID(m.GuildID, m.ChannelID))
|
||||||
stickyMessage, _ := s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
|
stickyMessage, _ := s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
|
||||||
Type: discordgo.EmbedTypeArticle,
|
Type: discordgo.EmbedTypeArticle,
|
||||||
Title: ":pushpin: Sticky message",
|
Footer: &discordgo.MessageEmbedFooter{
|
||||||
|
Text: "📌 Sticky message",
|
||||||
|
},
|
||||||
Color: hexToDecimal(color["primary"]),
|
Color: hexToDecimal(color["primary"]),
|
||||||
Description: getStickyMessageContent(m.GuildID, m.ChannelID),
|
Description: getStickyMessageContent(m.GuildID, m.ChannelID),
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user