Skip to content

koreanbots/py-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

200 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koreanbots py-sdk

pypi pypi license downloads codecov

Official Python SDK for KOREANBOTS

문서

문서

예제

discord.py의 tasks를 이용해 서버 수를 1시간마다 자동으로 업데이트하는 예제입니다.

import discord
from discord.ext import commands, tasks

from koreanbots.client import Koreanbots

BOT_TOKEN = "your_discord_bot_token"
KOREANBOTS_API_KEY = "your_koreanbots_api_key"

bot = commands.Bot(command_prefix="!", intents=discord.Intents.default())
koreanbots = Koreanbots(KOREANBOTS_API_KEY)


@tasks.loop(hours=1)
async def update_server_count():
    await koreanbots.update_bot_info(
        bot_id=bot.user.id,
        servers=len(bot.guilds),
        shards=bot.shard_count or 0,
    )


@update_server_count.before_loop
async def before_update_server_count():
    await bot.wait_until_ready()


@bot.event
async def on_ready():
    update_server_count.start()
    print(f"Logged in as {bot.user}")


bot.run(BOT_TOKEN)

About

A Simple Python API wrapper for KoreanBots.

Resources

License

Stars

Watchers

Forks

Contributors

Languages