grim/wasdead
Clone
Summary
Browse
Changes
Graph
Don't output errors directly to the channel, commands should be handling that themselves
draft
2020-09-26, Gary Kramlich
c6d101eb5c05
Don't output errors directly to the channel, commands should be handling that themselves
package
presence
import
(
"fmt"
"time"
)
type
Presence
struct
{
Provider
string
Color
int
Live
bool
StreamID
string
Username
string
UserID
string
Title
string
Game
string
Viewers
int64
Language
string
URL
string
ProfileImageURL
string
ThumbnailURL
string
Started
time
.
Time
}
// GetPresence returns the presence for the given url
func
GetPresence
(
url
string
)
(
Presence
,
error
)
{
for
_
,
provider
:=
range
providers
{
if
provider
.
HandleURL
(
url
)
{
return
provider
.
GetPresenceFromURL
(
url
)
}
}
return
Presence
{},
fmt
.
Errorf
(
"no provider for %q"
,
url
)
}