Update cafy to 8.0.0 🚀
This commit is contained in:
parent
0c3e9dd5e0
commit
f664cf09c0
97 changed files with 294 additions and 291 deletions
|
@ -12,42 +12,42 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
|||
const isSecure = user != null && app == null;
|
||||
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).optional.nullable.string().pipe(isValidName).get();
|
||||
const [name, nameErr] = $.str.optional().nullable().pipe(isValidName).get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
if (name) user.name = name;
|
||||
|
||||
// Get 'description' parameter
|
||||
const [description, descriptionErr] = $(params.description).optional.nullable.string().pipe(isValidDescription).get();
|
||||
const [description, descriptionErr] = $.str.optional().nullable().pipe(isValidDescription).get(params.description);
|
||||
if (descriptionErr) return rej('invalid description param');
|
||||
if (description !== undefined) user.description = description;
|
||||
|
||||
// Get 'location' parameter
|
||||
const [location, locationErr] = $(params.location).optional.nullable.string().pipe(isValidLocation).get();
|
||||
const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location);
|
||||
if (locationErr) return rej('invalid location param');
|
||||
if (location !== undefined) user.profile.location = location;
|
||||
|
||||
// Get 'birthday' parameter
|
||||
const [birthday, birthdayErr] = $(params.birthday).optional.nullable.string().pipe(isValidBirthday).get();
|
||||
const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday);
|
||||
if (birthdayErr) return rej('invalid birthday param');
|
||||
if (birthday !== undefined) user.profile.birthday = birthday;
|
||||
|
||||
// Get 'avatarId' parameter
|
||||
const [avatarId, avatarIdErr] = $(params.avatarId).optional.type(ID).get();
|
||||
const [avatarId, avatarIdErr] = $.type(ID).optional().get(params.avatarId);
|
||||
if (avatarIdErr) return rej('invalid avatarId param');
|
||||
if (avatarId) user.avatarId = avatarId;
|
||||
|
||||
// Get 'bannerId' parameter
|
||||
const [bannerId, bannerIdErr] = $(params.bannerId).optional.type(ID).get();
|
||||
const [bannerId, bannerIdErr] = $.type(ID).optional().get(params.bannerId);
|
||||
if (bannerIdErr) return rej('invalid bannerId param');
|
||||
if (bannerId) user.bannerId = bannerId;
|
||||
|
||||
// Get 'isBot' parameter
|
||||
const [isBot, isBotErr] = $(params.isBot).optional.boolean().get();
|
||||
const [isBot, isBotErr] = $.bool.optional().get(params.isBot);
|
||||
if (isBotErr) return rej('invalid isBot param');
|
||||
if (isBot != null) user.isBot = isBot;
|
||||
|
||||
// Get 'autoWatch' parameter
|
||||
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().get();
|
||||
const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch);
|
||||
if (autoWatchErr) return rej('invalid autoWatch param');
|
||||
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue