add in auto role checks

This commit is contained in:
Brandon 2021-11-15 15:14:07 -05:00
parent 8ceaa0ddee
commit a63aa3661e

View file

@ -382,6 +382,10 @@ class PersonalRoles(commands.Cog):
"""Change icon of personal role using emoji"""
role = await self.config.member(ctx.author).role()
role = ctx.guild.get_role(role)
if not role:
await ctx.send(chat.warning(f"Please create your role using `{ctx.prefix}myrole create`!"))
return
if not emoji:
if ctx.channel.permissions_for(ctx.author).add_reactions:
m = await ctx.send(_("React to this message with your emoji"))
@ -447,6 +451,10 @@ class PersonalRoles(commands.Cog):
"""Change icon of personal role by using image"""
role = await self.config.member(ctx.author).role()
role = ctx.guild.get_role(role)
if not role:
await ctx.send(chat.warning(f"Please create your role using `{ctx.prefix}myrole create`!"))
return
if not (ctx.message.attachments or url):
raise commands.BadArgument
if ctx.message.attachments:
@ -482,6 +490,10 @@ class PersonalRoles(commands.Cog):
"""Remove icon of personal role"""
role = await self.config.member(ctx.author).role()
role = ctx.guild.get_role(role)
if not role:
await ctx.send(chat.warning(f"Please create your role using `{ctx.prefix}myrole create`!"))
return
try:
await edit_role_icon(
self.bot,