Package: dsc.py
dsc.pyA simple and easy to use, fully asynchronous wrapper for the dsc.gg API.Installationpip install dsc.pyUsageBelow you can find example usage of all of this library's methods and client initialization.For reference regarding objects returned by the library,check this outInitialize the clientimportdscclient=dsc.Client(key='YOUR_API_KEY')Get a useruser=awaitclient.get_user(USER_ID)print(f"This user joined dsc.gg on{user.created_at}")Get a linklink=awaitclient.get_link('link')# Can be either a slug or a full URLprint(f"This link owner's ID is:{link.owner_id}, and it leads to{link.redirect}")Get an appapp=awaitclient.get_app(APP_ID)print(f"This app's owner's ID is{app.owner_id}and it was created at{app.created_at}")Get top linkslinks=awaitclient.get_top_links()print(links[1].id)Get a user's links (whitelist only)links=awaitclient.get_user_links(USER_ID)print(links[0].redirect)Get a user's apps (whitelist only)apps=awaitclient.get_user_apps(USER_ID)print(any([app.verifiedforappinapps]))# check if the user has any verified appsSearch (whitelist only)links=awaitclient.search('search_query',limit=50)# optional limitprint(len(links))Create a linkYou can get fancy with this one, and create an embed to use with the link, see below. Please note that the color will
not work, when creating, only when updating a link.Create an embedembed=dsc.Embed(color=dsc.Color.red(),title='Embed title',image='image url',description='Embed description')Anything other than the slug and the redirect is optional!
constructor.res=awaitclient.create_link('link slug','redirect',embed=embed)ifres.status==200:print('Link created!')else:print('An error occurred.')Update a linkSimilar to creating, except the link slug has to be an existing link, there's no need to passtypein.Not passing some arguments into the embed will result in updating only these fields and leaving other ones as they are.updated_embed=dsc.Embed(color=dsc.Color.red())awaitclient.update_link('link slug',password='youshallnotpass',unlisted=True,embed=updated_embed)Delete a linkawaitclient.delete_link('link slug')Objectsdsc.py includes 4 objects - User, Link, Embed and Color. Every attribute of the object will be listed, datetime values
are in UTC.AppAttributesid:intowner_id:intverified:boolcreated_at:datetimekey:Optional[str](present only if you own the app)Methodsto_dict()- Return the object in the form of a dictionaryUserAttributesid:intpremium:boolverified:booljoined_at:datetimestaff:boolMethodsto_dict()- Return the object in the form of a dictionaryLinkAttributesid:strredirect:strowner_id:intembed:dsc.Embed(See the object below)editors:List[int]created_at:datetimetype:str('bot', 'server', 'template' or 'link')unlisted:strdisabled:boolbumped_at:datetimedomain:strMethodsto_dict()- Return the object in the form of a dictionaryEmbedReturned in responses or user created, embeds are a way to make your links stand out.Attributescolor:dsc.Color(See the object below)title:strdescription:strimagestr(image URL)Methodsto_dict()- Return the object in the form of a dictionaryClass methodsfrom_dict(data: dict)- Return an Embed object initialized with values from the dictionaryColorThis is extremely similar to discord.py's Color, though allows passing strings as well.All discord.py built-in color class-methods are here too, ex.dsc.Color.red()Attributesvalue:intMethodsto_dict()- Return the object in the form of a dictionaryClass methodsjust like discord.pyContributingThis package is opensource so anyone with adequate python experience can contribute to this project!Reporting IssuesIf you find any error/bug/mistake with the package or in the code feel free to create an issue and report
ithere.Fix/Edit ContentIf you want to contribute to this package, fork the repository, make your changes and then simply create a Pull Request!ContactIf you want to contact me:Mail -wulf.developer@gmail.comDiscord -wulf#9632