A fast and easy to use weeb.sh API wrapper.
Originally build with Discord bots in mind like GoBot!
Join his Discord Server for support on the wrapper.
Just use go get https://github.com/Daniele122898/weeb.go
No extra packages needed.
To use the weeb.sh services you need an authentication token. You can request one at devs@weeb.sh
hidden
should be set as false by default. These only benefit uploaders and are useless otherwise!
First you have to authenticate once by passing your token. This has to be done before any further usage can occur and only has to be done once.
//...
func Auth() error{
err := weebgo.Authenticate("YOUR WEEB.SH TOKEN HERE", data.TOKENTYPE) //data.BEARER or data.WOLKE
if err == nil {
//DO ERROR HANDLING IN HERE
return err
}
//No further logic needed...
return err
}
//...
//...
func GetTags(hidden bool) (*data.TagsData, error){
td, err := weebgo.GetTags(hidden)
if err != nil{
//error handling
return nil, err
}
return td, nil
}
//...
//...
func GetTypes(hidden bool) (*data.TypesData, error){
td, err := weebgo.GetTypes(hidden)
if err != nil{
//error handling
return nil, err
}
return td, nil
}
//...
You must have at least either type or tags!
FileType consists of: jpg, png, gif, any
. Jpg and jpeg are treated as equal
NSFW consists of: false, true, only
//...
func GetRandomImage(typ string, tags []string,filetype data.FileType,nsfw data.Nsfw, hidden bool) (*data.RandomData, error){
ri, err := weebgo.GetRandomImage(typ, tags, filetype, nsfw, hidden)
if err != nil{
//error handling
return nil, err
}
return ri, nil
}
//...
type TagsData struct{
status int
Tags []string
}
type TypesData struct{
status int
Types []string
}
type RandomData struct{
Id string
BaseType string
FileType string
MimeType string
Account string
Hidden bool
Nsfw bool
Tags []Tags
Url string
}
type Tags struct{
Name string
Hidden bool
User string
}