Skip to content

Added uwu support - #275

Merged
sfreeman422 merged 1 commit into
masterfrom
feature/uwu
Aug 22, 2026
Merged

Added uwu support#275
sfreeman422 merged 1 commit into
masterfrom
feature/uwu

Conversation

@sfreeman422

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI lite review requested due to automatic review settings August 22, 2026 02:01
@sfreeman422
sfreeman422 merged commit 218b821 into master Aug 22, 2026
11 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an “uwu” transformation path to suppressed-message handling in SuppressorService, applying it randomly under specific conditions, and extends the unit tests to cover the new behavior.

Changes:

  • Added uwuifyText and shouldUwuifyText helpers and integrated a ~5% uwuify branch into sendSuppressedMessage.
  • Updated suppression flow to sometimes bypass translation when uwuify triggers.
  • Added/updated unit tests to verify uwuify vs translate behavior under controlled randomness.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/backend/src/shared/services/suppressor.service.ts Introduces uwuify helper methods and a conditional uwuify/translate branch in suppressed message sending.
packages/backend/src/shared/services/suppressor.service.spec.ts Adds tests for uwuify triggering/skip logic and stabilizes translation assertions.
Suppressed comments (3)

packages/backend/src/shared/services/suppressor.service.spec.ts:139

  • This test spies on Math.random() but never restores it. Because vi.clearAllMocks() doesn't restore spied implementations, the mock can persist across tests and cause cross-test coupling.
  it('sendSuppressedMessage skips uwu when the text has fewer than 4 r or l letters', async () => {
    vi.spyOn(Math, 'random').mockReturnValue(0.04);

packages/backend/src/shared/services/suppressor.service.spec.ts:158

  • This test spies on Math.random() but never restores it; vi.clearAllMocks() won't restore the original implementation, so the mocked value can leak into later tests.
  it('sendSuppressedMessage uses translation for normal channels', async () => {
    vi.spyOn(Math, 'random').mockReturnValue(0.5);

packages/backend/src/shared/services/suppressor.service.spec.ts:177

  • This test spies on Math.random() but doesn't restore it afterwards. Since the file-level setup uses vi.clearAllMocks() (not vi.restoreAllMocks()), the spied implementation can persist across tests.
  it('sendSuppressedMessage falls back when translation fails', async () => {
    vi.spyOn(Math, 'random').mockReturnValue(0.5);
    (suppressorService.translationService.translate as Mock).mockRejectedValue(new Error('translate fail'));

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +256 to +260
const shouldUwuify = Math.random() < 0.05 && this.shouldUwuifyText(textWithFallbackReplacments);
await (
shouldUwuify
? Promise.resolve(this.uwuifyText(textWithFallbackReplacments))
: this.translationService.translate(textWithFallbackReplacments)
Comment on lines +121 to +135
it('sendSuppressedMessage uwuifies text by replacing r and l with w roughly 5% of the time when there are at least 4 eligible letters', async () => {
vi.spyOn(Math, 'random').mockReturnValue(0.04);

await suppressorService.sendSuppressedMessage(
'C123',
'U1',
'hello world',
'123',
1,
suppressorService.muzzlePersistenceService as never,
);

expect(suppressorService.translationService.translate).not.toHaveBeenCalled();
expect(suppressorService.webService.sendMessage).toHaveBeenCalledWith('C123', '<@U1> says "hewwo wowwd"');
});
Comment on lines +206 to +210
public uwuifyText(text: string): string {
return text.replace(/[rRlL]/g, 'w');
}

public shouldUwuifyText(text: string): boolean {
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.

2 participants