【问题标题】:E0001:invalid syntax (<string>, line 6) [closed]E0001:无效语法(<string>,第 6 行)[关闭]
【发布时间】:2018-12-07 13:06:13
【问题描述】:

我正在使用 discord.py 编写一个不和谐机器人 但是,我不断收到此错误消息: E0001: 无效语法(第 6 行)

我的代码是

import time
import discord
from discord.ext import commands
import asyncio

message = discord.Message type
client = commands.Bot(command_prefix='G')
channel = message.channel

print ("Discord version: " + discord.__version__)

【问题讨论】:

  • 仔细阅读错误。它说一个特定的行并告诉您它有什么问题(语法错误,您编写了无效的 python 代码)。更具体地说,MessageType 中没有空格。
  • message = discord.Message type 在第 6 行,删除末尾 Messagetype 之间的空格
  • 只是实际阅读他们的代码... 1)您不能自己创建消息,只能从 Discord 接收它们。 2)您需要先连接才能接收消息。 3)docs,sample code

标签: python discord.py


【解决方案1】:

MessageType 中没有空格

【讨论】:

  • @jc1850现在我收到这些错误:imgur.com/a/fTSa5XM
  • @DennisC。 BotClient 的子类。它应该具有这些属性。你能分享给你这些错误的代码吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-14
  • 1970-01-01
  • 1970-01-01
  • 2018-07-04
  • 1970-01-01
  • 2018-01-29
  • 1970-01-01
相关资源
最近更新 更多