BOssT
BOssT

Reputation: 21

TypeError: 'Member' object is not callable

My code:

global Vc
global Tune
try:
    Vc = await stage.connect()
    Member = guild.me(config["bot_id"])
    await member.edit(suppress=False)
except CommandInvokeError:
    pass
while True:
    while Vc.is_playing():
        await asyncio.sleep(1)
    else:
        Tune = get_info.write_song()
        Vc.play(discord.FFmpegPCMAudio(f"songs/{Tune}"))
        audiofile = eyed3.load(f"songs/{Tune}")
        title = audiofile.tag.title
        await bot.change_presence(activity=discord.Game(name=f"{title}"))
        Vc.source = discord.PCMVolumeTransformer(Vc.source, volume=config["volume"])
        if "suppress=False" in str(stage.voice_states):
            pass
        else:
            await member.edit(suppress=False)
(suppress=False)

Error:

Member = guild.me(config["bot_id"]) TypeError: 'Member' object is not callable

I'm confused about this error...

Upvotes: 0

Views: 512

Answers (1)

Shunya
Shunya

Reputation: 2474

You are mixing up guild.me with guild.get_member().

I'm gonna assume you have your bot's ID (or all users) in a database or configuration file that is read into config. To retrieve a Member object, you could do it as you were doing it in your code, passing the ID, but using the guild.get_member() function:

Member = guild.get_member(config["bot_id"])

But when the Member object you want to retrieve is from your own bot, it is as simple as calling guild.me, which will return you a Member instance for yourself. See below:

Member = guild.me

Documentation:

Upvotes: 2

Related Questions