| Conditions | 2 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | """Rank features cog for CCC Bot""" |
||
| 18 | @commands.command(name="add-rank", help="Assigns student, alumni or professor role.") |
||
| 19 | @commands.has_role("verified") |
||
| 20 | async def add_rank(self, ctx: commands.Context, *, rank: str) -> None: |
||
| 21 | """Add Rank |
||
| 22 | |||
| 23 | Allows users to set student, alumni or professor role. |
||
| 24 | |||
| 25 | :param ctx: Command context |
||
| 26 | :param rank: Name of rank to add |
||
| 27 | :type rank: str |
||
| 28 | :return: None |
||
| 29 | """ |
||
| 30 | user = ctx.message.author |
||
| 31 | ranks = ["student", "professor", "alumni"] |
||
| 32 | checked = [i for i in user.roles if i.name.lower() in ranks] |
||
| 33 | if len(checked) > 0: |
||
| 34 | await error_message(ctx, "You already have a rank.") |
||
| 35 | else: |
||
| 36 | await user.add_roles(discord.utils.get(ctx.guild.roles, name=rank)) |
||
| 37 | await make_embed( |
||
| 38 | ctx, |
||
| 39 | color="28b463", |
||
| 40 | title="Success", |
||
| 41 | description="Rank assigned successfully", |
||
| 42 | ) |
||
| 48 |