Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!myrole: Reveal cursed status to wolfchat players #461

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Dec 16, 2020

Closes #425.

@@ -3046,7 +3046,13 @@ def myrole(var, wrapper, message):
return
role = evt.data["role"]

wrapper.pm(messages["show_role"].format(role))
badguys = get_all_players(Wolfchat)
cursed = get_all_players(("cursed villager",))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cursed = get_all_players(("cursed villager",))
cursed = get_all_players(("cursed villager",)) if "cursed villager" in All else set()

It is possible for the cursed villager role to not exist if the bot admin is using custom roles without importing the built-in ones. src/roles/helper/wolves.py has a similar check (line 367-370) so we should check that here too.

@@ -3046,7 +3046,13 @@ def myrole(var, wrapper, message):
return
role = evt.data["role"]

wrapper.pm(messages["show_role"].format(role))
badguys = get_all_players(Wolfchat)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not accurate if var.RESTRICT_WOLFCHAT is configured, see src/roles/helper/wolves.py lines 354-359. Note also that warlock always sees cursed even if they aren't in wolfchat, so should be explicitly listed as well.

If you're sticking with getting all players with those roles instead of just keeping it as a set of roles, add appropriate checks to ensure the role exists (see below comment). get_all_players with a role that doesn't exist in the bot will error. It is always safe to call it with role categories; the issues only occur if you try to hardcode certain roles in there (such as warlock).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

!myrole doesn't reveal cursed traitor
2 participants