|
|
@ -1,6 +1,8 @@
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
@ -45,12 +47,24 @@ func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAd
|
|
|
|
//White as fallback
|
|
|
|
//White as fallback
|
|
|
|
color = 0xFFFFFF
|
|
|
|
color = 0xFFFFFF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
content := msg.Content[:1000]
|
|
|
|
|
|
|
|
//Up to 10 line
|
|
|
|
|
|
|
|
splittedContent := strings.SplitN(content, "\n", 11)
|
|
|
|
|
|
|
|
content = strings.Join(splittedContent[:10], "\n")
|
|
|
|
|
|
|
|
if len(splittedContent) > 10 || len(content) > 1000 {
|
|
|
|
|
|
|
|
content += "..."
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
content += fmt.Sprintf(
|
|
|
|
|
|
|
|
"\n\n[Original Message](https://discordapp.com/channels/%s/%s/%s)",
|
|
|
|
|
|
|
|
m.GuildID, m.ChannelID, m.MessageID,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err = s.ChannelMessageSendEmbed(
|
|
|
|
msg, err = s.ChannelMessageSendEmbed(
|
|
|
|
starChannel,
|
|
|
|
starChannel,
|
|
|
|
&discordgo.MessageEmbed{
|
|
|
|
&discordgo.MessageEmbed{
|
|
|
|
Title: "Starred Message",
|
|
|
|
Title: "Starred Message",
|
|
|
|
Description: msg.Content,
|
|
|
|
Description: content,
|
|
|
|
URL: "https://discordapp.com/channels/" + m.GuildID + "/" + m.ChannelID + "/" + m.MessageID,
|
|
|
|
|
|
|
|
Color: color,
|
|
|
|
Color: color,
|
|
|
|
Timestamp: messageTimestamp.Format(time.RFC3339),
|
|
|
|
Timestamp: messageTimestamp.Format(time.RFC3339),
|
|
|
|
Author: &discordgo.MessageEmbedAuthor{
|
|
|
|
Author: &discordgo.MessageEmbedAuthor{
|
|
|
|