diff --git a/src/index.ts b/src/index.ts index dca5703..cff6315 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,7 @@ import SleepReportModule from './modules/sleep-report'; import NotingModule from './modules/noting'; import PollModule from './modules/poll'; import ReminderModule from './modules/reminder'; +import RecommendMusicModule from './modules/recommend-music'; console.log(' __ ____ _____ ___ '); console.log(' /__\\ (_ _)( _ )/ __)'); @@ -88,6 +89,7 @@ promiseRetry(retry => { new NotingModule(), new PollModule(), new ReminderModule(), + new RecommendMusicModule(), ]); }).catch(e => { log(chalk.red('Failed to fetch the account')); diff --git a/src/modules/recommend-music/index.ts b/src/modules/recommend-music/index.ts new file mode 100644 index 0000000..c7ad4c3 --- /dev/null +++ b/src/modules/recommend-music/index.ts @@ -0,0 +1,68 @@ +import autobind from 'autobind-decorator'; +import Module from '@/module'; +import Message from '@/message'; +import serifs from '@/serifs'; + +const musicUrls = [ + 'https://www.nicovideo.jp/watch/sm31677384', + 'https://www.nicovideo.jp/watch/sm19042393', + 'https://www.nicovideo.jp/watch/sm24892241', + 'https://www.nicovideo.jp/watch/sm20503793', + 'https://www.nicovideo.jp/watch/sm23393078', + 'https://www.nicovideo.jp/watch/sm24485755', + 'https://www.nicovideo.jp/watch/sm25808292', + 'https://www.nicovideo.jp/watch/sm20433229', + 'https://www.nicovideo.jp/watch/sm8541371', + 'https://www.nicovideo.jp/watch/sm34509853', + 'https://www.nicovideo.jp/watch/sm26661454', + 'https://www.nicovideo.jp/watch/sm9797269', + 'https://www.nicovideo.jp/watch/sm42536675', + 'https://www.nicovideo.jp/watch/sm10244728', + 'https://www.nicovideo.jp/watch/sm24626484', + 'https://www.nicovideo.jp/watch/sm39875801', + 'https://www.nicovideo.jp/watch/sm31472648', + 'https://www.nicovideo.jp/watch/sm22608740', + 'https://www.nicovideo.jp/watch/sm30519579', + 'https://www.nicovideo.jp/watch/sm28406516', + 'https://www.nicovideo.jp/watch/sm21652882', + 'https://www.nicovideo.jp/watch/sm32626095', + 'https://www.nicovideo.jp/watch/sm32748202', + 'https://www.nicovideo.jp/watch/sm19870840', + 'https://www.nicovideo.jp/watch/sm13471002', + 'https://www.nicovideo.jp/watch/sm13173001', + 'https://www.nicovideo.jp/watch/sm12195657', + 'https://www.nicovideo.jp/watch/sm38824626', + 'https://www.nicovideo.jp/watch/sm27057005', + 'https://www.nicovideo.jp/watch/sm21036288', + 'https://www.nicovideo.jp/watch/sm23762151', + 'https://www.nicovideo.jp/watch/nm14629738', + 'https://www.nicovideo.jp/watch/sm6529016', + 'https://www.nicovideo.jp/watch/sm19625630', + 'https://www.nicovideo.jp/watch/sm11224129', + 'https://www.nicovideo.jp/watch/sm11834233', + 'https://www.nicovideo.jp/watch/sm30519579', + 'https://www.nicovideo.jp/watch/sm32537029', + 'https://www.nicovideo.jp/watch/sm38708262' +] + +export default class extends Module { + public readonly name = 'recommendMusic'; + + @autobind + public install() { + return { + mentionHook: this.mentionHook + }; + } + + @autobind + private async mentionHook(msg: Message) { + if (msg.includes(['音楽', '曲'])) { + const music = musicUrls[Math.floor(Math.random() * musicUrls.length)]; + msg.reply(serifs.recommendMusic.suggestMusic(music)); + return true; + } else { + return false; + } + } +} diff --git a/src/serifs.ts b/src/serifs.ts index 15ae16e..5670c73 100644 --- a/src/serifs.ts +++ b/src/serifs.ts @@ -313,6 +313,13 @@ export default { suggest: emoji => `こんなのはどうですか?→${emoji}`, }, + /** + * 音楽おすすめ + */ + recommendMusic: { + suggestMusic: musicUrl => `こんなのはどうでしょう?\n${musicUrl}` + }, + /** * 占い */ diff --git a/torisetu.md b/torisetu.md index 3b1c13b..b4bbecc 100644 --- a/torisetu.md +++ b/torisetu.md @@ -5,6 +5,10 @@ ## プロフィール [こちら](https://xn--931a.moe/) +## 独自機能 +### 曲紹介 +「曲」「音楽」などと話しかけると、リストにある中からランダムで曲をおすすめしてくれます。(現在40曲程度) + ## 藍の主な機能 ### 挨拶 「おはよう」「おやすみ」などと話しかけると反応してくれます。