How can I fix this error?

July 9, 2017 at 20:51:52
Specs: Windows 10
So I'm coding a Discord bot and I was coding and came across an error (down below), I was wondering if anyone could please help. My code is below the error.
Click to see my error

Code (For Convenience I only put the necessary code, alternatives are also accepted):
import discord
from discord.ext import commands
import asyncio
import pickle
import os

BOTTOKEN = ("My Bot Token")
bot = commands.Bot(command_prefix="~")

filename = "greetsettings.txt"

if filename in os.listdir("C:/Users/Lenovo/Desktop/DiscordBot/Python"):

myfile = open(filename, "rb")
messages = pickle.load(myfile)
del myfile
else:
messages = {}

@bot.command(pass_context = True)
async def greetsetting(ctx, *, settings: str):
global messages

greet_message = ctx.message.content
messages[ctx.message.server] = greet_message

with open(filename, "wb") as myfile:
pickle.dump(messages, myfile)

bot.run(BOTTOKEN)

message edited by WackeyTech


See More: How can I fix this error?

Reply ↓  Report •
Related Solutions


Ask Question