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 {
2018-08-30 23:20:49 +00:00
public readonly 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;
2018-08-29 07:47:07 +00:00
msg.reply(serifs.emoji.suggest(emoji));
2018-08-11 06:53:49 +00:00
return true;
} else {
return false;
}
}
}