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
type
Provider
interface
{
HandleURL
(
url
string
)
bool
GetPresenceFromURL
(
url
string
)
(
Presence
,
error
)
GetPresenceFromUsername
(
username
string
)
(
Presence
,
error
)
}
var
providers
map
[
string
]
Provider
func
init
()
{
providers
=
map
[
string
]
Provider
{}
}
// AddProvider adds the given provider with the given name
func
AddProvider
(
name
string
,
provider
Provider
)
{
providers
[
name
]
=
provider
}
// NumProviders returns how many presence providers have been configured
func
NumProviders
()
int
{
return
len
(
providers
)
}
// ProviderAvailable returns whether or not a
func
ProviderAvailable
(
name
string
)
bool
{
_
,
found
:=
providers
[
name
]
return
found
}
// GetProvider returns the provider with the given name or nil
func
GetProvider
(
name
string
)
Provider
{
return
providers
[
name
]
}