aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_constants.py
diff options
context:
space:
mode:
authorGravatar Shirayuki Nekomata <[email protected]>2019-10-17 13:17:55 +0700
committerGravatar Shirayuki Nekomata <[email protected]>2019-10-17 13:17:55 +0700
commit23d4acfef58465f08b4f62d45bf22cdad976f3f3 (patch)
tree5f48ee34f8d9ee508d27dc15fb84b3028b052c3e /tests/test_constants.py
parentMerge pull request #511 from python-discord/off-topic-check (diff)
Fix defcon having wrong text when disabling.
#### Closes #539 This pull request fixes the issue for wrong status in the embed, as well as unifying certains if else to prevent similar future errors. Most notable code is here: ```python log_msg = f"**Staffer:** {actor} (`{actor.id}`)\n" if change.lower() == "enabled": icon = Icons.defcon_enabled color = Colours.soft_green status_msg = "DEFCON enabled" log_msg += f"**Days:** {self.days.days}\n\n" elif change.lower() == "disabled": icon = Icons.defcon_disabled color = Colours.soft_red status_msg = "DEFCON enabled" elif change.lower() == "updated": icon = Icons.defcon_updated color = Colour.blurple() status_msg = "DEFCON updated" log_msg += f"**Days:** {self.days.days}\n\n" ``` To remedy this issue, the class will now have a private class variable ```py _defcon_log_info: Dict[str, Tuple] = { 'enabled': (Icons.defcon_enabled, Colours.soft_green, "**Days:** {days}\n\n"), 'disabled': (Icons.defcon_disabled, Colours.soft_red, ""), 'updated': (Icons.defcon_updated, Colour.blurple(), "**Days:** {days}\n\n"), } ``` Another big change is the introduction of `_defcon_action` to unify the process all defcon actions has to go through: - Try to do the action. - Log error if there is any. - Send log message.
Diffstat (limited to 'tests/test_constants.py')
0 files changed, 0 insertions, 0 deletions