Skip to main content

DBSkr

DBSkr

CodeFactor DBSkr PyPi Downloading PyPi Version PyPi Version

한국 디스코드봇을 모아두는 사이트(들)을 위하여 제작된 비공식 파이썬 레퍼(Python3 Wapper) 입니다.

<지원하는 웹사이트 목록>
아래의 사이트를 해당 모듈을 통하여 한 번에 관리&사용 하실 수 있습니다.

설치 (Installation)

파이썬 3.7 혹은 그 이상의 버전이 필요합니다. Install via pip (recommended)

# Linux/macOS
python -3 -m pip install DBSkr

# Windows
py -3 -m pip install DBSkr

Install from source

# Linux/macOS
python -3 -m pip install git+https://github.com/gunyu1019/DBSkr

# Windows
py -3 -m pip install git+https://github.com/gunyu1019/DBSkr

로깅 (Logging)

DBSkr은 파이썬의 logging 모듈을 사용하여, 오류 및 디버그 정보를 기록합니다. 로깅 모듈이 설정되지 않은 경우 오류 또는 경고가 출력되지 않으므로 로깅 모듈을 구성하는 것이 좋습니다.

로깅 모듈의 레벨은 DEBUG, INFO, WARNING, ERROR, CRITICAL가 있으며 INFO로 설정하는 것을 추천합니다.

import logging

logger = logging.getLogger('DBSkr')
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('[%(asctime)s] [%(filename)s] [%(name)s:%(module)s] [%(levelname)s]: %(message)s'))
logger.addHandler(handler)

예시(Example)

자동으로 서버 수 업데이트하기

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

import discord
import DBSkr

client = discord.Client()
Bot = DBSkr.Client(
    bot=client,
    koreanbots_token='Korean Bots 봇 토큰',
    topgg_token='top.gg 봇 토큰',
    uniquebots_token='Unique Bots 봇 토큰',
    autopost=True
)

@client.event
async def on_ready():
    print("디스코드 봇 로그인이 완료되었습니다.")
    print("디스코드봇 이름:" + client.user.name)
    print("디스코드봇 ID:" + str(client.user.id))
    print("디스코드봇 버전:" + str(discord.__version__))
    print('------')

client.run('Discord 토큰')

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

import discord
import DBSkr
from discord.ext import commands

client = commands.Bot(command_prefix="!!")
Bot = DBSkr.Client(
    bot=client,
    koreanbots_token='Korean Bots 봇 토큰',
    topgg_token='top.gg 봇 토큰',
    uniquebots_token='Unique Bots 봇 토큰',
    autopost=True
)

@client.event
async def on_ready():
    print("디스코드 봇 로그인이 완료되었습니다.")
    print("디스코드봇 이름:" + client.user.name)
    print("디스코드봇 ID:" + str(client.user.id))
    print("디스코드봇 버전:" + str(discord.__version__))
    print('------')

client.run('Discord 토큰')

직접 서버 수 업데이트하기

사용자가 직접 서버 수를 업데이트 할 수 있습니다.

import discord
import DBSkr

client = discord.Client()
Bot = DBSkr.Client(
    bot=client,
    koreanbots_token='Korean Bots 봇 토큰',
    topgg_token='top.gg 봇 토큰',
    uniquebots_token='Unique Bots 봇 토큰'
)

@client.event
async def on_ready():
    print("디스코드 봇 로그인이 완료되었습니다.")
    print("디스코드봇 이름:" + client.user.name)
    print("디스코드봇 ID:" + str(client.user.id))
    print("디스코드봇 버전:" + str(discord.__version__))
    print('------')

@client.event
async def on_message(message):
    if message.content == "서버수업데이트":
        await Bot.stats()

client.run('Discord 토큰')

유저 투표 유무 불러오기

특정 사용자가 12시간내에 투표 혹은 하트를 했는지 안했는지에 대한 값이 나옵니다.

import discord
import DBSkr

client = discord.Client()
Bot = DBSkr.Client(
    bot=client,
    koreanbots_token='Korean Bots 봇 토큰',
    topgg_token='top.gg 봇 토큰',
    uniquebots_token='Unique Bots 봇 토큰'
)

@client.event
async def on_ready():
    print("디스코드 봇 로그인이 완료되었습니다.")
    print("디스코드봇 이름:" + client.user.name)
    print("디스코드봇 ID:" + str(client.user.id))
    print("디스코드봇 버전:" + str(discord.__version__))
    print('------')

@client.event
async def on_message(message):
    author = message.author
    vote_data = await Bot.vote(author.id)
    print(f"{author}투표 유무: \nKoreanBots: {vote_data.koreanbots}\nTop.gg: {vote_data.topgg}\nUniqueBots: {vote_data.uniquebots}")
    # Bool 형태이므로, 두 값에는 True 혹은 False가 리턴됨. 그러나 토큰값이 없을 경우 None이 이런됨.

client.run('Discord 토큰')

봇의 아이디로 봇 정보 불러오기

import discord
import DBSkr

client = discord.Client()
Bot = DBSkr.Client(
    bot=client,
    koreanbots_token='Korean Bots 봇 토큰',
    topgg_token='top.gg 봇 토큰',
    uniquebots_token='Unique Bots 봇 토큰'
)

@client.event
async def on_ready():
    print("디스코드 봇 로그인이 완료되었습니다.")
    print("디스코드봇 이름:" + client.user.name)
    print("디스코드봇 ID:" + str(client.user.id))
    print("디스코드봇 버전:" + str(discord.__version__))
    print('------')

    data = await Bot.bot(680694763036737536)
    print(f"{data.koreanbots}\n{data.topgg}\n{data.uniquebots}")

client.run('Discord 토큰')

라이센스(License)

DBSkr의 라이센스는 MIT License를 부여합니다.

Metadata

Release files for DBSKR 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DBSKR 2.0
File Size Uploaded Provenance Actions
DBSKR-2.0.tar.gz 31.9 kB Without provenance Details for DBSKR-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for DBSKR 2.0
File Interpreter ABI Platform Actions
DBSKR-2.0-py3-none-any.whl Python 3 none any Details for DBSKR-2.0-py3-none-any.whl

Total release size: 93.8 kB

Release files / DBSKR-2.0.tar.gz

Download URL DBSKR-2.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7f0ccf9464a4493a853c6406c881a6488cfd1dcfe72179e2230ec1ce7cd73f84
BLAKE2b-256 checksum
How to use checksums
89fc1f1e47e33086d462d2e2e0780448d8f02d6ae49de93f8d6f12b81253df51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Release files / DBSKR-2.0-py3-none-any.whl

Download URL DBSKR-2.0-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee7e5fc4fd556bc2b1f2bd06e47a10ea26317623010fb0e6d9a3cc984c5ac375
BLAKE2b-256 checksum
How to use checksums
eda89a5169b098a21e8450ef047f99df5215b3fc0e1229980a8033f01466a48c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Security for DBSKR 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page