bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.12k stars 817 forks source link

`UserUpdateStatus()`, unable to set idle. #915

Open colecrouter opened 3 years ago

colecrouter commented 3 years ago

When running

_, err = s.UserUpdateStatus("online")
log.Println(err)

I get:

HTTP 403 Forbidden, {"message": "Bots cannot use this endpoint", "code": 20001}

If I run

err = s.UpdateGameStatus(1, "status")
log.Println(err)

it sets "status" properly, but bot does not go idle. err is also nil this time.

EDIT: I'm running the latest release btw.

ErrorNoInternet commented 3 years ago

Same here

colecrouter commented 3 years ago

On the latest update 0.23, still seems to happen with the new system:

var act []*discordgo.Activity
act = append(act, &discordgo.Activity{Name: "game", Type: discordgo.ActivityTypeGame})
idle := 10
s.UpdateStatusComplex(discordgo.UpdateStatusData{IdleSince: &idle, Activities: act, AFK: true})

doesn't seem to work. Also, the program seems to crash(?) if I remove act from the function call.

zeroidentidad commented 3 years ago

same for me with:

_, err := discord.UserUpdateStatus(discordgo.StatusDoNotDisturb)

lbyte00 commented 3 years ago

If you want to set bot's status, I found this way:

    discordClient.Identify.Presence.Status = string(discordgo.StatusOnline)
    if err = discordClient.Open(); err != nil {
        log.Fatal(errors.Annotate(err, "opening websocket connection failed"))
    }
Kardbord commented 3 years ago

UpdateStatusComplex seems to work for me, but I am ahead of the v0.23.2 tag (I'm on 0fad116). I also have not tried to set activities, so ymmv there.

session, _  := discordgo.New(...)
err = session.UpdateStatusComplex(discordgo.UpdateStatusData{
    AFK:    false,
    Status: string(discordgo.StatusOnline),
})