mirror of
https://github.com/MedzikUser/go-cdn
synced 2024-08-15 03:19:36 +00:00
- Discord Bot: Added YML config and moved bot settings from DB to this file - Error logs names has been renames - Discord Bot: Added upload from multi attachments - Update README, Makefile, go.mod and .gitignore
38 lines
661 B
Go
38 lines
661 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"
|
|
)
|
|
|
|
var c *disgord.Client
|
|
|
|
func apiInit(client *disgord.Client) {
|
|
c = client
|
|
}
|
|
|
|
func API(link string) {
|
|
s, err := snowflake.GetSnowflake(config.API_Channel)
|
|
if common.CheckErr(err, "get snowflake") {
|
|
return
|
|
}
|
|
|
|
_, err = c.SendMsg(s, disgord.Embed{
|
|
Title: link,
|
|
Timestamp: disgord.Time{
|
|
Time: time.Now().UTC(),
|
|
},
|
|
Color: config.Embed_Color,
|
|
Image: &disgord.EmbedImage{
|
|
URL: link,
|
|
},
|
|
})
|
|
|
|
if common.CheckErr(err, "send msg") {
|
|
return
|
|
}
|
|
}
|