Discord.py: AttributeError: type object 'Client' has no attribute 'servers'

Created on 9 Sep 2017  路  3Comments  路  Source: Rapptz/discord.py

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.

invalid

Most helpful comment

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.

All 3 comments

You are not creating an object.

client = discord.Client()

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'

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.

Was this page helpful?
0 / 5 - 0 ratings