API 레퍼런스

버전 정보

koreanbots.version_info
sys.version_info와 비슷한 튜플입니다.
koreanbots.__version__
버전정보의 문자열입니다.

Client

class koreanbots.Koreanbots(api_key: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None)[source]

KoreanbotsRequester를 감싸는 클라이언트 클래스입니다.

Parameters:
  • client (Optional[DpyABC]) – discord.Client의 클래스입니다. 만약 필요한 경우 이 인수를 지정하세요.
  • api_key (Optional[str]) – API key를 지정합니다. 만약 필요한 경우 이 키를 지정하세요.
  • session (Optional[aiohttp.ClientSession]) – aiohttp.ClientSession의 클래스입니다. 만약 필요한 경우 이 인수를 지정하세요. 지정하지 않으면 생성합니다.
  • run_task (bool) – 봇 정보를 갱신하는 작업을 자동으로 실행합니다. 만약 아니라면 지정하지 않습니다.
  • include_shard_count (bool) – 샤드 개수를 포함할지 지정합니다. 만약 아니라면 지정하지 않습니다.
botinfo(bot_id: int) → koreanbots.model.KoreanbotsBot[source]

봇 정보를 가져옵니다.

Parameters:bot_id (int) – 요청할 봇의 ID를 지정합니다.
Returns:봇 정보를 담고 있는 KoreanbotsBot클래스입니다.
Return type:KoreanbotsBot
guildcount(bot_id: int, **kwargs) → None[source]

길드 개수를 서버에 전송합니다.

Parameters:bot_id (int) – 요청할 bot의 ID를 지정합니다.
is_voted_bot(user_id: int, bot_id: int) → koreanbots.model.KoreanbotsVote[source]

주어진 bot_id로 user_id를 통해 해당 user의 투표 여부를 반환합니다.

Parameters:
  • user_id (int) – 요청할 user의 ID를 지정합니다.
  • bot_id (int) – 요청할 봇의 ID를 지정합니다.
Returns:

투표여부를 담고 있는 KoreanbotsVote클래스입니다.

Return type:

KoreanbotsVote

is_voted_server(user_id: int, server_id: int) → koreanbots.model.KoreanbotsVote[source]

주어진 server_id user_id를 통해 해당 user의 투표 여부를 반환합니다.

Parameters:
  • user_id (int) – 요청할 user의 ID를 지정합니다.
  • server_id (int) – 요청할 서버의 ID를 지정합니다.
Returns:

투표여부를 담고 있는 KoreanbotsVote클래스입니다.

Return type:

KoreanbotsVote

serverinfo(server_id: int) → koreanbots.model.KoreanbotsServer[source]

서버 정보를 가져옵니다.

Parameters:server_id (int) – 요청할 서버의 ID를 지정합니다.
Returns:봇 정보를 담고 있는 KoreanbotsServer클래스입니다.
Return type:KoreanbotsServer
userinfo(user_id: int) → koreanbots.model.KoreanbotsUser[source]

유저 정보를 가져옵니다.

Parameters:user_id (int) – 요청할 유저의 ID를 지정합니다.
Returns:유저 정보를 담고 있는 KoreanbotsUser클래스입니다.
Return type:KoreanbotsUser
widget(widget_type: Literal[votes, servers, status], bot_id: int, style: Literal[classic, flat] = 'flat', scale: float = 1.0, icon: bool = False) → str[source]

주어진 bot_id로 widget의 url을 반환합니다.

Parameters:
  • widget_type (WidgetType) – 요청할 widget의 타입을 지정합니다.
  • bot_id (int) – 요청할 bot의 ID를 지정합니다.
  • style (WidgetStyle, optional) – 요청할 widget의 형식을 지정합니다. 기본값은 flat로 설정되어 있습니다.
  • scale (float, optional) – 요청할 widget의 크기를 지정합니다. 반드시 0.5이상이어야 합니다. 기본값은 1.0입니다.
  • icon (bool, optional) – 요청할 widget의 아이콘을 표시할지를 지정합니다. 기본값은 False입니다.
Returns:

위젯 url을 반환합니다.

Return type:

str

Integrations

class koreanbots.integrations.discord.DiscordpyKoreanbots(client: Union[DiscordpyClient, nextcord.Client, DisnakeClient], api_key: str, session: Optional[aiohttp.client.ClientSession] = None, run_task: bool = False, include_shard_count: bool = False)[source]
tasks_send_guildcount() → None[source]

길드 개수를 서버에 전송하는 태스크 입니다.

Raises:RuntimeError – 클라이언트를 찾을 수 없습니다.
class koreanbots.integrations.dico.DicoKoreanbots(client: Client, api_key: str, session: Optional[aiohttp.client.ClientSession] = None, run_task: bool = False, include_shard_count: bool = False)[source]

KoreanbotsRequester를 감싸는 클라이언트 클래스입니다. dico 전용입니다.

Parameters:
  • client (dico.Client) – dico.Client의 클래스입니다.
  • api_key (str) – API key를 지정합니다.
  • session (Optional[aiohttp.ClientSession]) – aiohttp.ClientSession의 클래스입니다. 만약 필요한 경우 이 인수를 지정하세요. 지정하지 않으면 생성합니다.
  • run_task (bool) – 봇 정보를 갱신하는 작업을 자동으로 실행합니다. 만약 아니라면 지정하지 않습니다.
  • include_shard_count (bool) – 샤드 개수를 포함할지 지정합니다. 만약 아니라면 지정하지 않습니다.
tasks_send_guildcount() → None[source]

길드 개수를 서버에 전송하는 태스크 입니다.

Raises:RuntimeError – 클라이언트를 찾을 수 없습니다.

HTTP

class koreanbots.KoreanbotsRequester(api_key: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None)[source]

Koreanbots의 API를 요청하는 클래스입니다.

Parameters:
  • api_key (Optional[str], optional) – KoreanBots의 토큰입니다. 기본값은 None 입니다.
  • session (Optional[aiohttp.ClientSession], optional) – aiohttp.ClientSession의 클래스입니다. 전달되지 않으면 생성합니다. 기본값은 None 입니다.
get_bot_info(bot_id: int) → Any[source]

주어진 bot_id로 bot의 정보를 반환합니다.

Parameters:bot_id (int) – 요청할 bot의 ID를 지정합니다.
Returns:요청 결과를 반환합니다.
Return type:Dict[str, Any]
get_bot_vote(user_id: int, bot_id: int) → Any[source]

주어진 bot_id로 user_id를 통해 해당 user의 투표 여부를 반환합니다.

Parameters:
  • user_id (int) – 요청할 user의 ID를 지정합니다.
  • bot_id (int) – 요청할 bot의 ID를 지정합니다.
get_bot_widget_url(widget_type: Literal[votes, servers, status], bot_id: int, style: Literal[classic, flat] = 'flat', scale: float = 1.0, icon: bool = False) → str[source]

주어진 bot_id로 widget의 url을 반환합니다.

Parameters:
  • widget_type (WidgetType) – 요청할 widget의 타입을 지정합니다.
  • bot_id (int) – 요청할 bot의 ID를 지정합니다.
  • style (WidgetStyle, optional) – 요청할 widget의 형식을 지정합니다. 기본값은 flat로 설정되어 있습니다.
  • scale (float, optional) – 요청할 widget의 크기를 지정합니다. 반드시 0.5이상이어야 합니다. 기본값은 1.0입니다.
  • icon (bool, optional) – 요청할 widget의 아이콘을 표시할지를 지정합니다. 기본값은 False입니다.
Returns:

위젯 url을 반환합니다.

Return type:

str

get_server_info(server_id: int) → Any[source]

주어진 server_id로 server의 정보를 반환합니다.

Parameters:server_id (int) – 요청할 server의 ID를 지정합니다.
get_server_vote(user_id: int, server_id: int) → Any[source]

주어진 server_id로 user_id를 통해 해당 user의 투표 여부를 반환합니다.

Parameters:
  • user_id (int) – 요청할 user의 ID를 지정합니다.
  • server_id로 – 요청할 server의 ID를 지정합니다.
get_user_info(user_id: int) → Any[source]

주어진 user_id로 user의 정보를 반환합니다.

Parameters:user_id (int) – 요청할 user의 ID를 지정합니다.
post_update_bot_info(bot_id: int, **kwargs) → Any[source]

주어진 bot_id로 bot의 정보를 갱신합니다.

Parameters:
  • bot_id (int) – 요청할 bot의 ID를 지정합니다.
  • kwargs (int) – 갱신할 정보를 지정합니다. ‘servers’ 인자와 ‘shards’ 인자 이외의 값이 들어갈경우 무시합니다.
Raises:

AuthorizeError – api_key가 없거나 유효하지 않은 경우。

Returns:

요청 결과를 반환합니다.

Return type:

Dict[str, Any]

request(method: Literal[GET, POST], endpoint: str, **kwargs) → Any[source]

Koreanbots의 url을 기반으로 요청합니다. 레이트리밋을 핸들합니다.

Parameters:
  • method (Literal["GET", "POST"]) – HTTP 메소드입니다. GET, POST만 사용할 수 있습니다.
  • endpoint (str) – 요청을 실행할 API 페이지의 주소입니다.
Raises:
  • NotFound – 요청할 수 없는 페이지입니다.
  • BadRequest – 잘못된 요청입니다.
  • Forbidden – 요청을 할 권한이 없습니다.
  • HTTPException – 응답에 오류가 있습니다.
Returns:

요청 결과를 반환합니다.

Return type:

Dict[str, Any]

Model

class koreanbots.KoreanbotsBot(code: int, version: int, data: Dict[str, Any], id: Optional[str] = None, name: Optional[str] = None, tag: Optional[str] = None, avatar: Optional[str] = None, flags: int = 0, lib: Optional[str] = None, prefix: Optional[str] = None, votes: int = 0, servers: int = 0, shards: int = 0, intro: Optional[str] = None, desc: Optional[str] = None, web: Optional[str] = None, git: Optional[str] = None, url: Optional[str] = None, discord: Optional[str] = None, category: Optional[Literal[관리, 뮤직, 전적, 게임, 도박, 로깅, 빗금 명령어, 웹 대시보드, 밈, 레벨링, 유틸리티, 대화, NSFW, 검색, 학교, 코로나19, 번역, 오버워치, 리그 오브 레전드, 배틀그라운드, 마인크래프트]] = None, vanity: Optional[str] = None, bg: Optional[str] = None, banner: Optional[str] = None, status: Optional[Literal[online, idle, dnd, streaming, offline]] = None, state: Optional[Literal[ok, reported, blocked, private, archived]] = None, _owners: List[Union[List[str], Dict[str, Any]]] = <factory>, init_in_user: bool = False)[source]

봇의 정보를 가져왔을떄 반환되는 인스턴스입니다.

avatar = None

아바타

banner = None

배너 이미지 주소

bg = None

배경 이미지 주소

category = None

카테고리

desc = None

설명 문구

discord = None

디스코드 주소

flags = 0

플래그

git = None

깃 주소

id = None

아이디

init_in_user = False

.owners 에서 소유자들의 ID를 반환하는지의 여부

intro = None

소개 문구

lib = None

라이브러리

name = None

이름

owners

소유자를 반환합니다. ※ init_in_user가 True인경우 소유자들의 ID를 반환합니다. :return:

소유자들의 ID들을 담고 있는 리스트 또는 KoreanbotsUser 인스턴스를 담고있는 리스트
Return type:Union[List[str], List[KoreanbotsUser]]
prefix = None

프리픽스

servers = 0

서버 수

shards = 0

샤드 수

state = None

Koreanbots에서의 상태

status = None

상태

tag = None

태그

url = None

주소

vanity = None

가상 주소

votes = 0

투표 수

web = None

웹사이트 주소

class koreanbots.KoreanbotsUser(code: int, version: int, data: Dict[str, Any], id: int = 0, username: str = '', tag: str = '', github: Optional[str] = None, flags: int = 0, servers: List[KoreanbotsServer] = <factory>, _bots: List[Union[List[str], Dict[str, Any]]] = <factory>, init_in_bot: bool = False)[source]

유저 정보를 가져왔을때 반환되는 클래스입니다.

bots

봇들을 반환합니다. ※ init_in_bot가 True인경우 봇들의 ID를 반환합니다. :return:

봇들의 ID들을 담고 있는 리스트 또는 KoreanbotsUser 인스턴스를 담고있는 리스트
Return type:Union[List[str], List[KoreanbotsUser]]
flags = 0

플래그

github = None

Github 주소

id = 0

아이디

init_in_bot = False

.bots 에서 봇들의 ID를 반환하는지의 여부

servers = None

유저가 참가중인 서버

tag = ''

태그

username = ''

유저 이름

예외

exception koreanbots.KoreanbotsException[source]
exception koreanbots.AuthorizeError[source]
exception koreanbots.HTTPException(code: Any, message: Union[Any, Dict[str, Any]])[source]
exception koreanbots.BadRequest(code: Any, message: Union[Any, Dict[str, Any]])[source]
exception koreanbots.Forbidden(code: Any, message: Union[Any, Dict[str, Any]])[source]
exception koreanbots.NotFound(code: Any, message: Union[Any, Dict[str, Any]])[source]