package handlers

import (
	"fmt"
	"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)
	}
}
