Git Product home page Git Product logo

rsap's Introduction

Maintenance Maintaner Open Source? Yes!

forthebadge made-with-python

Hunter's GitHub stats

RSAP.... well it is not a proper acronym, but you can think of it as Random Stuff API Python.. It makes use of PGamerX's Random Stuff API to provide you features such as jokes, memes, images and also an AI CHATBOT!!

The installation is also very very very simple.

pip install rsap

This will install rsap with only requests module.. You need to install aioHTTP for AsyncRSAP and discord.py for DisRSAP



The usage is very very very simple.. There are mainly two classes of this module (well there are three but I would consider two because third, you can't say that it is a proper "class" of the module.)



ASYNC USAGE

To use this module asynchronously, RSAP provides you with the AsyncRSAP class of the module... It uses the aioHTTP module to send GET request to the API... A small example for the same is shown below


from rsap import AsyncRSAP
import asyncio

bot = AsyncRSAP("api_key_here", "other_kwargs_here")

# For AI Response
response = asyncio.run(bot.ai_response("message_here", "unique_id"))
print(response)

# For Jokes
response = asyncio.run(bot.jokes("type"))
print(response)

# For Images
response = asyncio.run(bot.image("type"))
print(response)

The code above would use the aioHTTP module..



SYNC USAGE

To use this module synchronously, RSAP provides you with the RSAP class of the module... It uses the requests module to send the GET request to the API... A small example for the same is shown below

from rsap import RSAP

bot = RSAP("api_key_here", "other_kwargs_here")

# For AI Response
response = bot.ai_response("message", "unique_id") 
print(response)

# For Jokes
response = bot.joke("type")
print(response)

# For Images
response = bot.image("type")
print(response)

# For Closing
bot.close()

The code above would use the requests module..



So last of all that, we have that other so-called "class" known as DisRSAP class.. It is just an extension of the RSAP module, which uses the discord.py's commands.Bot module to send the bot responses in a particular Text Channel. It uses the on_message trigger to check for messages in the chat channel.. The example for the same is shown below

from rsap import DisRSAP
bot = DisRSAP("api_key_here", text_channel_id_here, command_prefix="!", "other_kwargs_here") #Don't specify any intents because "discord.Intents.all()" is already enabled in the source code.

bot.run("bot_token_here")

So the above code would simply run your bot and the bot would reply to every single message sent in that channel!!


So lemme guess, you are now thinking what are even those `kwargs` mentioned above ๐Ÿ˜

So here is a list of kwargs that you can add to your code!!!

๐Ÿ‘‰ api_key (str): The API key which you can get from https://api-info.pgamerx.com/register

๐Ÿ‘‰ dev_name (str, optional): The name of the developer who coded the chatbot. Used in responses. Defaults to Hunter.

๐Ÿ‘‰ unique_id (str, optional): The Unique ID to create custom sessions for each user. Defaults to a random uuid.uuid4 string.

๐Ÿ‘‰ bot_name (str, optional): The name of the chatbot. Used in responses. Defaults to PyChat.

๐Ÿ‘‰ type (str, optional): The type of API to use. Stable is recommended but can also be unstable. Defaults to "stable".

๐Ÿ‘‰ language (str, optional): The language to chat with the chatbot in. Defaults to "en".

๐Ÿ‘‰ plan (str, optional): The plan, if any, that you have subscribed to. Defaults to None

List of Types of Jokes

๐Ÿ˜† any

๐Ÿ˜† dev

๐Ÿ˜† spooky

๐Ÿ˜† pun

List of Types of Images

๐Ÿ“ธ aww

๐Ÿ“ธ duck

๐Ÿ“ธ dog

๐Ÿ“ธ cat

๐Ÿ“ธ memes

๐Ÿ“ธ dankmemes

๐Ÿ“ธ holup

๐Ÿ“ธ art

๐Ÿ“ธ harrypottermemes

๐Ÿ“ธ facepalm

List of Plans

๐Ÿ“ pro

๐Ÿ“ ultra

๐Ÿ“ biz

๐Ÿ“ mega

CONTACT ME

Need some help for some things?? Join this discord (is of a friend), and you can always find me here or add me on discord ะฝฯ…ฮทั‚ั”ั#8785 :D

Also, if you want to buy the pro plans of the API, be sure to check this out!

rsap's People

Contributors

hunter2809 avatar tubuliferous avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.