GithubHelp home page GithubHelp logo

koreanbots / js-sdk Goto Github PK

View Code? Open in Web Editor NEW
23.0 1.0 6.0 1.51 MB

Official JS SDK for Koreanbots

Home Page: https://js-sdk-docs.pages.dev

License: MIT License

JavaScript 8.68% TypeScript 91.32%
koreanbots sdk typescript javascript

js-sdk's Introduction

Koreanbots.js

Version Documentation Maintenance License: MIT Downloads eslint.yml codecov-badge

TypeScript/JavaScript SDK for KOREANBOTS

μ„€μΉ˜

# NPM
$ npm install koreanbots
# Yarn
$ yarn add koreanbots

μ‚¬μš© 쑰건

3.1 버전 이상은 Node.js v16.6.0 이상이 ν•„μš”ν•©λ‹ˆλ‹€. κ·Έ μ΄ν•˜ 버전은 Node.js v12λΆ€ν„° μ§€μ›λ©λ‹ˆλ‹€.

discord.js version supported planned to support
v11.x no no
v12.x yes -
v13.x (stable) yes -

μ‚¬μš©λ²•

  • μžλ™ μ—…λ°μ΄νŠΈ
const { KoreanbotsClient } = require("koreanbots")
const client = new KoreanbotsClient({
    intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"],
    koreanbots: {
        api: {
            token: "KOREANBOTS 토큰"
        }
    },
    koreanbotsClient: {
        updateInterval: 600000 //10λΆ„λ§ˆλ‹€ μ„œλ²„ 수λ₯Ό μ—…λ°μ΄νŠΈν•©λ‹ˆλ‹€. (κΈ°λ³Έκ°’ 30λΆ„)
    }
})

client.on("ready", () => console.log(`${client.user.tag}둜 λ‘œκ·ΈμΈν•˜μ˜€μŠ΅λ‹ˆλ‹€.`))

client.login("토큰")

process.on("SIGINT", () => {
    client.destroy()
    process.exit()
})
  • μˆ˜λ™ μ—…λ°μ΄νŠΈ
const { Koreanbots } = require("koreanbots")
const Discord = require("discord.js")
const client = new Discord.Client()
const koreanbots = new Koreanbots({
    api: {
        token: "KOREANBOTS 토큰"
    },
    clientID: "봇 아이디"
})

let update = servers => koreanbots.mybot.update({ servers, shards: client.shard?.count }) 
    .then(res => console.log("μ„œλ²„ 수λ₯Ό μ •μƒμ μœΌλ‘œ μ—…λ°μ΄νŠΈν•˜μ˜€μŠ΅λ‹ˆλ‹€!\nλ°˜ν™˜λœ 정보:" + JSON.stringify(res)))
    .catch(console.error)

client.on("ready", () => {
    console.log(`${client.user.tag}둜 λ‘œκ·ΈμΈν•˜μ˜€μŠ΅λ‹ˆλ‹€.`)

    update(client.guilds.cache.size) // μ€€λΉ„ μƒνƒœλ₯Ό μ‹œμž‘ν•  λ•Œ, 졜초둜 μ—…λ°μ΄νŠΈν•©λ‹ˆλ‹€.
    setInterval(() => update(client.guilds.cache.size), 600000) // 10λΆ„λ§ˆλ‹€ μ„œλ²„ 수λ₯Ό μ—…λ°μ΄νŠΈν•©λ‹ˆλ‹€.
})

client.login("토큰")

Author

πŸ‘€ zero734kr

🀝 도움주기

μ΄μŠˆμ™€ PR은 λͺ¨λ‘ ν™˜μ˜μž…λ‹ˆλ‹€!
무언가 λ¬Έμ œκ°€ 생겼닀면 이슈 νŽ˜μ΄μ§€μ— 이슈λ₯Ό μ—΄μ–΄μ£Όμ„Έμš”.
μ½”λ“œ μˆ˜μ • μš”μ²­μ€ PR νŽ˜μ΄μ§€μ— μ˜¬λ €μ£Όμ„Έμš”.

μ„œν¬νŠΈ

λ§Œμ•½ 이 λͺ¨λ“ˆμ΄ 도움이 λ˜μ—ˆλ‹€λ©΄ ⭐️λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš”!

πŸ“ λΌμ΄μ„ΌμŠ€

Copyright Β© 2020-2021 koreanbots.
This project is MIT licensed.


This README was generated with ❀️ by readme-md-generator

js-sdk's People

Contributors

dependabot[bot] avatar kijk2869 avatar mome0320 avatar wonderlandpark avatar yoruroong avatar zero734kr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

js-sdk's Issues

sdk κ΄€λ ¨ 문제

image

λ‹€μŒκ³Ό 같은 였λ₯˜κ°€ λœΉλ‹ˆλ‹€. νŒ¨ν‚€μ§€μ—μ„œ μ—λŸ¬κ°€ λ‚˜λŠ”κ²ƒ κ°™μ•„μš”γ… γ… 

Discord.js v13 μ—…λ°μ΄νŠΈ ν•„μš”

v13 λ²„μ „μœΌλ‘œ μ—…λ°μ΄νŠΈ ν• μ‹œ κΈ°μ‘΄ koreanbots 이 μž‘λ™μ΄ μ•ˆλ©λ‹ˆλ‹€. ν•΄κ²°ν•΄μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€.

Error: {"code": 400} - Bad Request

new (require("koreanbots").MyBot)(process.env.KOREANBOTS_TOKEN)
    .update(client.guilds.cache.size)
    .catch(e => console.error(e.toString()))

μ‹œλ„μ‹œ 항상 {"code": 400}λ₯Ό λ°˜ν™˜ν•¨.

  • 버그 적용 버전 λͺ©λ‘
  • v1.0.9
  • v1 μ΅œμ‹  버전 - ?
  • v2.0.0 - 였λ₯˜ 버전
  • 참고할것: 헀더, μΊμ‹œ, λ“±

sdk 였λ₯˜

였λ₯˜ λ©”μ‹œμ§€ -
/home/discord/project/bloodmoon/node_modules/koreanbots/src/KoreanbotsClient.js:12
this.options.koreanbotsOptions.interval = options.koreanbotsOptions.interval || 60000 * 30
^

TypeError: Cannot read property 'interval' of undefined
at new KoreanbotsClient (/home/discord/project/bloodmoon/node_modules/koreanbots/src/KoreanbotsClient.js:12:77)
at Object. (/home/discord/project/bloodmoon/bloodmoon.js:13:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47

μ½”λ“œ -
const { KoreanbotsClient } = require("koreanbots");
const client = new KoreanbotsClient({
intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS", "DIRECT_MESSAGES"],
koreanbots: {
api: {
token: "λΉ„λ°€"
}
},
koreanbotsClient: {
updateInterval: 600000
}
})

μ˜€νƒ€

Bot.js 114λ²ˆμ€„ 버젼 μ˜€νƒ€ μˆ˜μ • λΆ€νƒλ“œλ¦½λ‹ˆλ‹€

[버그] Cannot read property 'options' of undefined.

μž¬ν˜„λ°©λ²•

μ €ν•œν…Œλ§Œ λ°œμƒν•˜λŠ” 것인지 μž˜μ€ λͺ¨λ₯΄κ² μœΌλ‚˜, 봇을 μΌœλ†“κ³  λͺ‡μ‹œκ°„ μ§€μ†μ μœΌλ‘œ 기닀리닀 보면 μ—λŸ¬κ°€ λœΉλ‹ˆλ‹€.
[ λ‹¨μˆœνžˆ λͺ¨λ“ˆ μ—…λ°μ΄νŠΈλ₯Ό μ•ˆν•΄μ„œ μ—λŸ¬κ°€ λœ¨λŠ” 것이라 μƒκ°ν–ˆλŠ”λ° μ—…λ°μ΄νŠΈλ₯Ό 해도 λœΉλ‹ˆλ‹€. ]

μ˜ˆμƒλ˜λŠ” 정상적인 λ™μž‘

μ—λŸ¬κ°€ λœ¨μ§€ μ•Šκ³  ν”„λ‘œμ„ΈμŠ€κ°€ κ·ΈλŒ€λ‘œ μœ μ§€λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€.

λ°œμƒν•œ 문제

Cannot read property 'options' of undefined. μ—λŸ¬κ°€ 뜨고 ν”„λ‘œμ„ΈμŠ€κ°€ μž¬μ‹œμž‘λ©λ‹ˆλ‹€.

image

ν΄λΌμ΄μ–ΈνŠΈ 버전

Node.js = 14.7.0 / Npm = 6.14.7 / Koreanbots = 2.0.4

사양

Windows 10 1903 [Build 18362.959]

확인

  • μ€‘λ³΅λ˜λŠ” μ΄μŠˆλŠ” μ—†λ‚˜μš”?
  • ν•΄λ‹Ή 버그λ₯Ό λ‹€μ‹œ λ°œμƒμ‹œν‚¬ 수 μžˆλ‚˜μš”?

Import using paths

Use typescript config paths.

"paths" : {
  "@util/*": ["src/util/*"]
}

Like this

Bug: Memory Leak vulnerability

koreanbots의 μžλ°”μŠ€ν¬λ¦½νŠΈ λΌμ΄λΈŒλŸ¬λ¦¬μ—μ„œ memory leak 곡격이 κ°€λŠ₯ν•œ μ‹¬κ°ν•œ 버그λ₯Ό μ°Ύμ•˜μŠ΅λ‹ˆλ‹€. μΊμ‹œ μ‹œμŠ€ν…œμ„ κ°œλ°œν• λ•Œ 이λ₯Ό κ³ λ €ν•˜μ§€ λͺ»ν•œ 제 잘λͺ»μ΄λ©° μ§€κΈˆ ν•΄λ‹Ή μˆ˜μ •λ³Έμ„ 개발 μ€‘μž…λ‹ˆλ‹€.

제 프라이빗 ν”„λ‘œμ νŠΈ 개발 쀑에 μ‚¬μš© 쀑인 νž™ λ©”λͺ¨λ¦¬κ°€ 1.5GB에 μœ‘λ°•ν•˜λŠ”κ²ƒμ„ 보고 λ©”λͺ¨λ¦¬ λˆ„μˆ˜λœ 곳을 μ°Ύλ‹€κ°€ 발견 λ˜μ—ˆμœΌλ©° 라이브러리 λ‚΄λΆ€ ꡬ쑰λ₯Ό 잘 μ‚΄νŽ΄λ³΄μ‹œλ©΄ μ–΄λ–€ 뢀뢄이 memory leakλ₯Ό μΌμœΌν‚€λŠ”μ§€ μ•Œμ•„λ‚΄μ‹€μˆ˜ μžˆμ„κ²λ‹ˆλ‹€. (λ³΄μ•ˆ μƒμ˜ 이유 λ•Œλ¬Έμ— μ—¬κΈ°μ„œ λ°νžˆμ§„ μ•Šκ² μŠ΅λ‹ˆλ‹€)

ν•΄λ‹Ή 라이브러리의 개발자인 제 λͺ…λ°±ν•œ 잘λͺ»μ΄λ©°, μ˜€ν•΄ μ—†μœΌμ‹œκΈΈ λ°”λžλ‹ˆλ‹€.

μ£„μ†‘ν•©λ‹ˆλ‹€.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.