Update comments for Godoc
This commit is contained in:
parent
75c0f09b23
commit
d30d567dcb
@ -13,12 +13,12 @@ import (
|
|||||||
* Disgoman (c) 2020 Dusty.P/dustinpianalto
|
* Disgoman (c) 2020 Dusty.P/dustinpianalto
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Add a status to the manager
|
// AddStatus to the manager
|
||||||
func (s *StatusManager) AddStatus(status string) {
|
func (s *StatusManager) AddStatus(status string) {
|
||||||
s.Values = append(s.Values, status)
|
s.Values = append(s.Values, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a status from the manager
|
// RemoveStatus from the manager
|
||||||
func (s *StatusManager) RemoveStatus(status string) []string {
|
func (s *StatusManager) RemoveStatus(status string) []string {
|
||||||
for i, v := range s.Values {
|
for i, v := range s.Values {
|
||||||
if v == status {
|
if v == status {
|
||||||
@ -29,19 +29,19 @@ func (s *StatusManager) RemoveStatus(status string) []string {
|
|||||||
return s.Values
|
return s.Values
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets interval to new value
|
// SetsInterval changes the update interval to new value
|
||||||
func (s *StatusManager) SetInterval(interval string) {
|
func (s *StatusManager) SetInterval(interval string) {
|
||||||
s.Interval = interval
|
s.Interval = interval
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the status now
|
// UpdateStatus actually updates the status of the bot
|
||||||
func (s *StatusManager) UpdateStatus(session *discordgo.Session) error {
|
func (s *StatusManager) UpdateStatus(session *discordgo.Session) error {
|
||||||
i := rand.Intn(len(s.Values))
|
i := rand.Intn(len(s.Values))
|
||||||
err := session.UpdateStatus(0, s.Values[i])
|
err := session.UpdateStatus(0, s.Values[i])
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default StatusManager ready function which updates the status at the specified interval
|
// OnReady is the default StatusManager ready function which updates the status at the specified interval
|
||||||
func (s *StatusManager) OnReady(session *discordgo.Session, _ *discordgo.Ready) {
|
func (s *StatusManager) OnReady(session *discordgo.Session, _ *discordgo.Ready) {
|
||||||
interval, err := time.ParseDuration(s.Interval)
|
interval, err := time.ParseDuration(s.Interval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user