mirror of
https://github.com/syuilo/ai.git
synced 2024-12-22 08:21:08 +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,33 +1,29 @@
|
|||
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';
|
||||
private ai: 藍;
|
||||
|
||||
public install = (ai: 藍) => {
|
||||
public install = (ai: 藍) => {
|
||||
this.ai = ai;
|
||||
}
|
||||
|
||||
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);
|
||||
} else {
|
||||
this.ai.api("following/create", {
|
||||
userId: msg.userId,
|
||||
});
|
||||
msg.reply(serifs.follow.ok);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
return {
|
||||
reaction: 'like'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
reaction: 'hmm'
|
||||
};
|
||||
}
|
||||
} 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