You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: messages.go
    path of file: ./repos/highlight/backend/alerts/integrations/discord
    
    the code of the file until where you have to start completion: package discord

import (
	"fmt"
	"strconv"
	"strings"

	"github.com/bwmarrin/discordgo"
	"github.com/highlight-run/highlight/backend/alerts/integrations"
)

func newMessageEmbed() *discordgo.MessageEmbed {
	return &discordgo.MessageEmbed{
		Color: 0x6c37f4,
	}
}

var RED_ALERT = 0x961e13
var YELLOW_ALERT = 0xf2c94c

var highlightEmoji = discordgo.ComponentEmoji{
	Name:     "highlight",
	ID:       "1094349627953778788",
	Animated: false,
}

func (bot *Bot) SendErrorAlert(channelId string, payload integrations.ErrorAlertPayload) error {
	fields := []*discordgo.MessageEmbedField{}

	if payload.VisitedURL != "" {
		fields = append(fields, &discordgo.MessageEmbedField{
			Name:   "Visited URL",
			Value:  payload.VisitedURL,
			Inline: false,
		})
	}

	errorTitle := payload.ErrorTitle
	if len(errorTitle) > 50 {
		errorTitle = errorTitle[:50] + "..."
	}
	fields = append(fields, &discordgo.MessageEmbedField{
		Name:   "Error",
		Value:  errorTitle,
		Inline: true,
	})

	fields = append(fields, &discordgo.MessageEmbedField{
		Name:   "Error count",
		Value:  strconv.FormatInt(payload.ErrorCount, 10),
		Inline: true,
	})

	embed := newMessageEmbed()
	if payload.FirstTimeAlert {
		embed.Title = "Highlight Error Alert (New Occurence ❇️)"
		embed.Color = YELLOW_ALERT
	} else {
		embed.Title = "Highlight Error Alert"
		embed.Color = RED_ALERT
	}

	embed.Description = payload.UserIdentifier
	embed.Fields = fields

	sessionLabel := "View Session"
	displayMissingSessionLabel := payload.SessionSecureID == "" || payload.SessionExcluded
	if displayMissingSessionLabel {
		sessionLabel = "No recorded session"
	}

	messageSend := discordgo.MessageSend{
		Embeds: []*discordgo.MessageEmbed{
			embed,
		},
		Components: []discordgo.MessageComponent{
			discordgo.ActionsRow{
				Components: []discordgo.MessageComponent{
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    sessionLabel,
						Style:    discordgo.LinkButton,
						Disabled: displayMissingSessionLabel,
						URL:      payload.SessionURL,
					},
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    "View Error",
						Style:    discordgo.LinkButton,
						Disabled: false,
						URL:      payload.Err
    
func (bot *Bot) SendErrorAlert(channelId string, payload integrations.ErrorAlertPayload) error {
	fields := []*discordgo.MessageEmbedField{}

	if payload.VisitedURL != "" {
		fields = append(fields, &discordgo.MessageEmbedField{
			Name:   "Visited URL",
			Value:  payload.VisitedURL,
			Inline: false,
		})
	}

	errorTitle := payload.ErrorTitle
	if len(errorTitle) > 50 {
		errorTitle = errorTitle[:50] + "..."
	}
	fields = append(fields, &discordgo.MessageEmbedField{
		Name:   "Error",
		Value:  errorTitle,
		Inline: true,
	})

	fields = append(fields, &discordgo.MessageEmbedField{
		Name:   "Error count",
		Value:  strconv.FormatInt(payload.ErrorCount, 10),
		Inline: true,
	})

	embed := newMessageEmbed()
	if payload.FirstTimeAlert {
		embed.Title = "Highlight Error Alert (New Occurence ❇️)"
		embed.Color = YELLOW_ALERT
	} else {
		embed.Title = "Highlight Error Alert"
		embed.Color = RED_ALERT
	}

	embed.Description = payload.UserIdentifier
	embed.Fields = fields

	sessionLabel := "View Session"
	displayMissingSessionLabel := payload.SessionSecureID == "" || payload.SessionExcluded
	if displayMissingSessionLabel {
		sessionLabel = "No recorded session"
	}

	messageSend := discordgo.MessageSend{
		Embeds: []*discordgo.MessageEmbed{
			embed,
		},
		Components: []discordgo.MessageComponent{
			discordgo.ActionsRow{
				Components: []discordgo.MessageComponent{
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    sessionLabel,
						Style:    discordgo.LinkButton,
						Disabled: displayMissingSessionLabel,
						URL:      payload.SessionURL,
					},
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    "View Error",
						Style:    discordgo.LinkButton,
						Disabled: false,
						URL:      payload.ErrorURL,
					},
				},
			},
			discordgo.ActionsRow{
				Components: []discordgo.MessageComponent{
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    "Resolve Error",
						Style:    discordgo.LinkButton,
						Disabled: false,
						URL:      payload.ErrorResolveURL,
					},
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    "Ignore Error",
						Style:    discordgo.LinkButton,
						Disabled: false,
						URL:      payload.ErrorIgnoreURL,
					},
					discordgo.Button{
						Emoji:    highlightEmoji,
						Label:    "Snooze Error",
						Style:    discordgo.LinkButton,
						Disabled: false,
						URL:      payload.ErrorSnoozeURL,
					},
				},
			},
		},
	}

	_, err := bot.Session.ChannelMessageSendComplex(channelId, &messageSend)
	return err
}