/** * Wechaty Chatbot SDK - https://github.com/wechaty/wechaty * * @copyright 2016 Huan LI (李卓桓) , and * Wechaty Contributors . * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import type * as PUPPET from '@juzi/wechaty-puppet'; import type { Constructor } from 'clone-class'; import type { Accepter } from '../schemas/acceptable.js'; import type { ContactInterface } from './contact.js'; declare const RoomInvitationMixin_base: ((abstract new (...args: any[]) => { readonly wechaty: import("../wechaty/wechaty-impl.js").WechatyInterface; }) & { readonly wechaty: import("../wechaty/wechaty-impl.js").WechatyInterface; }) & { new (): {}; }; /** * * accept room invitation */ declare class RoomInvitationMixin extends RoomInvitationMixin_base implements Accepter { readonly id: string; static load(id: string): RoomInvitationInterface; static acceptByQRCode(qrcode: string): Promise; /** * @hideconstructor * Instance Properties * */ constructor(id: string); toString(): string; /** * @ignore */ toStringAsync(): Promise; /** * Accept Room Invitation * * @returns {Promise} * * @example * const bot = new Wechaty() * bot.on('room-invite', async roomInvitation => { * try { * console.log(`received room-invite event.`) * await roomInvitation.accept() * } catch (e) { * console.error(e) * } * } * .start() */ accept(): Promise; /** * Get the inviter from room invitation * * @returns {ContactInterface} * @example * const bot = new Wechaty() * bot.on('room-invite', async roomInvitation => { * const inviter = await roomInvitation.inviter() * const name = inviter.name() * console.log(`received room invitation event from ${name}`) * } * .start() */ inviter(): Promise; /** * Get the room topic from room invitation * * @returns {string} * @example * const bot = new Wechaty() * bot.on('room-invite', async roomInvitation => { * const topic = await roomInvitation.topic() * console.log(`received room invitation event from room ${topic}`) * } * .start() */ topic(): Promise; memberCount(): Promise; /** * List of Room Members that you known(is friend) * @ignore */ memberList(): Promise; /** * Get the invitation time * * @returns {Promise} */ date(): Promise; /** * Returns the roopm invitation age in seconds.
* * For example, the invitation is sent at time `8:43:01`, * and when we received it in Wechaty, the time is `8:43:15`, * then the age() will return `8:43:15 - 8:43:01 = 14 (seconds)` * @returns {number} */ age(): Promise; /** * Load the room invitation info from disk * * @returns {RoomInvitationInterface} * @example * const bot = new Wechaty() * const dataFromDisk // get the room invitation info data from disk * const roomInvitation = await bot.RoomInvitation.fromJSON(dataFromDisk) * await roomInvitation.accept() */ static fromJSON(payload: string | PUPPET.payloads.RoomInvitation): Promise; /** * Get the room invitation info when listened on room-invite event * * @returns {string} * @example * const bot = new Wechaty() * bot.on('room-invite', async roomInvitation => { * const roomInvitation = bot.RoomInvitation.load(roomInvitation.id) * const jsonData = await roomInvitation.toJSON(roomInvitation.id) * // save the json data to disk, and we can use it by RoomInvitation.fromJSON() * } * .start() */ toJSON(): Promise; } declare const RoomInvitationImpl_base: { new (...args: any[]): {}; valid: (o: any) => o is RoomInvitationInterface; validInstance: (target: any) => target is RoomInvitationMixin; validInterface: (target: any) => target is RoomInvitationInterface; } & typeof RoomInvitationMixin; declare class RoomInvitationImpl extends RoomInvitationImpl_base { } interface RoomInvitationInterface extends RoomInvitationImpl { } declare type RoomInvitationConstructor = Constructor; export type { RoomInvitationConstructor, RoomInvitationInterface, }; export { RoomInvitationImpl, }; //# sourceMappingURL=room-invitation.d.ts.map