diff --git a/docs/english/building-an-app.md b/docs/english/building-an-app.md index 65c0502f7..7837415e3 100644 --- a/docs/english/building-an-app.md +++ b/docs/english/building-an-app.md @@ -95,6 +95,7 @@ Create and move into a new directory before you initialize the project: $ mkdir first-bolt-app $ cd first-bolt-app $ npm init +$ npm pkg set type=module ``` You’ll be prompted with a series of questions to describe your new project (you can accept the defaults by hitting Enter on each prompt if you aren’t picky). After you’re done, you’ll have a new `package.json` file in your directory. @@ -211,7 +212,7 @@ $ export SLACK_APP_TOKEN=xapp- Create a new entrypoint file called `app.js` in your project directory and add the following code: ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your Slack app and bot token const app = new App({ @@ -248,7 +249,7 @@ $ export SLACK_SIGNING_SECRET= 2. Create a new entrypoint file called `app.js` in your project directory and add the following code: ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your bot token and signing secret const app = new App({ @@ -346,7 +347,7 @@ The following example listens and responds to all messages in channels/DMs where ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your Slack app and bot token const app = new App({ @@ -375,7 +376,7 @@ app.message("hello", async ({ message, say }) => { ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your bot token and signing secret const app = new App({ @@ -440,7 +441,7 @@ Below, the `app.js` file from the last section is modified to send a message con ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your Slack app and bot token const app = new App({ @@ -488,7 +489,7 @@ app.message("hello", async ({ message, say }) => { ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your bot token and signing secret const app = new App({ @@ -559,7 +560,7 @@ https://github.com/slack-samples/bolt-js-getting-started-app/blob/main/app.js ```javascript title="app.js" -const { App } = require("@slack/bolt"); +import { App } from "@slack/bolt"; // Initializes your app with your bot token and signing secret const app = new App({ diff --git a/docs/japanese/getting-started.md b/docs/japanese/building-an-app.md similarity index 99% rename from docs/japanese/getting-started.md rename to docs/japanese/building-an-app.md index ef095d977..73158899c 100644 --- a/docs/japanese/getting-started.md +++ b/docs/japanese/building-an-app.md @@ -66,6 +66,7 @@ Slack アプリで使用できるトークンには、ユーザートークン mkdir first-bolt-app cd first-bolt-app npm init +npm pkg set type=module ``` 新しいプロジェクトを説明するための一連の質問が表示されます (特に問題がなければ、各プロンプトで Enter を押すと、デフォルトを受け入れることができます)。完了すると、ディレクトリ内に新しい `package.json` ファイルが作成されます。 @@ -99,7 +100,7 @@ npm install @slack/bolt このディレクトリ内に `app.js` という名前の新しいファイルを作成し、以下のコードを追加します。 ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; // ボットトークンと Signing Secret を使ってアプリを初期化します const app = new App({ @@ -224,7 +225,7 @@ const app = new App({ ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, @@ -254,7 +255,7 @@ app.message('hello', async ({ message, say }) => { ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, @@ -321,7 +322,7 @@ app.message('hello', async ({ message, say }) => { ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, @@ -370,7 +371,7 @@ app.message('hello', async ({ message, say }) => { ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, @@ -431,7 +432,7 @@ app.message('hello', async ({ message, say }) => { ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, @@ -487,7 +488,7 @@ app.action('button_click', async ({ body, ack, say }) => { ```javascript -const { App } = require('@slack/bolt'); +import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN,