Skip to content

Commit

Permalink
fix: fixed analyze command
Browse files Browse the repository at this point in the history
  • Loading branch information
reonardoleis committed Apr 5, 2024
1 parent 7292d4b commit 70fda04
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/discord/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,16 @@ func analyze(s *discordgo.Session, m *discordgo.MessageCreate) error {

message := ""
for _, mm := range messages {
if mm.Author.ID == m.Author.ID && !strings.HasPrefix(mm.Content, "!") {
message = m.Content
if mm.Author.ID == m.Author.ID &&
!strings.HasPrefix(mm.Content, "!") &&
len(mm.Content) > 10 {
message = mm.Content
break
}
}

if message == "" {
_, err = s.ChannelMessageSend(m.ChannelID, "No messages found")
_, err = s.ChannelMessageSend(m.ChannelID, "No suitable message found")
if err != nil {
log.Println("discord: error sending message:", err)
return err
Expand Down

0 comments on commit 70fda04

Please sign in to comment.