-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: タコピー構文に教員名を変更できるオプション
-c
を追加 (#585)
* feat: オプションの追加 * オプション追加実装に伴うテストケースの追加 * chore: テストの引数の変更 * refactor: オプション引数への再設計( #586 対応待ち ) * fix: オプションの設定もれの修正 * chore: テストケースの修正 * chore: deletion comment Co-authored-by: Mikuroさいな <ryosukadnak@gmail.com> * fix: テストケースの追加 修正 * refactor: オプション・フラグの重複時への対応 * feat: 引数不足時のテストケースの追加 * chore: ヘルプメッセージの親切化 Co-authored-by: m2en <me@m2en.dev> Co-authored-by: Mikuroさいな <ryosukadnak@gmail.com> Co-authored-by: m2en <me@m2en.dev>
- Loading branch information
1 parent
4654a47
commit 9c24742
Showing
2 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
import type { MemeTemplate } from '../../../model/meme-template.js'; | ||
|
||
const takopiFlags = ['f'] as const; | ||
const takopiOptions = ['c'] as const; | ||
|
||
export const takopi: MemeTemplate<typeof takopiFlags[number], never> = { | ||
export const takopi: MemeTemplate< | ||
typeof takopiFlags[number], | ||
typeof takopiOptions[number] | ||
> = { | ||
commandNames: ['takopi'], | ||
description: | ||
'「〜、出して」\n`-f` で教員と自分の名前の位置を反対にします。([idea: フライさん](https://github.com/approvers/OreOreBot2/issues/90))', | ||
'「〜、出して」\n`-f` で教員と自分の名前の位置を反対にします。\n`-c <教員の名前> <出すもの>`で教員の名前も変更可能です。\n([idea: フライさん](https://github.com/approvers/OreOreBot2/issues/90))', | ||
flagsKeys: takopiFlags, | ||
optionsKeys: [], | ||
optionsKeys: takopiOptions, | ||
errorMessage: '(引数が)わ、わかんないっピ.......', | ||
generate(args, author) { | ||
if (args.flags.f) | ||
return `${author}「${args.body}、出して」\n教員「わ、わかんないっピ.......」`; | ||
return `教員「${args.body}、出して」\n${author}「わ、わかんないっピ.......」`; | ||
const takopiArgs = { | ||
takopi: author, | ||
shizuka: args.options.c ?? '教員', | ||
goods: args.body ?? '課題' | ||
}; | ||
|
||
if (args.flags.f) { | ||
const temp: string = takopiArgs.takopi; | ||
takopiArgs.takopi = takopiArgs.shizuka; | ||
takopiArgs.shizuka = temp; | ||
} | ||
return `${takopiArgs.shizuka}「${takopiArgs.goods}、出して」\n${takopiArgs.takopi}「わ、わかんないっピ.......」`; | ||
} | ||
}; |