Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.8k stars 3.75k forks source link

TypeError: 'member_descriptor' object is not callable #754

Closed xLingling closed 7 years ago

xLingling commented 7 years ago

So im a beginner in programming, and at the moment im trying to make a discord bot which moves users that are in a voice channel to the appropriate voice channel, based off of the game they are playing. Right now, im trying to make my bot detect a change in a user's 'game playing' status, here is my current coding for it

note: the google chrome variable was for testing purposes lol

#command 2
def gamePlaying():
    csgo = "Counter-Strike Global Offensive"
    pubg = "PUBG"
    payday2 = "PAYDAY 2"
    r6s = "Tom Clancy/'s Rainbow Six Siege"
    lol = "League of Legends"
    chrome = "Google Chrome"

@client.event
async def on_member_update(before=False,after=True):
    await discord.Member.game()
    if discord.Game.name(chrome) in gamePlaying:
        await client.say('yeet')

The thing is, the bot did detect that i was 'playing' Google chrome, but the command prompt gave me a typeerror:

#Ignoring exception in on_member_update
Traceback (most recent call last):
  File "C:\Program Files\Anaconda3\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Dylan\Documents\DiscordBot\discordbot-alpha.py", line 36, in on_member_update
    await discord.Member.game()
TypeError: 'member_descriptor' object is not callable

How do i fix this error? Any help is much appreciated :)

Rapptz commented 7 years ago

I think there's just way too much wrong here that shows a fundamental gap of knowledge in Python.

I honestly recommend learning more about python before even beginning to think about tackling these issues and writing a bot. It would ultimately make it a more enjoyable experience writing the bot since you won't have trouble with the basics.

I recommend something like automate the boring stuff.