一个简单的pythonapi包装器。
koreanbots的Python项目详细描述
A Simple Python API wrapper for KoreanBots.
文档
安装“h2”
FiySun 3.6或者更多。
python3 -m pip install koreanbots
h2
koreanbots使用了PaySun的logging模块进行打底裤。
为了简单的调试,推荐{tt2}$以上的打底裤。{tt1}$设定示例
importlogginglogger=logging.getLogger('koreanbots')logger.setLevel(logging.INFO)# DEBUG INFO WARNING ERROR CRITICALhandler=logging.StreamHandler()handler.setFormatter(logging.Formatter('[%(asctime)s] [%(filename)s] [%(name)s:%(module)s] [%(levelname)s]: %(message)s'))logger.addHandler(handler)
《h2》示例
更新
服务器数
定期更新机器人数量。(discord.py)
importdiscordimportkoreanbotsclient=discord.Client()Bot=koreanbots.Client(client,'KoreanBots 토큰')@client.eventasyncdefon_ready():print(f'{client.user}로 로그인하였습니다.')client.run('Discord 토큰')
导入ID机器人信息
discord.py 使用时
importdiscordimportkoreanbotsclient=discord.Client()Bot=koreanbots.Client(client,'KoreanBots 토큰')@client.eventasyncdefon_ready():print(f'{client.user}로 로그인하였습니다.')Data=awaitBot.getBot('653534001742741552')# 반환되는 데이터는 옆 링크를 참고해주세요: https://koreanbots.dev/js-sdk/interfaces/_types_.getbyid.htmlprint(Data)client.run('Discord 토큰')
discord.py 未使用时
importkoreanbotsimportasyncioloop=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.htmlprint(Data)
- 项目
标签: