No description
This repository has been archived on 2026-04-12. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • JavaScript 100%
Find a file
2020-09-13 16:11:12 +09:00
src update index.js/readme 2020-07-01 22:06:03 +09:00
.env.example Initialize 2020-07-01 21:29:17 +09:00
.gitignore Initial commit 2020-07-01 18:59:35 +09:00
LICENSE Initial commit 2020-07-01 18:59:35 +09:00
package.json update package.json 2020-07-01 21:42:41 +09:00
README.md update document 2020-07-01 22:33:10 +09:00
yarn.lock Bump node-fetch from 2.6.0 to 2.6.1 2020-09-13 01:49:58 +00:00

discord.js 템플릿

자바스크립트를 사용해서 봇을 만들 수 있는 템플릿입니다.

제스퍼님의 강좌를 참고하여 제작했습니다.

사용 방법

먼저 깃허브에서 Use this template 버튼을 눌러 템플릿으로 프로젝트를 생성해주세요.

git clone <생성한 레포 주소>
cd <레포이름>
npm install
.env.example 파일을 .env로 변경해주세요.
개발 - npm run dev/yarn dev
프로덕션 - npm start/yarn start

dotenv 설정 방법

BOT_TOKEN=디스코드 봇 토큰 입력

명령어 제작 장법

commands 폴더에 아무이름.commands.js를 만들어주세요.

//명령어.commands.js

async function ping(client, message, args, locale, prefix) {
    //코드
}

명령어 파라미터 설명

client - 디스코드 봇 클라이언트 입니다.
message - 명령어를 실행할 때 사용한 메시지 입니다
args - 명령어를 제외한 텍스트를 스페이스 단위로 자른 배열입니다.
locale - locale 폴더의 kr.js 파일을 사용할 수 있습니다.

언어 변경 방법(예시)

//src/index.js 7번줄
const lang = "kr" /* 이걸 바꿔주세요. */
//src/locale/<언어>.js
module.exports = {
    example: "Example"
}
//src/locale/index.js
module.exports = {
    언어코드: require('./<언어>.js')
}