[英]Python Discord bot error
我正在用Python做一個不和諧的機器人。
在輸出中說我有4個錯誤。
我不理解為什么。
我已經安裝了discord.py,並且正在使用Python 3.5。
有什么想法嗎?
錯誤:
E0611:No name 'exe' in module 'discord'
E0602:Undefined variable 'message'
E0401:Unable to import 'discord.exe.commands'
E0602:Undefined variable 'message'
碼:
import discord
from discord.exe.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client()
client = commands.Bot(command_prefix = ";")
@client.event
async def on_ready():
print("The bot is sailing on the seven seas")
@client.event
async def on_message(maker):
if message.content == "cookie":
await client.send_message(message.channel, ":cookie:")
client.run("1NDE2--CHANGED--L24CMo"))
第一個錯誤:您導入了discord.exe
; 它叫做discord.ext
第二個錯誤:您在on_message
聲明中將message
參數分配給了名稱maker
。 將其更改為on_message(message)
以獲取變量
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.