@grammyjs/hydrate
Version:
Hydration plugin for grammY
40 lines (39 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.installUserMethods = installUserMethods;
function installUserMethods(api, user, chatId) {
const methods = {
getProfilePhotos: (other, signal) => api.getUserProfilePhotos({
user_id: user.id,
...other,
}, signal),
ban: (other, signal) => api.banChatMember({
chat_id: chatId,
user_id: user.id,
...other,
}, signal),
promote: (other, signal) => api.promoteChatMember({
chat_id: chatId,
user_id: user.id,
...other,
}, signal),
restrict: (permissions, other, signal) => api.restrictChatMember({
permissions,
chat_id: chatId,
user_id: user.id,
...other,
}, signal),
setCustomTitle: (title, other, signal) => api.setChatAdministratorCustomTitle({
custom_title: title,
chat_id: chatId,
user_id: user.id,
...other,
}, signal),
unban: (other, signal) => api.unbanChatMember({
chat_id: chatId,
user_id: user.id,
...other,
}, signal),
};
return Object.assign(user, methods);
}