1
0
Fork 0
mirror of https://github.com/diamondburned/cchat.git synced 2024-10-31 20:04:33 +00:00

Added Avatar() into Author

This commit adds the Avatar method into the Author interface. It returns
the URL if one, or it can return an empty string if either the service
does not support avatars or the user doesn't have avatars.
This commit is contained in:
diamondburned 2020-10-03 23:08:24 -07:00
parent aaa29f35b0
commit 555931f974
2 changed files with 14 additions and 0 deletions

View file

@ -211,6 +211,9 @@ type Authenticator interface {
type Author interface {
Identifier
// Avatar returns the URL to the user's avatar or an empty string if they have
// no avatar or the service does not have any avatars.
Avatar() (url string)
Name() text.Rich
}

View file

@ -597,6 +597,17 @@ var Main = Packages{
Type: MakeQual("text", "Rich"),
}},
},
GetterMethod{
method: method{
Comment: Comment{`
Avatar returns the URL to the user's avatar or an
empty string if they have no avatar or the service
does not have any avatars.
`},
Name: "Avatar",
},
Returns: []NamedType{{Name: "url", Type: "string"}},
},
},
}, {
Comment: Comment{`