Skip to content

Commit

Permalink
feat: あっぱれおじゃる様ミーム構文の追加 (#621)
Browse files Browse the repository at this point in the history
* feat: あっぱれおじゃる様ミーム構文の追加

* chore: ヘルプ文の変更

Co-authored-by: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com>
  • Loading branch information
raiga0310 and KisaragiEffective authored Dec 13, 2022
1 parent 38f5d03 commit 2cbfad1
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
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:
'あっぱれおじゃる様!コマンド形式を間違えエラーをお出しになられました!'
});
}
)
);
});
});

0 comments on commit 2cbfad1

Please sign in to comment.