mirror of
https://github.com/MedzikUser/go-cdn
synced 2024-08-15 03:19:36 +00:00
41 lines
755 B
Go
41 lines
755 B
Go
|
package discord
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/andersfylling/disgord"
|
||
|
"github.com/andersfylling/snowflake/v5"
|
||
|
"gitlab.com/gaming0skar123/go/cdn/common"
|
||
|
"gitlab.com/gaming0skar123/go/cdn/config"
|
||
|
"gitlab.com/gaming0skar123/go/cdn/database"
|
||
|
)
|
||
|
|
||
|
var c *disgord.Client
|
||
|
|
||
|
func apiInit(client *disgord.Client) {
|
||
|
c = client
|
||
|
}
|
||
|
|
||
|
func API(link string) {
|
||
|
channel, err := database.FindAPIChannel()
|
||
|
if common.CheckErr(err, "FindAPIChannel()") {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
s, err := snowflake.GetSnowflake(channel.ID)
|
||
|
if common.CheckErr(err, "GetSnowflake("+channel.ID+")") {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
c.SendMsg(s, disgord.Embed{
|
||
|
Title: link,
|
||
|
Timestamp: disgord.Time{
|
||
|
Time: time.Now().UTC(),
|
||
|
},
|
||
|
Color: config.Embed_Color,
|
||
|
Image: &disgord.EmbedImage{
|
||
|
URL: link,
|
||
|
},
|
||
|
})
|
||
|
}
|