43 lines
634 B
Go
43 lines
634 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/gtuk/discordwebhook"
|
|
"gitlab.com/gaming0skar123/go/screenshot/imgur"
|
|
)
|
|
|
|
var color = "1127128"
|
|
|
|
func main() {
|
|
var file string
|
|
flag.StringVar(&file, "f", "", "File location")
|
|
|
|
flag.Parse()
|
|
|
|
if file == "" {
|
|
log.Fatal("Empty file arg")
|
|
}
|
|
|
|
i := imgur.Upload(file)
|
|
|
|
fmt.Println("Uploaded!")
|
|
|
|
webhook := os.Getenv("DISCORD_WEBHOOK_URL")
|
|
|
|
discordwebhook.SendMessage(webhook, discordwebhook.Message{
|
|
Embeds: &[]discordwebhook.Embed{
|
|
{
|
|
Title: &i.Data.Link,
|
|
Color: &color,
|
|
Image: &discordwebhook.Image{
|
|
Url: &i.Data.Link,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|