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

Speech filter tweaks #1097

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MiraHell
Copy link

@MiraHell MiraHell commented Jan 29, 2025

Что этот PR делает

Скрывает нарушающее сообщение в уведомлении для админов за алертом, если есть активный админ из банды

Почему это хорошо для игры

Скрывает запрещенные слова в уведомлении, если они там сейчас неуместны

Тестирование

Локальные тесты

Changelog

🆑
code_imp: Улучшен код фильтра речи
/:cl:

Summary by Sourcery

Hide the filtered message from admin logs unless an admin with the SPEECH_FILTER_BYPASS ckey is present. Make the filter regex more robust to avoid accidental bypasses.

Bug Fixes:

  • Prevent accidental bypasses of the speech filter regex.

Enhancements:

  • Hide potentially offensive messages from admin logs when inappropriate.

Copy link

sourcery-ai bot commented Jan 29, 2025

Reviewer's Guide by Sourcery

This pull request modifies the speech filter to improve its regex and hide messages from admins if they are not relevant. It also adds a new admin bypass for the speech filter.

Sequence diagram for modified speech filter flow

sequenceDiagram
    actor User
    participant SF as Speech Filter
    participant Admin as Admin System

User->>SF: Sends message
SF->>SF: Check forbidden words
alt Contains forbidden word
    SF->>User: Show warning
    SF->>SF: Add drool emote
    SF->>SF: Check streamer admins
    alt Streamer admin active
        SF->>Admin: Send clickable alert
    else No streamer admin
        SF->>Admin: Send plain alert
    end
end
Loading

Class diagram for speech filter element

classDiagram
    class SpeechFilter {
        +can_bypass_filter(mob_to_check)
        +get_speech_filter_bypass_ckeys()
        +check_streamer_active_admins()
        +ckey_list(list_to_ckey)
        +get_brainrot_filter_regex()
        +Topic(href, href_list)
        -brainrot_regex
        -speech_filter_bypass_ckeys
    }
    note for SpeechFilter "Modified regex pattern generation
and admin bypass handling"
Loading

File-Level Changes

Change Details Files
Modified the admin message to include a link to view the message if the admin is not in the bypass list.
  • Added a check to see if there are any active admins in the bypass list.
  • If there are active admins in the bypass list, the admin message will include a link to view the message.
  • If there are no active admins in the bypass list, the admin message will not include a link to view the message.
modular_bandastation/speech_filter/code/speech_filter.dm
Added a new topic to handle the admin message link.
  • Added a new topic to handle the admin message link.
  • The topic will only be accessible to admins.
  • The topic will display the message in a tgui alert.
modular_bandastation/speech_filter/code/speech_filter.dm
Modified the regex filter to be more robust.
  • The regex filter now uses a more robust method to filter words.
  • The regex filter now splits the words into characters and joins them with a plus sign.
modular_bandastation/speech_filter/code/speech_filter.dm
Modified the bypass filter to use a list of ckeys instead of a list of strings.
  • The bypass filter now uses a list of ckeys instead of a list of strings.
  • Added a new proc to get the list of ckeys from the config.
  • Added a new proc to convert a list of strings to a list of ckeys.
modular_bandastation/speech_filter/code/speech_filter.dm

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the :shipit: Улучшение Мы сделали что-то немного лучше, на наш взгляд. label Jan 29, 2025
@ss220app ss220app bot added 📜 CL невалиден Этот чейнджлог не пройдет валидацию перед публикацией. Исправить или удалить, если не требуется 📜 CL валиден Этот чейнджлог будет успешно опубликован and removed 📜 CL невалиден Этот чейнджлог не пройдет валидацию перед публикацией. Исправить или удалить, если не требуется labels Jan 29, 2025
Copy link

github-actions bot commented Feb 6, 2025

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the 💩 Stale Кажется всем похуй на этот ПР. Жизнь сурова... label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💩 Stale Кажется всем похуй на этот ПР. Жизнь сурова... 📜 CL валиден Этот чейнджлог будет успешно опубликован :shipit: Улучшение Мы сделали что-то немного лучше, на наш взгляд.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant