serenity-rs / serenity

A Rust library for the Discord API.
https://discord.gg/serenity-rs
ISC License
4.65k stars 571 forks source link

set_presence from outside an event / command? How can I access serenity's Context from an outside event loop so i can change the presence? #2900

Closed Stay1444 closed 2 months ago

Stay1444 commented 2 months ago

I need to change the bot presence from an outside event loop, but it does not appear to be possible from the Http low level API (?).

jamesbt365 commented 2 months ago

the bot presence is handled over the gateway, depending on how you are handling this task, you should have access to the Client, which has the ShardManager, which contains the ShardRunnerInfo for all the shards, which then contain the ShardMessenger which you can set the presence from.

Stay1444 commented 2 months ago

That did it. Thanks.