t
This commit is contained in:
+3
-12
@@ -3,6 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -77,33 +78,23 @@ var Pinned tempest.Command = tempest.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := itx.Client.CrosspostMessage(itx.ChannelId, channelData.MessageOfTheDay.Message.Id); err != nil {
|
|
||||||
fmt.Println("error crosspost", err)
|
|
||||||
itx.SendLinearReply(err.Error(), true)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if err := itx.SendReply(tempest.ResponseData{
|
if err := itx.SendReply(tempest.ResponseData{
|
||||||
Content: formatMessageContent(channelData.MessageOfTheDay.Message),
|
Content: formatMessageContent(channelData.MessageOfTheDay.Message),
|
||||||
}, false); err != nil {
|
}, false); err != nil {
|
||||||
fmt.Println("error send reply", err)
|
log.Printf("failed to send reply with the pinned message: %s",err.Error())
|
||||||
itx.SendLinearReply(err.Error(), true)
|
itx.SendLinearReply(err.Error(), true)
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatMessageContent(m tempest.Message) string {
|
func formatMessageContent(m tempest.Message) string {
|
||||||
lines := []string{
|
lines := []string{
|
||||||
">>> pin du jour",
|
">>> **PIN DU JOUR**",
|
||||||
fmt.Sprintf("par **%s** le %s", m.Author.Username, m.Timestamp.Format("02/01/2006 15:04")),
|
fmt.Sprintf("par **%s** le %s", m.Author.Username, m.Timestamp.Format("02/01/2006 15:04")),
|
||||||
"-",
|
|
||||||
m.Content,
|
m.Content,
|
||||||
m.Author.AvatarHash,
|
m.Author.AvatarHash,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return strings.Join(lines, "\n")
|
return strings.Join(lines, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user