package handlers

import (
	"fmt"
	"github.com/brianvoe/gofakeit/v7"
	"github.com/bwmarrin/discordgo"
	"kleincordBot/services"
)

func MessageTest(s *discordgo.Session, m *discordgo.MessageCreate) {
	var serverListString string
	for i, server := range services.ServerList {
		serverListString = serverListString + fmt.Sprintf("\n %d) ", i+1) + server.Name
	}
	_, err := s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
		Title: "Servers",
		Fields: []*discordgo.MessageEmbedField{
			{
				Value: serverListString,
			},
		},
		Type: discordgo.EmbedTypeArticle,
	})
	if err != nil {
		services.HandleError(err, s)
	}
}

func MessageTest2(s *discordgo.Session, m *discordgo.MessageCreate) {

	_, err := s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
		Title: "Servers",
		Fields: []*discordgo.MessageEmbedField{
			{
				Value: "test",
			},
		},
		Type: discordgo.EmbedTypeArticle,
	})
	if err != nil {
		services.HandleError(err, s)
	}
}

func LoremIpsum(s *discordgo.Session, m *discordgo.MessageCreate) {
	for i := 0; i < 5; i++ {
		_, err := s.ChannelMessageSend(m.ChannelID, gofakeit.LoremIpsumParagraph(2, 10, 10, "\n\n")+"\n\n")
		if err != nil {
			services.HandleError(err, s)
		}
	}
}
