my auto discord leveing system is giving me errors

  discord.py, discord.py-rewrite, python-3.x

I’m making a leveling system on discord.py I have the latest version of discord.py I don’t know why it keeps giving me errors I’m new to discord.py feel free to edit my code so it works thank you.

My code:

@client.event
async def on_member_join():
    with open('users.json', 'r')as f:
///       users = json.load(f)

    await update_data(users, member)

    with open('users.json', 'w')as f:
         json.dump(users, f)



@client.event
async def on_message(message):
    with open('users.json', 'r')as f:
        users=json.load(f)
    

    await update_data(users, message.author)
    await add_experience(users, message.author, 5)
    await level_up(users, message.author, message.channel)

    with open('users.json', 'w')as f:
        json.dump(users, f)

async def update_data(users, user):
    if not user.id in users:
        users[user.id]= {}
        users[user.id]['experience']=0
        users[user.id]['level']=1

async def add_experience(users, user, exp):
    users[user.id]['experience'] += exp

async def level_up(users, user, channel):
    experience = users[user.id]['experience']
    lvl_start=users[user.id]['level']
    lvl_end=int(experience ** (1/4))

    if lvl_start < lvl_end:
        await client.send_message(cannel, '{} has leveled up to level {}'.format(user.mention, lvl_end))
        users[user.id]['level']=lvl_end

Error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The code that is giving me problems:
users = json.load(f)

Source: Python-3x Questions

LEAVE A COMMENT