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: あっぱれおじゃる様ミーム構文の追加 #621

Merged
merged 4 commits into from
Dec 13, 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 { ojaru } from './ojaru.js';
import { takopi } from './takopi.js';
import { web3 } from './web3.js';

Expand All @@ -19,5 +20,6 @@ export const memes = [
web3,
moeta,
kenjou,
koume
koume,
ojaru
];
17 changes: 17 additions & 0 deletions src/service/command/meme/ojaru.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { MemeTemplate } from '../../../model/meme-template.js';

const ojaruFlags = ['g'] as const;

export const ojaru: MemeTemplate<typeof ojaruFlags[number], never> = {
commandNames: ['ojaru'],
description:
'あっぱれおじゃる様!見事ミーム構文を使いこなされました!`-g`オプションを使用なさってデンボの口調の変更も可能でございます!',
flagsKeys: ojaruFlags,
optionsKeys: [],
errorMessage:
'あっぱれおじゃる様!コマンド形式を間違えエラーをお出しになられました!',
generate(args) {
if (args.flags.g) return `あっぱれおじゃる様!${args.body}でございます!`;
return `あっぱれおじゃる様!見事${args.body}されました!`;
}
};
58 changes: 58 additions & 0 deletions src/service/command/meme/test/ojaru.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 ojaru', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(
['ojaru', '欠課時数で落単をふやし、留年を確定な'],
responder.schema
),
(message) => {
expect(message).toStrictEqual({
description:
'あっぱれおじゃる様!見事欠課時数で落単をふやし、留年を確定なされました!'
});
}
)
);
});

it('use case of ojaru (-g option)', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(
['ojaru', '-g', '数学の成績不足で管理者からタイムアウト'],
responder.schema
),
(message) => {
expect(message).toStrictEqual({
description:
'あっぱれおじゃる様!数学の成績不足で管理者からタイムアウトでございます!'
});
}
)
);
});

it('args null (ojaru)', async () => {
await responder.on(
createMockMessage(
parseStringsOrThrow(['ojaru'], responder.schema),
(message) => {
expect(message).toStrictEqual({
title: '引数が不足してるみたいだ。',
description:
'あっぱれおじゃる様!コマンド形式を間違えエラーをお出しになられました!'
});
}
)
);
});
});