@grammyjs/hydrate
Version:
Hydration plugin for grammY
90 lines (89 loc) • 4.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.installChatMethods = installChatMethods;
function installChatMethods(api, chat) {
const methods = {
setPermissions: (permissions, other, signal) => api.setChatPermissions({
chat_id: chat.id,
permissions,
...other,
}, signal),
getMember: (userId, other, signal) => api.getChatMember({
chat_id: chat.id,
user_id: userId,
...other,
}, signal),
getMembersCount: (other, signal) => api.getChatMemberCount({ chat_id: chat.id, ...other }, signal),
getAdmins: (other, signal) => api.getChatAdministrators({ chat_id: chat.id, ...other }, signal),
setStickerSet: (stickerSetName, other, signal) => api.setChatStickerSet({
chat_id: chat.id,
sticker_set_name: stickerSetName,
...other,
}, signal),
deleteStickerSet: (other, signal) => api.deleteChatStickerSet({ chat_id: chat.id, ...other }, signal),
createForumTopic: (name, other, signal) => api.createForumTopic({ chat_id: chat.id, name, ...other }, signal),
editForumTopic: (messageThreadId, other, signal) => api.editForumTopic({
chat_id: chat.id,
message_thread_id: messageThreadId,
...other,
}, signal),
closeForumTopic: (messageThreadId, other, signal) => api.closeForumTopic({
chat_id: chat.id,
message_thread_id: messageThreadId,
...other,
}, signal),
reopenForumTopic: (messageThreadId, other, signal) => api.reopenForumTopic({
chat_id: chat.id,
message_thread_id: messageThreadId,
...other,
}, signal),
deleteForumTopic: (messageThreadId, other, signal) => api.deleteForumTopic({
chat_id: chat.id,
message_thread_id: messageThreadId,
...other,
}, signal),
unpinAllForumTopicMessages: (messageThreadId, other, signal) => api.unpinAllForumTopicMessages({
chat_id: chat.id,
message_thread_id: messageThreadId,
...other,
}, signal),
editGeneralForumTopic: (name, other, signal) => api.editGeneralForumTopic({ chat_id: chat.id, name, ...other }, signal),
closeGeneralForumTopic: (other, signal) => api.closeGeneralForumTopic({ chat_id: chat.id, ...other }, signal),
reopenGeneralForumTopic: (other, signal) => api.reopenGeneralForumTopic({ chat_id: chat.id, ...other }, signal),
hideGeneralForumTopic: (other, signal) => api.hideGeneralForumTopic({ chat_id: chat.id, ...other }, signal),
unhideGeneralForumTopic: (other, signal) => api.unhideGeneralForumTopic({ chat_id: chat.id, ...other }, signal),
setMenuButton: (other, signal) => api.setChatMenuButton({ chat_id: chat.id, ...other }, signal),
getMenuButton: (other, signal) => api.getChatMenuButton({ chat_id: chat.id, ...other }, signal),
leave: (other, signal) => api.leaveChat({ chat_id: chat.id, ...other }, signal),
setPhoto: (photo, other, signal) => api.setChatPhoto({ chat_id: chat.id, photo, ...other }, signal),
deletePhoto: (other, signal) => api.deleteChatPhoto({ chat_id: chat.id, ...other }, signal),
setTitle: (title, other, signal) => api.setChatTitle({ chat_id: chat.id, title, ...other }, signal),
setDescription: (description, other, signal) => api.setChatDescription({ chat_id: chat.id, description, ...other }, signal),
unpinAllMessages: (other, signal) => api.unpinAllChatMessages({ chat_id: chat.id, ...other }, signal),
revokeInviteLink: (inviteLink, other, signal) => api.revokeChatInviteLink({
chat_id: chat.id,
invite_link: inviteLink,
...other,
}, signal),
editInviteLink: (inviteLink, other, signal) => api.editChatInviteLink({
chat_id: chat.id,
invite_link: inviteLink,
...other,
}, signal),
createInviteLink: (other, signal) => api.createChatInviteLink({ chat_id: chat.id, ...other }, signal),
exportInviteLink: (other, signal) => api.exportChatInviteLink({ chat_id: chat.id, ...other }, signal),
unbanSenderChat: (senderChatId, other, signal) => api.unbanChatSenderChat({
chat_id: chat.id,
sender_chat_id: senderChatId,
...other,
}, signal),
banSenderChat: (senderChatId, other, signal) => api.banChatSenderChat({
chat_id: chat.id,
sender_chat_id: senderChatId,
...other,
}, signal),
banMember: (userId, other, signal) => api.banChatMember({ chat_id: chat.id, user_id: userId, ...other }, signal),
unbanMember: (userId, other, signal) => api.unbanChatMember({ chat_id: chat.id, user_id: userId, ...other }, signal),
};
Object.assign(chat, methods);
}