@juzi/wechaty
Version:
Wechaty is a RPA SDK for Chatbot Makers.
155 lines • 5.27 kB
TypeScript
/**
* Wechaty Chatbot SDK - https://github.com/wechaty/wechaty
*
* @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and
* Wechaty Contributors <https://github.com/wechaty>.
*
* 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<PUPPET.types.RoomInvitationAcceptByQRCode>;
/**
* @hideconstructor
* Instance Properties
*
*/
constructor(id: string);
toString(): string;
/**
* @ignore
*/
toStringAsync(): Promise<string>;
/**
* Accept Room Invitation
*
* @returns {Promise<void>}
*
* @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<void>;
/**
* 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<ContactInterface>;
/**
* 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<string>;
memberCount(): Promise<number>;
/**
* List of Room Members that you known(is friend)
* @ignore
*/
memberList(): Promise<ContactInterface[]>;
/**
* Get the invitation time
*
* @returns {Promise<Date>}
*/
date(): Promise<Date>;
/**
* Returns the roopm invitation age in seconds. <br>
*
* 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<number>;
/**
* 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<RoomInvitationInterface>;
/**
* 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<string>;
}
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<RoomInvitationInterface, typeof RoomInvitationImpl>;
export type { RoomInvitationConstructor, RoomInvitationInterface, };
export { RoomInvitationImpl, };
//# sourceMappingURL=room-invitation.d.ts.map