#How would I change a bot's status without the code being in on_ready?

1 messages · Page 1 of 1 (latest)

abstract phoenix
#

From what I've seen, you should never put code in on_ready, as it can cause issues while bringing the bot online, but I don't really know how else I would make the bot change it's status without the code being within on_ready, any help?

weak crater
#

e.g.

bot = discord.Bot(...,
      activity = discord.Game(...)
)
abstract phoenix
#

but upon deleting the additional code, it goes back to normal

weak crater
#

maybe you are missing a tab or paren

abstract phoenix
# weak crater send code with the addition

`client = discord.Bot(debug_guilds=[...],
client.change_presence(activity=discord.Game(name='...')))

@client.event
async def on_ready():
print('logged in as {0.user}!'.format(client))`

i fixed the other error, but now the client.change_presence code is telling me the error "positional argument follows keyword argument"

weak crater
#

.codeblocks

#

?tag codeblocks

flat moatBOT
#

dynoError No tag codeblocks found.

weak crater
#

?tag codeblock

flat moatBOT
#

Please put your code in a code block:
```py
Here is your Code
```

That makes reading code in Discord a lot easier:

print("This is an example.")
abstract phoenix
#

i managed to figure it out!

instead of adding an additional line for the client.change_presence

i just added the comma, and put activity = discord.Game(name="..."))

my mistake i was making was forgetting to put "activity =" before the code, to which i apologize!

here is the final code that worked:

client = discord.Bot(debug_guilds=[...], activity = discord.Game(name="..."))