Rapptz / discord.py

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

Using PermissionOverwrite's causes pylint error #1352

Closed TheSnoozer closed 6 years ago

TheSnoozer commented 6 years ago

Branch: rewrite Based on the examples in https://discordpy.readthedocs.io/en/rewrite/api.html#discord.PermissionOverwrite

overwrite = discord.PermissionOverwrite()
overwrite.send_messages = False
overwrite.read_messages = True
await channel.set_permissions(member, overwrite=overwrite)

Running python3.5 -m pylint *.py --disable=R,C,W causes:

E:X,20: Assigning to attribute 'send_messages' not defined in class slots (assigning-non-slot)
E:X,20: Assigning to attribute 'read_messages' not defined in class slots (assigning-non-slot)
scarletcafe commented 6 years ago

This looks like an issue with pylint not acknowledging settable properties, and as such probably has a better home being reported to its developers with this context.

As a workaround, use the kwargs instead:

overwrite = discord.PermissionOverwrite(send_messages=False, read_messages=True)
await channel.set_permissions(member, overwrite=overwrite)
TheSnoozer commented 6 years ago

Thanks for the input. Workaround does the trick for me.