Git Product home page Git Product logo

py-sdk's Introduction

koreanbots

PyPI PyPI - Python Version GitHub PyPI - Downloads

A Simple Python API wrapper for KoreanBots.

문서

문서

설치

파이썬 3.6 혹은 그 이상이 필요합니다.

python3 -m pip install koreanbots

로거

koreanbots 는 파이썬의 logging 모듈을 사용하여 로깅합니다.

간단한 디버깅을 위해 INFO 이상의 로깅을 추천합니다.

logging 설정 예시

import logging

logger = logging.getLogger('koreanbots')
logger.setLevel(logging.INFO) # DEBUG INFO WARNING ERROR CRITICAL
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('[%(asctime)s] [%(filename)s] [%(name)s:%(module)s] [%(levelname)s]: %(message)s'))
logger.addHandler(handler)

예시

서버수 업데이트하기

주기적으로 봇의 수를 업데이트합니다. (discord.py)

import discord
import koreanbots

client = discord.Client()
Bot = koreanbots.Client(client, 'KoreanBots 토큰')

@client.event
async def on_ready():
    print(f'{client.user}로 로그인하였습니다.')

client.run('Discord 토큰')

아이디로 봇 정보 가져오기

discord.py 사용시

import discord
import koreanbots

client = discord.Client()
Bot = koreanbots.Client(client, 'KoreanBots 토큰')

@client.event
async def on_ready():
    print(f'{client.user}로 로그인하였습니다.')

    Data = await Bot.getBot('653534001742741552')
    # 반환되는 데이터는 옆 링크를 참고해주세요: https://koreanbots.dev/js-sdk/interfaces/_types_.getbyid.html

    print(Data)

client.run('Discord 토큰')

discord.py 미사용시

import koreanbots
import asyncio

loop = asyncio.get_event_loop()

Bot = koreanbots.HTTPClient('KoreanBots 토큰')
# getBot은 토큰이 필요하지 않기에 'KoreanBots 토큰' 부분은 생략 가능합니다.

Data = loop.run_until_complete(Bot.getBot('653534001742741552'))
# 반환되는 데이터는 옆 링크를 참고해주세요: https://koreanbots.dev/js-sdk/interfaces/_types_.getbyid.html

print(Data)

py-sdk's People

Contributors

janu8ry avatar kijk2869 avatar return0927 avatar saidbysolo avatar

Stargazers

 avatar

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.