syuilo 8886a24f16
✌️
2018-12-03 17:20:15 +09:00

32 lines
697 B
TypeScript

import from '../../ai';
import IModule from '../../module';
import MessageLike from '../../message-like';
export default class FollowModule implements IModule {
public readonly name = 'follow';
private ai: ;
public install = (ai: ) => {
this.ai = ai;
}
public onMention = (msg: MessageLike) => {
if (msg.text && msg.includes(['フォロー', 'フォロバ', 'follow me'])) {
if (!msg.user.isFollowing) {
this.ai.api('following/create', {
userId: msg.userId,
});
return {
reaction: msg.friend.love >= 0 ? 'like' : null
};
} else {
return {
reaction: msg.friend.love >= 0 ? 'hmm' : null
};
}
} else {
return false;
}
}
}