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

feat: 人は話し方が9割ジェネレーターの追加 #648

Merged
merged 6 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/service/command/meme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { lolicon } from './lolicon.js';
import { moeta } from './moeta.js';
import { n } from './n.js';
import { nigetane } from './nigetane.js';
import { nine } from './nine.js';
import { ojaru } from './ojaru.js';
import { takopi } from './takopi.js';
import { web3 } from './web3.js';
Expand All @@ -21,5 +22,6 @@ export const memes = [
moeta,
kenjou,
koume,
ojaru
ojaru,
nine
];
13 changes: 13 additions & 0 deletions src/service/command/meme/nine.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { MemeTemplate } from '../../../model/meme-template.js';

export const nine: MemeTemplate<never, never> = {
commandNames: ['nine'],
description: '〇〇は〇〇が9割',
flagsKeys: [],
optionsKeys: [],
errorMessage: '人は引数ミスが9割',
generate(args) {
const [option1, option2] = args.body.split(' ');
return `${option1}は${option2}が9割`;
}
};
4 changes: 4 additions & 0 deletions src/service/command/meme/test/dousurya.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ describe('meme', () => {
const responder = new Meme();

it('use case of dousurya', async () => {
/**
* !dousurya と !dousureba のテストケースです。
* 一見同じように見えるが、違うので重複してたからと削除しないよう注意してほしい
*/
await responder.on(
createMockMessage(
parseStringsOrThrow(['dousurya', 'こるく'], responder.schema),
Expand Down
36 changes: 36 additions & 0 deletions src/service/command/meme/test/nine.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest';
import { Meme } from '../../meme.js';

import { createMockMessage } from '../../command-message.js';
import { parseStringsOrThrow } from '../../../../adaptor/proxy/command/schema.js';

describe('meme', () => {
const responder = new Meme();

it('use case of nine', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['nine', '限界開発鯖', 'オタク'], responder.schema),
(message) => {
expect(message).toStrictEqual({
description: `限界開発鯖はオタクが9割`
});
}
)
);
});

it('args null (nine)', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['nine'], responder.schema),
(message) => {
expect(message).toStrictEqual({
description: '人は引数ミスが9割',
title: '引数が不足してるみたいだ。'
});
}
)
);
});
});