Rapptz / discord.py

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

AttributeError: type object 'Client' has no attribute 'servers' #770

Closed reuscam closed 7 years ago

reuscam commented 7 years ago

VersionInfo(major=0, minor=16, micro=11, releaselevel='final', serial=0)

import discord client = discord.Client async def on_ready(): print(client.servers) print('------')

this causes an "AttributeError: type object 'Client' has no attribute 'servers'" exception.

http://discordpy.readthedocs.io/en/latest/api.html#discord.Client.servers seems to indicate this should exist.

Helehelehele commented 7 years ago

You are not creating an object.

client = discord.Client()

ghost commented 6 years ago

Same problem:

import discord

client = discord.Client()

@client.event async def on_ready(): print(discord.version_info) print(client.servers)

client.run('token', bot=False)

AttributeError: 'Client' object has no attribute 'servers'

Harmon758 commented 6 years ago

If you're using the rewrite branch, server is now guild, so you'd need to use client.guilds.

For further help using the library, you should join either the official discord.py server or the Discord API server, as the README recommends.