Add check to rolegiver to verify that roles property exists
This commit is contained in:
parent
7ccc7ea6d2
commit
ab71fa8b3c
1 changed files with 3 additions and 1 deletions
|
@ -49,13 +49,15 @@ class RolegiverCog(Cog):
|
|||
return
|
||||
|
||||
setting = await Rolegiver.find_one(q(guild=ctx.guild.id))
|
||||
if setting and role.id in setting.roles:
|
||||
if setting and setting.roles and role.id in setting.roles:
|
||||
await ctx.send("Role already in rolegiver", ephemeral=True)
|
||||
return
|
||||
|
||||
if not setting:
|
||||
setting = Rolegiver(guild=ctx.guild.id, roles=[])
|
||||
|
||||
setting.roles = setting.roles or []
|
||||
|
||||
if len(setting.roles) >= 20:
|
||||
await ctx.send("You can only have 20 roles in the rolegiver", ephemeral=True)
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue