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