|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
@ -45,12 +47,24 @@ func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAd
|
|
|
|
|
//White as fallback
|
|
|
|
|
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(
|
|
|
|
|
starChannel,
|
|
|
|
|
&discordgo.MessageEmbed{
|
|
|
|
|
Title: "Starred Message",
|
|
|
|
|
Description: msg.Content,
|
|
|
|
|
URL: "https://discordapp.com/channels/" + m.GuildID + "/" + m.ChannelID + "/" + m.MessageID,
|
|
|
|
|
Description: content,
|
|
|
|
|
Color: color,
|
|
|
|
|
Timestamp: messageTimestamp.Format(time.RFC3339),
|
|
|
|
|
Author: &discordgo.MessageEmbedAuthor{
|
|
|
|
|