mirror of
https://github.com/syuilo/ai.git
synced 2024-11-09 23:48:01 +00:00
✌️
This commit is contained in:
parent
5c3408714b
commit
990cd7ccd2
|
@ -12,10 +12,10 @@ import WelcomeModule from './modules/welcome';
|
|||
import TimerModule from './modules/timer';
|
||||
import DiceModule from './modules/dice';
|
||||
import ServerModule from './modules/server';
|
||||
import FollowModule from './modules/follow';
|
||||
|
||||
import * as request from 'request-promise-native';
|
||||
import IModule from './module';
|
||||
import FollowModule from './modules/follow';
|
||||
const promiseRetry = require('promise-retry');
|
||||
|
||||
console.log('--- starting ai... ---');
|
||||
|
|
|
@ -2,4 +2,5 @@ export type User = {
|
|||
id: string;
|
||||
name: string;
|
||||
username: string;
|
||||
isFollowing: boolean;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 藍 from '../../ai';
|
||||
import IModule from '../../module';
|
||||
import MessageLike from '../../message-like';
|
||||
import serifs from '../../serifs';
|
||||
|
||||
export default class FollowModule implements IModule {
|
||||
public readonly name = 'follow';
|
||||
|
@ -12,22 +11,19 @@ export default class FollowModule implements IModule {
|
|||
}
|
||||
|
||||
public onMention = (msg: MessageLike) => {
|
||||
if (msg.text && msg.text.includes('フォロー')) {
|
||||
let user: any;
|
||||
this.ai.api("users/show", {
|
||||
if (msg.text && msg.includes(['フォロー', 'フォロバ', 'follow me'])) {
|
||||
if (!msg.user.isFollowing) {
|
||||
this.ai.api('following/create', {
|
||||
userId: msg.userId,
|
||||
}).then(u => {
|
||||
user = u;
|
||||
if (user.isFollowing) {
|
||||
msg.reply(serifs.follow.alreadyFollowed);
|
||||
});
|
||||
return {
|
||||
reaction: 'like'
|
||||
};
|
||||
} else {
|
||||
this.ai.api("following/create", {
|
||||
userId: msg.userId,
|
||||
});
|
||||
msg.reply(serifs.follow.ok);
|
||||
return {
|
||||
reaction: 'hmm'
|
||||
};
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -261,16 +261,6 @@ export default {
|
|||
server: {
|
||||
cpu: 'サーバーの負荷が高そうです。大丈夫でしょうか...?'
|
||||
},
|
||||
|
||||
follow: {
|
||||
ok: 'フォローしました!',
|
||||
|
||||
requireMoreLove: 'もう少し仲良くなったらお願いできますか?',
|
||||
|
||||
alreadyFollowed: 'えっ?既にあなたのことはフォローしていますよ!',
|
||||
|
||||
ng: '嫌です...',
|
||||
}
|
||||
};
|
||||
|
||||
export function getSerif(serif: string | string[]): string {
|
||||
|
|
Loading…
Reference in a new issue