use discord.js in TypeScript to create discord bot
git clone https://github.com/yubinTW/discord-typescript-demo.git
cd discord-typescript-demo
npm i
cp .env.sample .env
set your environment variable according to your app
npm run build
npm run start
or use npm run dev
for developing
Discord Developer Portal https://discord.com/developers/applications
- Create an application in developer portal
- Copy
CLIENT_ID
fromOAuth2
tab - Copy
Token
fromBot
tab - Copy
GUILD_ID
from your channel
- In developer portal
OAuth2
->URL Generator
- Check
bot
option in scopes section - Check the permissions your want to set for your bot
(
Send Messages
,Use Slash Commands
for example) - Copy the generated URL
- Visit the link you copied in step4
- Select the channel you want to add the bot
- Run the bot application and enjoy it