DSC.GG API를위한 간단하고 사용하기 쉬운 완전 비동기 래퍼.
pip install dsc.py
아래에서는이 라이브러리의 모든 방법 및 클라이언트 초기화의 예제 사용을 찾을 수 있습니다.
라이브러리에서 반환 한 개체에 대한 참조를 위해, 이것을 확인하십시오.
import dsc
client = dsc . Client ( key = 'YOUR_API_KEY' ) user = await client . get_user ( USER_ID )
print ( f"This user joined dsc.gg on { user . created_at } " ) link = await client . get_link ( 'link' ) # Can be either a slug or a full URL
print ( f"This link owner's ID is: { link . owner_id } , and it leads to { link . redirect } " ) app = await client . get_app ( APP_ID )
print ( f"This app's owner's ID is { app . owner_id } and it was created at { app . created_at } " ) links = await client . get_top_links ()
print ( links [ 1 ]. id ) links = await client . get_user_links ( USER_ID )
print ( links [ 0 ]. redirect ) apps = await client . get_user_apps ( USER_ID )
print ( any ([ app . verified for app in apps ])) # check if the user has any verified apps links = await client . search ( 'search_query' , limit = 50 ) # optional limit
print ( len ( links ))이것으로 공상을 얻고 링크와 함께 사용할 준비를 할 수 있습니다. 아래를 참조하십시오. 링크를 업데이트 할 때만 색상이 작동하지 않습니다.
embed = dsc . Embed (
color = dsc . Color . red (),
title = 'Embed title' ,
image = 'image url' ,
description = 'Embed description'
)슬러그와 리디렉션 이외의 다른 것은 선택 사항입니다! 건설자.
res = await client . create_link ( 'link slug' , 'redirect' , embed = embed )
if res . status == 200 :
print ( 'Link created!' )
else :
print ( 'An error occurred.' ) 링크 슬러그가 기존 링크 여야한다는 점을 제외하고 작성과 유사하게 type 전달할 필요가 없습니다.
일부 인수를 포함시키지 않으면 이러한 필드 만 업데이트하고 다른 필드를 그대로 남겨 둘 것입니다.
updated_embed = dsc . Embed ( color = dsc . Color . red ())
await client . update_link ( 'link slug' , password = 'youshallnotpass' , unlisted = True , embed = updated_embed ) await client . delete_link ( 'link slug' )dsc.py에는 4 개의 객체 - 사용자, 링크, 임베드 및 색상이 포함되어 있습니다. 객체의 모든 속성은 나열되며 DateTime 값은 UTC에 있습니다.
intintbooldatetimeOptional[str] (앱을 소유 한 경우에만 참석) to_dict() - 사전 형태로 개체를 반환합니다. intboolbooldatetimebool to_dict() - 사전 형태로 개체를 반환합니다. strstrintdsc.Embed (아래 개체 참조)List[int]datetimestr ( 'bot', 'server', 'template'또는 'link')strbooldatetimestr to_dict() - 사전 형태로 개체를 반환합니다. 응답 또는 사용자가 생성 된 사용자로 반환 된 Embeds는 링크를 돋보이게하는 방법입니다.
dsc.Color (아래 개체 참조)strstrstr (image url) to_dict() - 사전 형태로 개체를 반환합니다. from_dict(data: dict) - 사전의 값으로 초기화 된 임베드 객체를 반환합니다. 이것은 Discord.py의 색상과 매우 유사하지만 줄을 통과 할 수 있습니다.
모든 discord.py 내장 컬러 클래스 방법도 여기에 있습니다. dsc.Color.red()
int to_dict() - 사전 형태로 개체를 반환합니다. 이 패키지는 OpenSource이므로 적절한 Python 경험이있는 사람은이 프로젝트에 기여할 수 있습니다!
패키지에 오류/버그/실수가 있거나 코드에있는 경우 문제를 만들어 여기에서보고하십시오.
이 패키지에 기여하려면 저장소를 포크하고 변경 한 다음 단순히 풀 요청을 작성하십시오!
저에게 연락하려면 :
메일 [email protected]
불화 wulf#9632