Geometry dash python api

Introduction¶

gd.py is a Geometry Dash API, created to simplify interaction with GD servers.

The aim is to create a library following the best aspects of Object-Oriented Programming.

gd.py is async-ready, which means it can be easily run in parallel with other async programs.

For example, you can use it in a Discord bot:

from discord.ext import commands # import commands extension import discord import gd bot = commands.Bot(command_prefix="> ") client = gd.Client() @bot.event async def on_ready() -> None: bot.client = client # attach gd.Client to commands.Bot activity = discord.Activity(type=discord.ActivityType.playing, name="Geometry Dash") await bot.change_presence(activity=activity, status=discord.Status.online) @bot.command(name="daily") async def get_daily(ctx: commands.Context) -> None: try: daily = await bot.client.get_daily() except gd.MissingAccess: # couldn"t fetch a daily level return await ctx.send( embed=discord.Embed( description="Failed to get a daily level.", title="Error Occured", color=0xde3e35) ) embed = ( discord.Embed(color=0x7289da).set_author(name="Current Daily") .add_field(name="Name", value=daily.name) .add_field(name="Difficulty", value=f"daily.stars> (daily.difficulty.title>)") .add_field(name="ID", value=f"daily.id>") .set_footer(text=f"Creator: daily.creator.name>") ) await ctx.send(embed=embed) bot.run("BOT_TOKEN") 

(You can find documentation for discord.py library here)

© Copyright 2019-2020, nekitdev Revision 65bda763 .

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

An API Wrapper for Geometry Dash written in Python.

License

nekitdev/gd.py

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

An API wrapper for Geometry Dash written in Python.

Python 3.7 or above is required.

Installing the library with pip is quite simple:

Alternatively, the library can be installed from source:

$ git clone https://github.com/nekitdev/gd.py.git $ cd gd.py $ python -m pip install .

You can add gd.py as a dependency with the following command:

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies] "gd.py" = "^1.0.0"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies."gd.py"] git = "https://github.com/nekitdev/gd.py.git"
# file.py import asyncio import gd SONG_ID = 1081309 SONG = "<> by <> (ID: <>, size: <> MB)" async def main() -> None: client = gd.Client() song = await client.get_song(SONG_ID) print(SONG.format(song.name, song.artist.name, song.id, song.size)) asyncio.run(main())
$ python file.py PANDA EYES - BROKEN by PandaEyesOfficial (ID: 1081309, size: 9.71 MB)
import gd client = gd.Client() DAILY = "new daily! by (ID: )" @client.event async def on_daily(daily: gd.Level) -> None: print(DAILY.format(daily=daily)) client.listen_for_daily() client.create_controller().run()

You can find the documentation here.

If you need support with the library, you can send an email or refer to the official Discord server.

You can find the changelog here.

You can find the Security Policy of gd.py here.

If you are interested in contributing to gd.py , make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

gd.py is licensed under the MIT License terms. See License for details.

About

An API Wrapper for Geometry Dash written in Python.

Источник

Introduction¶

gd.py is a Geometry Dash API, created to simplify interaction with GD servers.

The aim is to create a library following the best aspects of Object-Oriented Programming.

gd.py is async-ready, which means it can be easily run in parallel with other async programs.

For example, you can use it in a Discord bot:

from discord.ext import commands # import commands extension import discord import gd bot = commands.Bot(command_prefix="> ") client = gd.Client() @bot.event async def on_ready() -> None: bot.client = client # attach gd.Client to commands.Bot activity = discord.Activity(type=discord.ActivityType.playing, name="Geometry Dash") await bot.change_presence(activity=activity, status=discord.Status.online) @bot.command(name="daily") async def get_daily(ctx: commands.Context) -> None: try: daily = await bot.client.get_daily() except gd.MissingAccess: # couldn"t fetch a daily level return await ctx.send( embed=discord.Embed( title="Error Occured", description="Failed to get a daily level.", color=0xFF5555, ) ) embed = ( discord.Embed(color=0x7289da, title="Daily", timestamp=ctx.message.created_at) .add_field(name="Name", value=daily.name) .add_field(name="Difficulty", value=f"daily.stars> (daily.difficulty.title>)") .add_field(name="ID", value=f"daily.id>") .set_footer(text=f"Creator: daily.creator.name>") ) await ctx.send(embed=embed) bot.run("BOT_TOKEN") 

(You can find documentation for discord.py library here)

© Copyright 2019-2020, nekitdev Revision b9d5e29c .

Versions master latest develop Downloads On Read the Docs Project Home Builds Free document hosting provided by Read the Docs.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A Geometry Dash API library written in Python

License

Neptex/GeometryPy

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

GeometryPy

You can install the library here https://github.com/NerexGD/GeometryPy/releases/ but you can also download it by clicking the green button «Clone or Download». Extract GeometryPy from the .zip and add it to your project directory. You’re ready to go!

GeometryPy have a lot of features: Get user stats, Get level info, Get featured levels, and more!

Get started by importing the package to your project

import GeometryPy or import GeometryPy as GDClient or import GeometryPy as [insert what you want here] #Because i know we're sometimes lazy to write a long word

You can now start to use GeometryPy! Enjoy!

Function Parameters Result
GetUserInfo AccountID or Username Returns a dict which contains informations about an User
GetLevelInfo Level Name or LevelID, Creator (optional) Returns a dict which contains informations about a Level
GetSongInfo SongID Returns a dict which contains informations about a Song
GetPlayersLeaderboard Players Amount Returns a list which contains multiples dicts with top players stats
GetCreatorsLeaderboard Players Amount Returns a list which contains multiples dicts with top creators stats
GetFeaturedLevels Page Returns a list which contains multiples dicts with featured levels info
GetMostDownloadedLevels Page Returns a list which contains multiples dicts with most downloaded levels info
GetMostLikedLevels Page Returns a list which contains multiples dicts with most liked levels info
GetRecentLevels Page Returns a list which contains multiples dicts with recents levels info
GetAwardedLevels Page Returns a list which contains multiples dicts with awarded levels info
GetMagicLevels Page Returns a list which contains multiples dicts with magics levels info

In this example, you can get stats of the user «Nerex», Get infos of the level «Cataclysm» but also get the top 100 creators leaderboard!

import GeometryPy as GDClient Player = GDClient.GetUserInfo("Nerex") #You can also use an AccountID! print(Player) """ returns: < 'username': 'Nerex', 'stars': '1340', 'usercoins': '130', 'demons': '40', 'diamonds': '1919', 'cp': '2', 'youtube': 'UC5JsIMU43qQw9ggxdVpJgRg', 'twitter': '@Nerex1', 'twitch': 'NerexGD', 'accountid': '20207462', 'userid': '5837301' > """ print(Player["username"]) # returns "Nerex" Level = GDClient.GetLevelInfo("Cataclysm") #You can also use a Level ID and specify a creator! (GDClient.GetLevelInfo("Cataclysm", "GgBoy") print(Level["stars"]) # return 10 LeaderboardCreators = GDClient.GetCreatorsLeaderboard(100) print(LeaderboardCreators[0]) # returns ViPrIn

About

A Geometry Dash API library written in Python

Источник

Читайте также:  Как поделить с остатком в питоне
Оцените статью