feat: Add ability to send custom embeds

master
Luther Wen Xu 2020-05-30 20:44:12 +07:00
parent 4f687f4d56
commit c811aa4334
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 15 additions and 20 deletions

@ -4,18 +4,19 @@ import (
"github.com/bwmarrin/discordgo"
)
func SendEmbed(dg *discordgo.Session, channelID string, embed *discordgo.MessageEmbed) {
_, err := dg.ChannelMessageSendEmbed(channelID, embed)
if err != nil {
ReportError(dg, err)
}
}
func SendSuccessEmbed(dg *discordgo.Session, channelID string, message string) {
_, err := dg.ChannelMessageSendEmbed(
channelID,
&discordgo.MessageEmbed{
SendEmbed(dg, channelID, &discordgo.MessageEmbed{
Title: "Success",
Description: message,
Color: 0x00D000,
},
)
if err != nil {
ReportError(dg, err)
}
})
}
func SendErrorEmbed(dg *discordgo.Session, channelID string, toSend error) {
@ -23,15 +24,9 @@ func SendErrorEmbed(dg *discordgo.Session, channelID string, toSend error) {
}
func SendFailEmbed(dg *discordgo.Session, channelID string, title string, description string) {
_, err := dg.ChannelMessageSendEmbed(
channelID,
&discordgo.MessageEmbed{
SendEmbed(dg, channelID, &discordgo.MessageEmbed{
Title: title,
Description: description,
Color: 0xD00000,
},
)
if err != nil {
ReportError(dg, err)
}
})
}