ai/src/modules/emoji/index.ts

138 lines
1.7 KiB
TypeScript
Raw Normal View History

2018-08-11 06:53:49 +00:00
import from '../../ai';
import IModule from '../../module';
import MessageLike from '../../message-like';
import serifs from '../../serifs';
const hands = [
'👏',
'👍',
'👎',
'👊',
'✊',
['🤛', '🤜'],
['🤜', '🤛'],
'🤞',
'✌',
'🤟',
'🤘',
'👌',
'👈',
'👉',
['👈', '👉'],
['👉', '👈'],
'👆',
'👇',
'☝',
['✋', '🤚'],
'🖐',
'🖖',
'👋',
'🤙',
'💪',
'🖕'
]
const faces = [
'😀',
'😃',
'😄',
'😁',
'😆',
'😅',
'😂',
'🤣',
2018-08-11 07:47:36 +00:00
'☺️',
'😊',
2018-08-11 06:53:49 +00:00
'😇',
'🙂',
'🙃',
'😉',
'😌',
'😍',
'😘',
'😗',
'😙',
'😚',
'😋',
'😛',
'😝',
'😜',
'🤪',
'🤨',
'🧐',
'🤓',
'😎',
'🤩',
'😏',
'😒',
'😞',
'😔',
'😟',
'😕',
'🙁',
'☹️',
'😣',
'😖',
'😫',
'😩',
'😢',
'😭',
'😤',
'😠',
'😡',
'🤬',
'🤯',
'😳',
'😱',
'😨',
'😰',
'😥',
'😓',
'🤗',
'🤔',
'🤭',
'🤫',
'🤥',
'😶',
'😐',
'😑',
'😬',
'🙄',
'😯',
'😦',
'😧',
'😮',
'😲',
'😴',
'🤤',
'😪',
'😵',
'🤐',
'🤢',
'🤮',
'🤧',
'😷',
'🤒',
'🤕',
'🤑',
'🤠'
]
export default class EmojiModule implements IModule {
public name = 'emoji';
2018-08-11 06:53:49 +00:00
public install = (ai: ) => { }
public onMention = (msg: MessageLike) => {
if (msg.text && (msg.text.includes('絵文字') || msg.text.includes('emoji'))) {
2018-08-11 06:53:49 +00:00
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;
}
}
}