Base Classes¶
- class IBLPy.classes.IBLBaseUser(id, json)¶
Bases:
object
This is a base user on IBL from which all bots and users extend from
- __int__()¶
Returns the bot or user ID
- Return type
int
- __str__()¶
Returns the name of the bot or user
- Return type
str
- clean()¶
Cleans up all the ugly stuff from the IBL API
- class IBLPy.classes.IBLBot(id, json)¶
Bases:
IBLPy.classes.IBLBaseUser
IBLBot is internally a part of the base_fn module (which provides all of IBLPy’s base classes and functions). It represents a bot on IBL. The exact parameters of an IBLBot may change and IBLPy is designed to handle such changes automatically. Here are the parameters that we know of right now:
- Parameters
id – The id of the bot. This will be a integer
username – The name of the bot. This will be a string
tags – The tags of the bot. To make it easier for you, IBLPy makes this a list instead of the comma seperated string returned by the IBL API. This will be a list
prefix – This is the prefix of the bot. This will be a string
owner – The name of the owner of the bot. For some reason, the IBL API does not give the owner ID. This will be a string
short – The short description of the bot. This will be a string
long – The long description of the bot. This will be a string
library – The library the bot is coded in. This will be a string
premium – Whether the bot is premium or not. This will be a boolean
staff – Whether the bot is a staff bot or not. This will be a boolean
nsfw – Whether the bot is marked as an NSFW (Not Safe For Work) bot or not. This will be a boolean
certified – Whether the bot is certified or not. This will be a boolean
servers – The server count of the bot. The API puts this in a analytics JSON object, but for simplicity, we provide this as just guild_count. This will be a integer
shards – The server count of the bot. The API puts this in a analytics JSON object, but for simplicity, we provide this as just shard_count. This will be a integer
votes – The amount of votes the bot has. The API puts this in a analytics JSON object, but for simplicity, we provide this as just votes. This will be a integer
invites – The amount of people who have invited your bot. The API puts this in a analytics JSON object, but for simplicity, we provide this as just invites. This will be a integer
banner – The bots banner. The API puts this in a links JSON object, but for simplicity, we provide this as just banner. This will be a string or None (if not found)
github – The bots github. The API puts this in a links JSON object, but for simplicity, we provide this as just github. This will be a string or None (if not found)
website – The bots website. The API puts this in a links JSON object, but for simplicity, we provide this as just website. This will be a string or None (if not found)
donate – The bots donation link. The API puts this in a links JSON object, but for simplicity, we provide this as just donate. This will be a string or None (if not found)
support – The bots support server. The API puts this in a links JSON object, but for simplicity, we provide this as just support. This will be a string or None (if not found)
- __int__()¶
Returns the bot or user ID
- Return type
int
- __str__()¶
Returns the name of the bot or user
- Return type
str
- clean()¶
Cleans up all the ugly stuff from the IBL API
- class IBLPy.classes.IBLUser(id, json, japi_data)¶
Bases:
IBLPy.classes.IBLBaseUser
IBLUser is internally a part of the base_fn module (which provides all of IBLPy’s base classes and functions). It represents a user on IBL. The exact parameters of an IBLUser may change and IBLPy is designed to handle such changes automatically. Here are the parameters that we know of right now:
- Parameters
id – The id of the user. This will be a integer
user – A JAPI user object (see [here](https://docs.japi.rest/#discord-user)). This will be a dict (the value of ‘data’) or None if not fetchable. This internally comes from japi.rest
nickname – The nickname of the user. This will be a string or None (if not found)
about – The users description/about text. This will be a string
certified_dev – Whether the user is a certified developer or not. This will be a boolean
developer – Whether the user is a developer or not. This will be a boolean
staff – Whether the user is an IBL staff member or not. This will be a boolean
website – The users listed website. The API puts this in a links JSON object, but for simplicity, we provide this as just website. This will be a string or None (if not found)
- __int__()¶
Returns the bot or user ID
- Return type
int
- __str__()¶
Returns the name of the bot or user
- Return type
str
- clean()¶
Cleans up all the ugly stuff from the IBL API
- class IBLPy.classes.IBLAPIResponse(*, res, json)¶
Bases:
object
IBLAPIResponse represents an API response in the IBLPy library
- Parameters
res (
ClientResponse
) – This is the raw response from the API. This will be a aiohttp ClientResponsesuccess – Whether the API response has succeeded or not (status less than 400)
error_msg – The error message reported by the Infinity Bot List API
message – Any messages returned by the API in the message field. Can be None if there are no messages
json (
dict
) – The JSON object sent by the APIstatus – The status code of the HTTP response received from the API
Exceptions
- class IBLPy.classes.InvalidMode(mode)¶
Bases:
Exception
Raised when you don’t have the required mode (package) to perform the action such as trying to do an asynchronous API request without having aiohttp_requests installed or trying to do a webhook without fastapi+uvicorn
- class IBLPy.classes.IBLAPIRatelimit¶
Bases:
Exception
Raised when you are being ratelimited by IBL. The ratelimit for posting stats is 3 requests per 5 minutes and is unknown/variable for getting stats from the API
Votes
- class IBLPy.ws.Vote(bot_id, user_id, test, timestamp, count, username)¶
Bases:
object
Represents a vote on IBL
- Parameters
bot_id (
int
) – The Bot ID of the voteuser_id (
int
) – The ID of the user who voted for your bot. In test mode, this will be 0username (
str
) – The username who voted for your botcount (
int
) – The amount of votes your bot now hastest (
bool
) – Whether this is a test webhook or nottimestamp (
int
) – The timestamp (epoch) when the vote happened