2.1.1 • Published 4 years ago
@pikostudio/command.ts v2.1.1
COMMAND.TS
타입스크립트로 작성된 discord.js 커맨드 프레임워크입니다.
설치
npm i discord.js reflect-metadata @pikostudio/command.ts
설정
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true
}
index.ts
import 'reflect-metadata'
import { CommandClient } from '@pikostudio/command.ts'
const client = new CommandClient({
currentDir: __dirname,
commandHandler: {
prefix: '!',
},
watch: true,
// auto로 설정시 자동으로 애플리케이션에서 가져옵니다.
owners: 'auto',
})
client.loadExtensions('extensions/test')
client.login('token')
extensions/test.ts
import { Arg, Command, Extension, Listener, Msg } from '@pikostudio/command.ts'
import { Message } from 'discord.js'
export default class Test extends Extension {
@Command()
say(
@Msg() msg: Message, // 메시지 받기
@Arg({ required: true, rest: true }) content: string, // 인자 받기
// + 인자는 순서대로 받습니다. rest를 사용하려면 꼭 마지막 인자로 사용해주세요
) {
return msg.reply(content)
}
// 로드 이벤트
load() {}
// 언로드 이벤트
unload() {}
// 명령어 사용시 실행됩니다. 반환된 값이 false일시 명령어 사용을 중지합니다.
/*async*/ permit(/* message */) {
return true
}
@Listener('ready') // 리스너
async ready() {
console.log('bot ready!')
}
}
2.1.1
4 years ago
2.0.2-0.0
4 years ago
2.0.21
4 years ago
2.0.20
4 years ago
2.0.19
4 years ago
2.0.18
4 years ago
2.0.17
4 years ago
2.0.15
4 years ago
2.0.16
4 years ago
2.0.14
4 years ago
2.0.13
4 years ago
2.0.11
4 years ago
2.0.12
4 years ago
2.0.9
4 years ago
2.1.0
4 years ago
2.0.7
4 years ago
2.0.8
4 years ago
2.0.5
4 years ago
2.0.4
4 years ago
2.0.6
4 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago