'Getting value from a function in discord.py

@bot.event
async def on_guild_join(guild):
    with open("mute_role.json", "r") as f:
        mute_is_role = json.load(f)

    mute_is_role[str(guild.id)] = "123"

    with open("mute_role.json", "w") as f:
        json.dump(mute_is_role,f)

    with open("unmute_role.json", "r") as f:
        unmute_is_role = json.load(f)

    unmute_is_role[str(guild.id)] = "321"

    with open("unmute_role.json", "w") as f:
        json.dump(unmute_is_role,f)

def get_muterole(bot,ctx):

    with open("mute_role.json", "r") as f:
       mute_is_role = json.load(f)

    return mute_is_role[str(ctx.guild.id)]

def get_unmuterole(bot,ctx):

    with open("unmute_role.json", "r") as f:
       unmute_is_role = json.load(f)

    return unmute_is_role[str(ctx.guild.id)]

@bot.command()
async def test(bot,ctx):
  muterole=get_muterole(bot,ctx)
  unmuterole=get_unmuterole(bot,ctx)
  await ctx.send(muterole)
  await ctx.send(unmuterole)

this is my code but when I run test neither does it show an error nor does it print out the result so I wanted to know if I was doing any mistakes in my code

Thankyou



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source