added fetch bot(s) functions.

This commit is contained in:
5elenay
2021-09-08 16:55:28 +03:00
parent 24b09a68ba
commit 6d10fabd42
2 changed files with 94 additions and 0 deletions

29
bot.go
View File

@@ -1,10 +1,39 @@
package revoltgo
import (
"time"
"github.com/oklog/ulid/v2"
)
// Bot struct.
type Bot struct {
Client *Client
CreatedAt time.Time
Id string `json:"_id"`
OwnerId string `json:"owner"`
Token string `json:"token"`
IsPublic bool `json:"public"`
InteractionsUrl string `json:"interactionsURL"`
}
// Fetched bots struct.
type FetchedBots struct {
Bots []*Bot `json:"bots"`
Users []*User `json:"users"`
}
// Calculate creation date and edit the struct.
func (b *Bot) CalculateCreationDate() error {
ulid, err := ulid.Parse(b.Id)
if err != nil {
return err
}
b.CreatedAt = time.UnixMilli(int64(ulid.Time()))
return nil
}
// Edit the bot.