Skip to content

api-loopy5418-dev/loopypy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loopy-ts

The official Python wrapper for api.loopy5418.dev.


Discord Server     Website    



About

loopypy is a wrapper for api.loopy5418.dev made in Python.

It's easy for people that don't know how to make HTTP requests.

Setup

First install the package with

pip install loopypy

Then paste this into you app.py (or whatever you call it!)

import loopypy
# Or you can just do 
# from 'loopypy' import setApiKey, getApiKey, ai

loopypy.setApiKey("Secret!")
# You can get your api key at our server
# https://discord.gg/ZwK2W7GxhA


# Open AI
ask = loopy.ai("Hello, how are you! What's the weather in New York?")
print(ask.response)

# After running check your terminal!
# It should say something like:
# "Hello! I'm just a program, so I 
# don't have feelings, but I'm here to help you. 
# I don't have real-time data on the weather. 
# For the most accurate and current weather 
# information in New York, please check a 
# reliable weather website or app."

Function List

Name Description API Key
setApiKey(key) Sets the API key for automated gathering later on. x
getApiKey() Returns the API key Required
ai(prompt, speed) Uses the /openai/text endpoint to generate text from ChatGPT. Required
owoify(text) Owoifies the text and returns it Optional
emojify(text) Turns the text into regional indicators in Discord format. Optional
qr(data) Turns the given data into a QR code and returns the image buffer. Required
currency(base, target, amount) Converts one currency to another. Required
seconds_to_time(seconds) Converts given seconds into formatted time (HH:MM:SS) Optional
pick(*args) Picks an option off of the given ones. Optional
ascii_art(text) Returns multiline ascii art off of the given text. Optional
Coming Soon More functions are coming soon.

Function Usages

setApiKey(key)

Sets the API key for later use. Required for most endpoints.

Syntax:

  • key: string, required

Example Usage:

import loopypy
loopypy.setApiKey("xxxxx-xxxxxx-xxxxx-xxxxx")
print(loopypy.getApiKey()) # Prints the key you set

getApiKey()

Retrieves and returns the current API key.

Example Usage:

import loopypy
loopypy.setApiKey("xxxxx-xxxxxx-xxxxx-xxxxx")
print(loopypy.getApiKey()) # Prints the key you set

ai(prompt, speed)

Uses the /openai/text endpoint to generate text from ChatGPT.

Syntax:

  • prompt: String, required
  • speed: Integer, optional, defaults to 1. (0: large, 1: balanced, 2: fast)

Children:

  • .response
  • .model
  • .prompt
  • .success

Example Usage:

import loopypy
loopypy.setApiKey("xxxxx-xxxxxx-xxxxx-xxxxx")
ask = loopypy.ai("What's the capital of France?")
print(f"Response: {ask.response}")
print(f"Model: {ask.model}")

owoify(text)

Owoifies the text and returns it.

Syntax:

  • text: string, required

Example Usage:

import loopypy
print(loopypy.owoify("Hello!"))

emojify(text)

Turns the text into regional indicators in Discord format.

Syntax:

  • text string, required

Example Usage:

import loopypy
print(loopypy.emojify("Hello")) # Prints the key you set

qr(data)

Turns the given data into a QR code and returns the image buffer.

Syntax:

  • data: string, required

Example Usage:

import loopypy
loopypy.setApiKey("xxxxx-xxxxxx-xxxxx-xxxxx")
buffer = loopypy.qr("Hello!") # get image buffer
with open("image.png", "wb") as f:
    f.write(buffer)
    print("QR Code image saved to file!")

currency(base, target, amount)

Converts one currency to another.

Syntax:

  • base: string, required
  • target: string, required
  • amount: integer, required

Children:

  • .rate
  • .converted
  • .success

Example Usage:

import loopypy
loopypy.setApiKey("xxxxx-xxxxxx-xxxxx-xxxxx")
cur = loopypy.currency("USD", "EUR", 1)
print(f"Converted Money: {cur.converted}")
print(f"Rate: {cur.rate}")

seconds_to_time(seconds)

-# This function will soon be changed to fit the children system. E.g. print(seconds_to_time.seconds)

Converts given seconds into formatted time (HH:MM:SS)

Syntax:

  • seconds integer, required

Example Usage:

import loopypy
seconds = 260 # is 4 minutes and 20 seconds
print(loopypy.seconds_to_time(seconds)) # prints 00:04:20

pick(*args)

Picks one of the given options.

Syntax:

  • args: multiple objects, required

Example Usage:

import loopypy
print(loopypy.pick("Hello", "Hi", 1, 5)) # Outputs one of the options.

ascii_art(text)

Generates multiline ascii art.

Syntax:

  • text: string, required

Example Usage:

import loopypy
print(loopypy.ascii_art("Hello")) # Prints the multiline ascii text

About

The Python wrapper for api.loopy5418.dev

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages