|
|
package main
|
|
|
|
|
|
import "github.com/bwmarrin/discordgo"
|
|
|
|
|
|
type embed struct {
|
|
|
*discordgo.MessageEmbed
|
|
|
}
|
|
|
|
|
|
func newEmbed() *embed {
|
|
|
return &embed{&discordgo.MessageEmbed{}}
|
|
|
}
|
|
|
|
|
|
func (e *embed) Errorify() *embed {
|
|
|
e.Color = 0xE00000
|
|
|
e.Title = "发生错误!An error has occurred!"
|
|
|
return e
|
|
|
}
|
|
|
|
|
|
func (e *embed) SetTitle(title string) *embed {
|
|
|
e.Title = title
|
|
|
return e
|
|
|
}
|
|
|
|
|
|
func (e *embed) SetColour(colour int) *embed {
|
|
|
e.Color = colour
|
|
|
return e
|
|
|
}
|
|
|
|
|
|
func (e *embed) SetDescription(description string) *embed {
|
|
|
e.Description = description
|
|
|
return e
|
|
|
}
|
|
|
|
|
|
func (e *embed) AddField(name, value string) *embed {
|
|
|
e.Fields = append(e.Fields, &discordgo.MessageEmbedField{
|
|
|
Name: name,
|
|
|
Value: value,
|
|
|
})
|
|
|
return e
|
|
|
}
|
|
|
|
|
|
func (e *embed) Build() *discordgo.MessageEmbed {
|
|
|
return e.MessageEmbed
|
|
|
}
|