Conditions | 6 |
Total Lines | 20 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import discord |
||
32 | def get_monster(self, ctx, name: str): |
||
33 | name = name.lower() |
||
34 | monster_found = [] |
||
35 | |||
36 | for monster in self.bot.config["commands"]: |
||
37 | if monster["name"].lower() == name or name in monster["triggers"]: |
||
38 | monster_found = monster |
||
39 | |||
40 | if not monster_found: |
||
41 | print(f"[{self.__class__.__name__}]: Monster not found ({ctx.author}: {name})") |
||
42 | return |
||
43 | |||
44 | monster_found["role"] = discord.utils.get(ctx.guild.roles, name=monster_found["name"]) |
||
45 | if not monster_found["role"]: |
||
46 | print(f"[{self.__class__.__name__}]: Failed to fetch roleID for monster {monster_found['name']}") |
||
47 | return |
||
48 | |||
49 | else: |
||
50 | monster_found["role"] = monster_found["role"].id |
||
51 | return monster_found |
||
52 |