A guide on how to get started with cloudflare workers and yor.ts
Creating Discord Application
Inviting Bot to Server
Creating a new project
npm init
/yarn init
/pnpm init
to initialize a package.jsonnpm install yor.ts@latest
/yarn add yor.ts@latest
/pnpm install yor.ts@latest
to install yor.tsDownloading cloudflare workers cli
npm install -g wrangler
/yarn global add wrangler
/pnpm add -g wrangler
to install the cli
wrangler login
to login to your cloudflare account
wrangler init
to create a new project
wrangler.toml
:
Creating src/index.ts
src/index.ts
:Esbuild and polyfill
npm install --save-dev esbuild esbuild-plugin-node-polyfill
or yarn add --dev esbuild esbuild-plugin-node-polyfill
or pnpm add --save-dev esbuild esbuild-plugin-node-polyfill
to install these packages as dev dependencies.
Running the project
npm run build
or yarn build
or pnpm build
to build the projectwrangler deploy
to deploy your projectTesting the bot
Testing to see if it works
/ping