Ben Erang
Ben Erang

Reputation: 17

Unexpected EOF error while parsing?

Never coded in python before but just started and am flat out having errors while creating a discord bot. Not sure what's wrong with the code but it doesn't look like it's the last line.

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

Client = discord.client ()
bot_prefix = "!b"
client = commands.Bot (command_prefix=bot_prefix)

@client.event
async def on_ready () :
    print("With Bepis")     

@client.command(pass_context=true)
async def on_message(ctx:await client.say ("bepis")
                     if message.content == "bepis"
       @client.send_message (message.channel, "**BEPIS**")   

@client.run ("censored token")    

yes, i know my bot is going to be stupid. I am just using it as a test for a more official bot. Help IS VERY appreciated though.

Upvotes: 0

Views: 800

Answers (2)

svenovic
svenovic

Reputation: 31

You are missing a parenthesis next to ("bepis"). Parser finds EOF when it still tries to find the closing parenthesis that's why you get the error.

Upvotes: 0

Matt M
Matt M

Reputation: 86

Change the last line to

client.run("censored token")

The @ specifies a function decorator, so the parser is confused because there is nothing after it. https://www.python.org/dev/peps/pep-0318/

Upvotes: 1

Related Questions