提交 96903440 编写于 作者: L lijiarui 提交者: Huan (李卓桓)

fix #1475 bug (#1477)

* Comments in examples should be // instead of # as request in #1475

* Link to examples by link with a 0.19.4 version to prevent the future 404 error as request in #1475
上级 de9c7d7c
......@@ -44,7 +44,7 @@ export const POOL = Symbol('pool')
/**
* All wechat contacts(friend) will be encapsulated as a Contact.
*
* [Examples/Contact-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts}
* [Examples/Contact-Bot]{@link https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts}
*/
export class Contact extends Accessory implements Sayable {
......@@ -312,11 +312,11 @@ export class Contact extends Accessory implements Sayable {
* await bot.start()
* const contact = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of your contact name in wechat
*
* # 1. send text to contact
* // 1. send text to contact
*
* await contact.say('welcome to wechaty!')
*
* # 2. send media file to contact
* // 2. send media file to contact
*
* import { FileBox } from 'file-box'
* const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
......@@ -324,7 +324,7 @@ export class Contact extends Accessory implements Sayable {
* await contact.say(fileBox1)
* await contact.say(fileBox2)
*
* # 3. send contact card to contact
* // 3. send contact card to contact
*
* const contactCard = bot.Contact.load('contactId')
* await contact.say(contactCard)
......@@ -569,7 +569,7 @@ export class Contact extends Accessory implements Sayable {
*
* @returns {Promise<FileBox>}
* @example
* # Save avatar to local file like `1-name.jpg`
* // Save avatar to local file like `1-name.jpg`
*
* const file = await contact.avatar()
* const name = file.name
......
......@@ -50,7 +50,7 @@ import {
* 2. receive request(in friend event)
* 3. confirmation friendship(friend event)
*
* [Examples/Friend-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts}
* [Examples/Friend-Bot]{@link https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts}
*/
export class Friendship extends Accessory {
......@@ -226,13 +226,13 @@ export class Friendship extends Accessory {
* console.log(`received friend event.`)
* switch (friendship.type()) {
*
* # 1. New Friend Request
* // 1. New Friend Request
*
* case Friendship.Type.Receive:
* await friendship.accept()
* break
*
* # 2. Friend Ship Confirmed
* // 2. Friend Ship Confirmed
*
* case Friendship.Type.Confirm:
* console.log(`friend ship confirmed`)
......
......@@ -50,7 +50,7 @@ import {
/**
* All wechat messages will be encapsulated as a Message.
*
* [Examples/Ding-Dong-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts}
* [Examples/Ding-Dong-Bot]{@link https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts}
*/
export class Message extends Accessory implements Sayable {
......@@ -336,7 +336,7 @@ export class Message extends Accessory implements Sayable {
/**
* Reply a Text or Media File message to the sender.
*
* @see {@link https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts|Examples/ding-dong-bot}
* @see {@link https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts|Examples/ding-dong-bot}
* @param {(string | Contact | FileBox)} textOrContactOrFile
* send text, Contact, or file to bot. </br>
* You can use {@link https://www.npmjs.com/package/file-box|FileBox} to send file
......@@ -350,20 +350,20 @@ export class Message extends Accessory implements Sayable {
* bot
* .on('message', async m => {
*
* # 1. send Image
* // 1. send Image
*
* if (/^ding$/i.test(m.text())) {
* const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
* await msg.say(fileBox)
* }
*
* # 2. send Text
* // 2. send Text
*
* if (/^dong$/i.test(m.text())) {
* await msg.say('dingdingding')
* }
*
* # 3. send Contact
* // 3. send Contact
*
* if (/^lijiarui$/i.test(m.text())) {
* const contactCard = await bot.Contact.find({name: 'lijiarui'})
......
......@@ -55,7 +55,7 @@ import {
/**
* All wechat rooms(groups) will be encapsulated as a Room.
*
* [Examples/Room-Bot]{@link https://github.com/Chatie/wechaty/blob/master/examples/room-bot.ts}
* [Examples/Room-Bot]{@link https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/room-bot.ts}
*/
export class Room extends Accessory implements Sayable {
......@@ -362,22 +362,22 @@ export class Room extends Accessory implements Sayable {
* // after logged in...
* const room = await bot.Room.find({topic: 'wechaty'})
*
* # 1. Send text inside Room
* // 1. Send text inside Room
*
* await room.say('Hello world!')
*
* # 2. Send media file inside Room
* // 2. Send media file inside Room
* import { FileBox } from 'file-box'
* const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
* const fileBox2 = FileBox.fromLocal('/tmp/text.txt')
* await room.say(fileBox1)
* await room.say(fileBox2)
*
* # 3. Send Contact Card in a room
* // 3. Send Contact Card in a room
* const contactCard = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of the room member
* await room.say(contactCard)
*
* # 4. Send text inside room and mention @mention contact
* // 4. Send text inside room and mention @mention contact
* const contact = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of the room member
* await room.say('Hello world!', contact)
*/
......
......@@ -384,35 +384,35 @@ export class Wechaty extends Accessory implements Sayable {
* see more in {@link WechatyEventName}
*
* @example <caption>Event:scan</caption>
* # Scan Event will emit when the bot needs to show you a QR Code for scanning
* // Scan Event will emit when the bot needs to show you a QR Code for scanning
*
* bot.on('scan', (url: string, code: number) => {
* console.log(`[${code}] Scan ${url} to login.` )
* })
*
* @example <caption>Event:login </caption>
* # Login Event will emit when bot login full successful.
* // Login Event will emit when bot login full successful.
*
* bot.on('login', (user: ContactSelf) => {
* console.log(`user ${user} login`)
* })
*
* @example <caption>Event:logout </caption>
* # Logout Event will emit when bot detected log out.
* // Logout Event will emit when bot detected log out.
*
* bot.on('logout', (user: ContactSelf) => {
* console.log(`user ${user} logout`)
* })
*
* @example <caption>Event:message </caption>
* # Message Event will emit when there's a new message.
* // Message Event will emit when there's a new message.
*
* wechaty.on('message', (message: Message) => {
* console.log(`message ${message} received`)
* })
*
* @example <caption>Event:friendship </caption>
* # Friendship Event will emit when got a new friend request, or friendship is confirmed.
* // Friendship Event will emit when got a new friend request, or friendship is confirmed.
*
* bot.on('friendship', (friendship: Friendship) => {
* if(friendship.type() === Friendship.Type.RECEIVE){ // 1. receive new friendship request from new contact
......@@ -429,7 +429,7 @@ export class Wechaty extends Accessory implements Sayable {
* })
*
* @example <caption>Event:room-join </caption>
* # room-join Event will emit when someone join the room.
* // room-join Event will emit when someone join the room.
*
* bot.on('room-join', (room: Room, inviteeList: Contact[], inviter: Contact) => {
* const nameList = inviteeList.map(c => c.name()).join(',')
......@@ -437,7 +437,7 @@ export class Wechaty extends Accessory implements Sayable {
* })
*
* @example <caption>Event:room-leave </caption>
* # room-leave Event will emit when someone leave the room.
* // room-leave Event will emit when someone leave the room.
*
* bot.on('room-leave', (room: Room, leaverList: Contact[]) => {
* const nameList = leaverList.map(c => c.name()).join(',')
......@@ -445,14 +445,14 @@ export class Wechaty extends Accessory implements Sayable {
* })
*
* @example <caption>Event:room-topic </caption>
* # room-topic Event will emit when someone change the room's topic.
* // room-topic Event will emit when someone change the room's topic.
*
* bot.on('room-topic', (room: Room, topic: string, oldTopic: string, changer: Contact) => {
* console.log(`Room ${room.topic()} topic changed from ${oldTopic} to ${topic} by ${changer.name()}`)
* })
*
* @example <caption>Event:error </caption>
* # error Event will emit when there's an error occurred.
* // error Event will emit when there's an error occurred.
*
* bot.on('error', (error) => {
* console.error(error)
......@@ -1029,19 +1029,19 @@ export class Wechaty extends Accessory implements Sayable {
* await bot.start()
* // after logged in
*
* # 1. send text to bot itself
* // 1. send text to bot itself
* await bot.say('hello!')
*
* # 2. send Contact to bot itself
* // 2. send Contact to bot itself
* const contact = bot.Contact.load('contactId')
* await bot.say(contact)
*
* # 3. send Image to bot itself from remote url
* // 3. send Image to bot itself from remote url
* import { FileBox } from 'file-box'
* const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
* await bot.say(fileBox)
*
* # 4. send Image to bot itself from local file
* // 4. send Image to bot itself from local file
* import { FileBox } from 'file-box'
* const fileBox = FileBox.fromLocal('/tmp/text.jpg')
* await bot.say(fileBox)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册