import gd, itertools from cube import calculate_cube from ball import calculate_ball from helpers import average client = gd.Client() def calculate_ship(editor: gd.api.Editor, level: gd.Level, portal: gd.api.Object, speed, portal_count: int): pass def calculate_ufo(editor: gd.api.Editor, level: gd.Level, portal: gd.api.Object, speed, portal_count: int): pass def calculate_wave(editor: gd.api.Editor, level: gd.Level, portal: gd.api.Object, speed, portal_count: int): pass def calculate_robot(editor: gd.api.Editor, level: gd.Level, portal: gd.api.Object, speed, portal_count: int): pass def calculate_spider(editor: gd.api.Editor, level: gd.Level, portal: gd.api.Object, speed, portal_count: int): pass
"""Example that shows downloading a song. Author: nekitdev. """ import gd client = gd.Client() # an entry point async def main() -> None: while True: query = input("Enter song ID: ") try: # fetch a song song = await client.get_ng_song(int(query)) except ValueError: print("Invalid type. Expected an integer.") except gd.MissingAccess: print("Song was not found.") else: name = f"newgrounds_{song.id}.mp3" with open(name, "wb") as file: await song.download(file=file, with_bar=True) print(f"Installed {song.name!r} by {song.author!r} -> {name!r}.")
"""Example of sending a message to a user. Author: nekitdev. """ import gd import random # for fun client = gd.Client() # initialize client # a coro to make things simplier async def coro(): # login username, password = ( input("Please enter your GD username: "******"Enter corresponding password: "******"Oh... Seems like you have no friends in GD...") # choose one target target = random.choice(friends) if input(f"Do you want to send a message to {target}? (y/n): ").lower() in {"n", "no"}: return
import config import gjlogintools import time import gmd import base64 import urllib3 import urllib import gd import gd extID = 0 url = 'https://api.pushbullet.com/v2/pushes' headers = {"Access-Token": ACCESS_TOKEN, "Content-Type": "application/json"} if (config.switcher == 0): client = gd.Client() client.sync_login(config.userName, config.password) print(client.account_id) extID = client.account_id else: logindata = "" isConnectedLogin = 0 while isConnectedLogin == 0: try: logindata = gjlogintools.loginGJAccount(server=config.server, userName=config.userName, password=config.password) extID = logindata[0] except Exception: isConnectedLogin = 0 print('networkIsUnstable')
"""Example that shows getting current daily/weekly levels. Author: NeKitDS. """ import gd client = gd.Client() # an entry point to gd API # let's create one coroutine to use # run() only once. async def coro(): # getting daily... daily = await client.get_daily() # getting weekly... weekly = await client.get_weekly() # now let's print... print(f"Current daily: {daily}, weekly: {weekly}.") # run a coroutine client.run(coro())
Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, Union, ref, ) import gd AUTH_RE = re.compile(r"(?:Token )?(?P<token>[A-Fa-z0-9]+)") CHUNK_SIZE = 64 * 1024 CLIENT = gd.Client() JSON_PREFIX = "json_" ROOT_PATH = Path(".gd") Function = Callable[[Any], Any] Error = ref("gd.server.Error") Cooldown = ref("gd.server.Cooldown") CooldownMapping = ref("gd.server.CooldownMapping") routes = web.RouteTableDef() class ErrorType(gd.Enum): DEFAULT = 13000 INVALID_TYPE = 13001