in
PYL-R1714105 for i, part in enumerate(parts):
106 content = f"{self.prefixcalc(record.levelname)}{part}{self.suffixcalc(record.levelname)}"
107 if i == len(parts) - 1:
108 if record.levelname == 'ERROR' or record.levelname == 'CRITICAL':109 content += f'<@{os.environ.get("OWNER_ID")}>'
110 message_body = {
111 "content": content
134 for case in entries:
135 timestamp = case.date
136 formatted = f"{format_dt(timestamp, style='F')} ({format_dt(timestamp, style='R')})"
137 if case._type == "WARN" or case._type == "LIFTWARN":138 if case.lifted:
139 embed.add_field(
140 name=f'{determine_emoji(case._type)} Case #{case._id} [LIFTED]', value=f'**Points**: {case.punishment}\n**Reason**: {case.reason}\n**Lifted by**: {case.lifted_by_tag}\n**Lift reason**: {case.lifted_reason}\n**Warned on**: {formatted}', inline=True)
144 else:
145 embed.add_field(name=f'{determine_emoji(case._type)} Case #{case._id}',
146 value=f'**Points**: {case.punishment}\n**Reason**: {case.reason}\n**Moderator**: {case.mod_tag}\n**Warned on**: {formatted}', inline=True)
147 elif case._type == "MUTE" or case._type == "REMOVEPOINTS":148 embed.add_field(name=f'{determine_emoji(case._type)} Case #{case._id}',
149 value=f'**{pun_map[case._type]}**: {case.punishment}\n**Reason**: {case.reason}\n**Moderator**: {case.mod_tag}\n**Time**: {formatted}', inline=True)
150 elif case._type in pun_map:
92 else:
93 embed.add_field(name=f'{determine_emoji(case._type)} Case #{case._id}',
94 value=f'**Points**: {case.punishment}\n**Reason**: {case.reason}\n**Moderator**: {case.mod_tag}\n**Warned on**: {formatted}', inline=True)
95 elif case._type == "MUTE" or case._type == "REMOVEPOINTS": 96 embed.add_field(name=f'{determine_emoji(case._type)} Case #{case._id}',
97 value=f'**{pun_map[case._type]}**: {case.punishment}\n**Reason**: {case.reason}\n**Moderator**: {case.mod_tag}\n**Time**: {formatted}', inline=True)
98 elif case._type in pun_map:
82 for case in entries:
83 timestamp = case.date
84 formatted = f"{format_dt(timestamp, style='F')} ({format_dt(timestamp, style='R')})"
85 if case._type == "WARN" or case._type == "LIFTWARN": 86 if case.lifted:
87 embed.add_field(name=f'{determine_emoji(case._type)} Case #{case._id} [LIFTED]',
88 value=f'**Points**: {case.punishment}\n**Reason**: {case.reason}\n**Lifted by**: {case.lifted_by_tag}\n**Lift reason**: {case.lifted_reason}\n**Warned on**: {formatted}', inline=True)
To check if a variable is equal to one of many values, combine the values into a tuple and check if the variable is contained in
it instead of checking for equality against each of the values.
This is faster, less verbose, and more readable.
if x == 1 or x == 2 or x == 3:
do_something()
if x in (1, 2, 3):
do_something()