This commit is contained in:
syuilo 2018-08-11 15:53:49 +09:00
parent 6160d0f825
commit 31056f20c7
3 changed files with 144 additions and 1 deletions

View file

@ -3,6 +3,7 @@ import config from './config';
import ReversiModule from './modules/reversi'; import ReversiModule from './modules/reversi';
import ServerModule from './modules/server'; import ServerModule from './modules/server';
import PingModule from './modules/ping'; import PingModule from './modules/ping';
import EmojiModule from './modules/emoji';
import * as request from 'request-promise-native'; import * as request from 'request-promise-native';
const promiseRetry = require('promise-retry'); const promiseRetry = require('promise-retry');
@ -16,6 +17,7 @@ promiseRetry(retry => {
const ai = new (account); const ai = new (account);
ai.install(new PingModule()); ai.install(new PingModule());
ai.install(new EmojiModule());
ai.install(new ServerModule()); ai.install(new ServerModule());
ai.install(new ReversiModule()); ai.install(new ReversiModule());
}); });

135
src/modules/emoji/index.ts Normal file
View file

@ -0,0 +1,135 @@
import from '../../ai';
import IModule from '../../module';
import MessageLike from '../../message-like';
import serifs from '../../serifs';
const hands = [
'👏',
'👍',
'👎',
'👊',
'✊',
['🤛', '🤜'],
['🤜', '🤛'],
'🤞',
'✌',
'🤟',
'🤘',
'👌',
'👈',
'👉',
['👈', '👉'],
['👉', '👈'],
'👆',
'👇',
'☝',
['✋', '🤚'],
'🖐',
'🖖',
'👋',
'🤙',
'💪',
'🖕'
]
const faces = [
'😀',
'😃',
'😄',
'😁',
'😆',
'😅',
'😂',
'🤣',
'☺',
'️😊',
'😇',
'🙂',
'🙃',
'😉',
'😌',
'😍',
'😘',
'😗',
'😙',
'😚',
'😋',
'😛',
'😝',
'😜',
'🤪',
'🤨',
'🧐',
'🤓',
'😎',
'🤩',
'😏',
'😒',
'😞',
'😔',
'😟',
'😕',
'🙁',
'☹️',
'😣',
'😖',
'😫',
'😩',
'😢',
'😭',
'😤',
'😠',
'😡',
'🤬',
'🤯',
'😳',
'😱',
'😨',
'😰',
'😥',
'😓',
'🤗',
'🤔',
'🤭',
'🤫',
'🤥',
'😶',
'😐',
'😑',
'😬',
'🙄',
'😯',
'😦',
'😧',
'😮',
'😲',
'😴',
'🤤',
'😪',
'😵',
'🤐',
'🤢',
'🤮',
'🤧',
'😷',
'🤒',
'🤕',
'🤑',
'🤠'
]
export default class EmojiModule implements IModule {
public install = (ai: ) => { }
public onMention = (msg: MessageLike) => {
if (msg.text && msg.text.indexOf('絵文字') > -1) {
const hand = hands[Math.floor(Math.random() * hands.length)];
const face = faces[Math.floor(Math.random() * faces.length)];
const emoji = Array.isArray(hand) ? hand[0] + face + hand[1] : hand + face + hand;
msg.reply(serifs.EMOJI_SUGGEST.replace('$', emoji));
return true;
} else {
return false;
}
}
}

View file

@ -18,5 +18,11 @@ export default {
* *
*/ */
REBOOT: 'では、まもなくサーバーを再起動します!', REBOOT: 'では、まもなくサーバーを再起動します!',
REBOOT_DETAIL: '(私も再起動に巻き込まれちゃうので、サーバーの再起動が完了したことのお知らせはできません...)' REBOOT_DETAIL: '(私も再起動に巻き込まれちゃうので、サーバーの再起動が完了したことのお知らせはできません...)',
/**
*
*/
EMOJI_SUGGEST: 'こんなのはどうですか?→$',
}; };