somewhat fix history, fix multiline replies
This commit is contained in:
parent
41d3a6608f
commit
1e45d360b4
|
@ -2,7 +2,6 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -20,7 +19,7 @@ func GetHistory(limit int, channel string) {
|
|||
return
|
||||
}
|
||||
|
||||
messages, err := client.Messages(discord.ChannelID(parsedChannelId), 50)
|
||||
messages, err := client.Messages(discord.ChannelID(parsedChannelId), 100)
|
||||
if err != nil {
|
||||
fmt.Print("<failed to get messages: ", err.Error(), ">\n\r")
|
||||
return
|
||||
|
@ -30,6 +29,8 @@ func GetHistory(limit int, channel string) {
|
|||
messages[i], messages[j] = messages[j], messages[i]
|
||||
}
|
||||
|
||||
state.SetInPrompt(true)
|
||||
|
||||
fmt.Print("--Beginning-Review", strings.Repeat("-", 62), "\n\r")
|
||||
|
||||
lines := make([]string, 0)
|
||||
|
@ -41,12 +42,17 @@ func GetHistory(limit int, channel string) {
|
|||
}
|
||||
|
||||
length := len(lines)
|
||||
startIndex := int(math.Max(float64(0), float64(length - limit)))
|
||||
for _, line := range lines[startIndex:] {
|
||||
fmt.Print(line)
|
||||
startIndex := length - limit
|
||||
if startIndex < 0 {
|
||||
startIndex = 0
|
||||
}
|
||||
for i := startIndex; i < length; i++ {
|
||||
fmt.Print(lines[i])
|
||||
}
|
||||
|
||||
fmt.Print("--Review-Complete", strings.Repeat("-", 63), "\n\r")
|
||||
|
||||
state.SetInPrompt(false)
|
||||
}
|
||||
|
||||
func HistoryCommand() {
|
||||
|
|
|
@ -495,6 +495,8 @@ func ProcessMessage(msg discord.Message, options MessageOptions) []string {
|
|||
options.Stickers = msg.Stickers
|
||||
if i == 0 {
|
||||
options.Reply = msg.ReferencedMessage
|
||||
} else {
|
||||
options.Reply = nil
|
||||
}
|
||||
options.Timestamp = time.Time(msg.Timestamp)
|
||||
options.IsMention = isPing
|
||||
|
|
Loading…
Reference in New Issue