#How would I change a bot's status without the code being in on_ready?
1 messages · Page 1 of 1 (latest)
when initiating the bot object, you pass an Activity into the activity kwarg
e.g.
bot = discord.Bot(...,
activity = discord.Game(...)
)
upon doing that, it says its fine, but when i try to launch the bot again it returns me with the error:
File "main.py", line 28 async def on_ready(): ^ SyntaxError: invalid syntax
any idea what causes that?
but upon deleting the additional code, it goes back to normal
send code with the addition
maybe you are missing a tab or paren
`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"
No tag codeblocks found.
?tag codeblock
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.")
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="..."))