mirror of
https://github.com/syuilo/ai.git
synced 2025-03-25 21:12:56 +00:00
feat: 音楽おすすめ機能の追加
This commit is contained in:
parent
f8b15a1db9
commit
0d45897dc3
3 changed files with 39 additions and 0 deletions
|
@ -34,6 +34,7 @@ import SleepReportModule from './modules/sleep-report';
|
||||||
import NotingModule from './modules/noting';
|
import NotingModule from './modules/noting';
|
||||||
import PollModule from './modules/poll';
|
import PollModule from './modules/poll';
|
||||||
import ReminderModule from './modules/reminder';
|
import ReminderModule from './modules/reminder';
|
||||||
|
import RecommendMusicModule from './modules/recommend-music';
|
||||||
|
|
||||||
console.log(' __ ____ _____ ___ ');
|
console.log(' __ ____ _____ ___ ');
|
||||||
console.log(' /__\\ (_ _)( _ )/ __)');
|
console.log(' /__\\ (_ _)( _ )/ __)');
|
||||||
|
@ -88,6 +89,7 @@ promiseRetry(retry => {
|
||||||
new NotingModule(),
|
new NotingModule(),
|
||||||
new PollModule(),
|
new PollModule(),
|
||||||
new ReminderModule(),
|
new ReminderModule(),
|
||||||
|
new RecommendMusicModule(),
|
||||||
]);
|
]);
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
log(chalk.red('Failed to fetch the account'));
|
log(chalk.red('Failed to fetch the account'));
|
||||||
|
|
30
src/modules/recommend-music/index.ts
Normal file
30
src/modules/recommend-music/index.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
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'
|
||||||
|
]
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -313,6 +313,13 @@ export default {
|
||||||
suggest: emoji => `こんなのはどうですか?→${emoji}`,
|
suggest: emoji => `こんなのはどうですか?→${emoji}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 音楽おすすめ
|
||||||
|
*/
|
||||||
|
recommendMusic: {
|
||||||
|
suggestMusic: musicUrl => `こんなのはどうでしょう?${musicUrl}`
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 占い
|
* 占い
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue