#can someone help me about changing activity

1 messages · Page 1 of 1 (latest)

errant monolith
short magnetBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

errant monolith
#

i've imported these

short magnetBOT
#

Making a bot presence requires making an activity, like so:

activity = interactions.Activity.create(
    name="with interactions.py",
    type=interactions.ActivityType.PLAYING
)

If you simply want a presence when your bot boots up, provide it when you initialize your bot:

client = interactions.Client(
    status=interactions.Status.DO_NOT_DISTURB,
    activity=activity,
)

Otherwise, just change it through change_presence:

await client.change_presence(
    status=interactions.Status.DO_NOT_DISTURB,
    activity=activity,
)
dire pasture
#

it's not a good practice to import everything using *

#

either just import interactions, or import all classes you need from interactions

errant monolith
dire pasture
#

have you tried launching the bot? For me, it looks like it's your pylance that is erroring because it doesn't know where Status is from

errant monolith
#

yeah i launched

#

where should i write this codes

#

on_ready?

dire pasture
#

if you want

errant monolith
dire pasture
#

but I recommend you to set it directly in the Client definition, if you don't change it at runtime

errant monolith
dire pasture
# errant monolith

no no no, client is your bot instance, you don't want to create a new one

errant monolith
#

my brain refuses connection lol

dire pasture
#

oh wait I see

short magnetBOT
errant monolith
#

am i using v4?

dire pasture
#

yes

#

bot.event doesn't exist in v5

errant monolith
#

😦

#

if i change bot.event will it be v5?

dire pasture
errant monolith
#

okay thanks