1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Discord jsの最小構成(メモ)

Last updated at Posted at 2022-12-23

最近またDiscord jsにハマり出したのでメモとしてコードを貼っておきます

discord jsをインストールするコマンド:

npm install discord.js

dotenvをインストールするコマンド:

npm install dotenv

bot本体

index.js
const { Client, GatewayIntentBits } = require("discord.js");
require('dotenv').config();

const GatewayIntents = [GatewayIntentBits.MessageContent];

const client = new Client({
    intents: GatewayIntents,
});

client.on("ready",(client)=>{
   console.log("Ready!"); 
});

client.login(process.env.TOKEN);

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?