简体   繁体   中英

Python Discord.py client Invalid syntax

我正在制作一个不和谐的机器人并尝试使用Python设置播放状态,我尝试了GitHUb之类的不同网站,并且在我的代码中最终出现了建议,Python似乎不喜欢await client.change_status(game=discord.Game(name='whatever'))解决方案吗?

Next time, please include the error and source code!!!

Alright, with that out of the way, here's my source code that works on python 3.6 and discord.py 0.16.12 .

import discord
import discord.game

client = discord.client()
@client.event
async def on_message(message):
  if message.author == client.user:
    return

@client.event
async def on_ready():
  await client.change_presence(game=discord.Game(name=" with you ;)"))

client.run("<token>")

Just merge this with whatever code you have.

有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM