mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-06 16:53:58 +09:00
Use cafy
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import it from '../../../it';
|
||||
import it from 'cafy';
|
||||
import Message from '../../../models/messaging-message';
|
||||
import { isValidText } from '../../../models/messaging-message';
|
||||
import History from '../../../models/messaging-history';
|
||||
@ -21,7 +21,7 @@ import config from '../../../../conf';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'user_id' parameter
|
||||
const [recipientId, recipientIdErr] = it(params.user_id).expect.id().required().qed();
|
||||
const [recipientId, recipientIdErr] = it(params.user_id).expect.id().required().get();
|
||||
if (recipientIdErr) return rej('invalid user_id param');
|
||||
|
||||
// Myself
|
||||
@ -43,11 +43,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'text' parameter
|
||||
const [text, textErr] = it(params.text).expect.string().validate(isValidText).qed();
|
||||
const [text, textErr] = it(params.text).expect.string().validate(isValidText).get();
|
||||
if (textErr) return rej('invalid text');
|
||||
|
||||
// Get 'file_id' parameter
|
||||
const [fileId, fileIdErr] = it(params.file_id).expect.id().qed();
|
||||
const [fileId, fileIdErr] = it(params.file_id).expect.id().get();
|
||||
if (fileIdErr) return rej('invalid file_id param');
|
||||
|
||||
let file = null;
|
||||
|
Reference in New Issue
Block a user