From c97fbc07c107d49f359aaeb2328d900e3ba680e9 Mon Sep 17 00:00:00 2001 From: Leo Zeng Date: Thu, 14 Mar 2024 18:57:34 -0700 Subject: [PATCH] Fix the docs to use WechatyBuilder to instantiate the Wechaty instance (#1532) * fix: use WechatyBuilder to instantiate the Wechaty instance * Update docusaurus/docs/getting-started/running-locally.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: use template literals for constructing URLs for better readability * fix: update error handling message for the bot's start process * revert: keep the QR code image URL part unchanged * 0.11.8 * revert: keep project version unchanged * 0.11.8 * 0.11.9 * revert: keep project version unchanged --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- docusaurus/docs/getting-started/running-locally.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docusaurus/docs/getting-started/running-locally.mdx b/docusaurus/docs/getting-started/running-locally.mdx index ca792446271..7c3b4468c20 100644 --- a/docusaurus/docs/getting-started/running-locally.mdx +++ b/docusaurus/docs/getting-started/running-locally.mdx @@ -290,7 +290,7 @@ import { Contact, Message, ScanStatus, - Wechaty, + WechatyBuilder, log, }from 'wechaty' @@ -364,8 +364,8 @@ async function onMessage (msg: Message) { Now initializing the bot by providing a name. ```ts -const bot = new Wechaty({ - name: 'ding-dong-bot', +const bot = WechatyBuilder.build({ + name: 'ding-dong-bot' }) ``` @@ -383,7 +383,7 @@ Finally for starting the bot ```ts bot.start() .then(() => log.info('StarterBot', 'Starter Bot Started.')) - .catch(e => log.error('StarterBot', e)) + .catch(e => log.error('StarterBot', 'Failed to start the bot:', e)) ``` ## Running the bot