A Python Wrapper for the Normal API For any questions and support, you can join the API's server here
To begin with, you'll have to install the package by doing one of the following commands:
pip install -U normal_api.py
python -m pip -U install normal_api.py
After that, you will have to create the client:
import normal_api
normal_api_client = normal_api.Client()
For future reference in this documentation: when referring to 'normal_api_client' we refer to that above.
All available endpoints you can use.
Create a public or unlisted pastebin.
- text (str) - Text for the pastebin.
- privacy (Optional[str]) - Privacy value for the pastebin, this can only be "public" or "unlisted". Defaults to public.
Upload an image to Imgur.
https://en.wikipedia.org/wiki/Ordinal_numeral
- url (int) - The number.
Get anyone's status and more.
- user_id (int) - ID of user you want the status of.
Get some info on a discord invite.
- code (str) - Invite code.
Get some info on a discord server template.
- code (str) - Template code.
Convert text to emojis.
- text (str) - Text to convert to emojis.
Parse milliseconds into days,hours, minutes, seconds, milliseconds, microseconds and nanoseconds.
- milliseconds (int) - Milliseconds to parse
Translate text to x language.
Search for a YouTube Video.
- query (str) - Video title to search for
Create a safe that can only be views once.
- note (str) - The secret note
str (one time view only url to the safe note)
Encode text.
- text (str) - Text to encode
Decode text.
- text (str) - Text to decode
Reverse text.
- text (str) - Text to reverse
Search for an image related to your text.
- query (str) - Text to search an image for
Get a random emoji from discordemoji.com.
- category (Optional[int]) - Category to search in
- nsfw (Optional[bool]) - Determine if the emoji should be NSFW, defaults to False
Check if user_id has voted on bot_id on top.gg with the bot's token.
- bot_id (int) - Bot ID to check for
- user_id (int) - User ID to check for
- top_gg_token (str) - Top.gg bot token from here: https://top.gg/bot/BOT_ID_HERE/webhooks#:~:text=Token%20for%20this%20bot%3A&text=Show%20token the token is sent directly to the top.gg API.
bool (True or False)
Here is explained what attributes the returned objects have
The object returned from normal_api_client.image_search()
, normal_api_client.imgur().image
, normal_api_client.random_emoji().image
The url of the image
This will return a io.BytesIO object, which can be passed to discord.File() with a filename for discord.py
You can set bytesio
to False
if you want raw bytes instead of an io.BytesIO
object.
The url of the image
The object returned from normal_api_client.imgur()
The uploaded post's code
The uploaded post's image type. E.g, gif
The uploader image as a Image object
The uploaded post's code
The object returned from normal_api_client.pastebin()
The by you provided text for the post
The post's code
The post's URL
URL to the raw version of the post
Privacy type you chose for the post
The post's URL
The object returned from normal_api_client.user_status()
Username of user
Discriminator of user, without #
The current status of user. E.g, dnd
Activity info of user, this returns a User.Activity object.
The user's username+#discriminator will be returned
The user's ID will be returned
The object returned from normal_api_client.user_status().activity
Type of user's activity. E.g, PLAYING
Status text of user, if available else None
Emoji in status of user, if available else None
The user's activity type will be returned, if available
The object returned from normal_api_client.invite_info()
Invite code
Invite discord.gg URL
Info on the invite creator, this returns a Invite.Inviter object
Info on the invite channel, this returns a Invite.Channel object
Info on the invite server, this returns a Invite.Guild object
The invite's code will be returned
The object returned from normal_api_client.invite_info().inviter
Username of inviter
Discriminator of inviter
ID of inviter
The inviters' username+#discriminator will be returned
The inviters' id will be returned
The object returned from normal_api_client.invite_info().channel
Name of channel
ID of channel
Name of channel
ID of channel
The object returned from normal_api_client.invite_info().guild
Name of guild
Description of guild
ID of guild
Total count of members in the guild, if any
Features of guild as a list, if any
Name of guild the invite was created in will be returned
ID of guild the invite was created in will be returned
The object returned from normal_api_client.template_info()
Template code
The guilds' description, if guild has one
Template usage count
All role names in guild as a list, if any
All channels (including categories) names in guild as a list, if any
Info on the template creator, this returns a Template.Creator object
Info on the template server, this returns a Template.Guild object
The template's code will be returned
The object returned from normal_api_client.template_info().creator
Username of template creator
Discriminator of creator
ID of creator
The inviters' username+#discriminator will be returned
The inviters' id will be returned
The object returned from normal_api_client.invite_info().guild
Name of guild
Description of guild
Region of guild
Verification level of guild
Name of guild will be returned
ID of guild will be returned
The object returned from normal_api_client.emojify()
The inputted text
Converted text as emojis in single "string"
Converted text as emojis in ["list", "of", "strings"]
Same as Emojified.emojis will be returned
The object returned from normal_api_client.parse_milliseconds()
Milliseconds to days
Milliseconds to hours
Milliseconds to minutes
Milliseconds to seconds
Milliseconds to milliseconds
Milliseconds to microseconds
Milliseconds to nanoseconds
Same as ParsedMS.milliseconds will be returned
For debug reasons a string of all things will be returned
The object returned from normal_api_client.translate()
The inputted text translated to chosen lang
The inputted text to translate
Lang to translate input to
Same as Translated.text will be returned
The object returned from normal_api_client.youtube_video_search()
Title of returned video
Description of returned video
URL of returned video
Channel ID of returned video uploader
Same as YoutubeVideo.url will be returned
The object returned from normal_api_client.random_emoji()
Name of returned emoji
Category number of returned emoji
True or False if emoji is NSFW
Image of emoji as a Image object
Same as RandomEmoji.name will be returned
invite info using discord.py:
import discord
import normal_api
from discord.ext import commands
bot = commands.Bot(command_prefix = "example.")
normal_api_yes = normal_api.Client() # just a example, the client doesn't have to be under bot
@bot.command()
async def inviteinfo(ctx, code: str):
invinfo = await normal_api_yes.invite_info(code)
my_embed = discord.Embed(
title = "Invite Info",
description = f"[Join Server]({invinfo.url})"
)
my_embed.add_field(
name = "Inviter",
value = f"""
**Full Name**: {str(invinfo.inviter)}
**ID**: {invinfo.inviter.id}
"""
)
my_embed.add_field(
name = "Channel",
value = f"""
**Full Name**: {invinfo.channel.name}
**ID**: {invinfo.channel.id}
"""
)
my_embed.add_field(
name = "Server",
value = f"""
**Full Name**: {invinfo.guild.name}
**ID**: {invinfo.guild.id}
**Features**: {', '.join(invinfo.guild.features) if invinfo.guild.features else 'None'}
**Total Members**: {invinfo.guild.members}
"""
)
await ctx.send(embed = my_embed)
# invoke: example.inviteinfo yCzcfju
bot.run("TOKEN")