added edit, delete bots.
This commit is contained in:
parent
cd73fbb079
commit
4a88e59aba
17
bot.go
17
bot.go
@ -1,6 +1,7 @@
|
|||||||
package revoltgo
|
package revoltgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/oklog/ulid/v2"
|
"github.com/oklog/ulid/v2"
|
||||||
@ -37,3 +38,19 @@ func (b *Bot) CalculateCreationDate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit the bot.
|
// Edit the bot.
|
||||||
|
func (b *Bot) Edit(eb *EditBot) error {
|
||||||
|
data, err := json.Marshal(eb)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = b.Client.Request("PATCH", "/bots/"+b.Id, data)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the bot.
|
||||||
|
func (b *Bot) Delete() error {
|
||||||
|
_, err := b.Client.Request("DELETE", "/bots/"+b.Id, []byte{})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user