mirror of
https://github.com/boticord/boticordpy.git
synced 2024-11-11 19:07:29 +03:00
base
This commit is contained in:
parent
cf683fa14f
commit
ba766161dc
3 changed files with 54 additions and 113 deletions
|
@ -20,7 +20,7 @@ class HttpClient:
|
|||
loop: `asyncio loop`
|
||||
"""
|
||||
|
||||
def __init__(self, auth_token: str, version: int = 1, **kwargs):
|
||||
def __init__(self, auth_token: str, version: int = 3, **kwargs):
|
||||
self.token = auth_token
|
||||
self.API_URL = f"https://api.boticord.top/v{version}/"
|
||||
|
||||
|
@ -60,56 +60,26 @@ class HttpClient:
|
|||
|
||||
def get_bot_info(self, bot_id: int):
|
||||
"""Get information about the specified bot"""
|
||||
return self.make_request("GET", f"bot/{bot_id}")
|
||||
return self.make_request("GET", f"bots/{bot_id}")
|
||||
|
||||
# TODO
|
||||
def get_bot_comments(self, bot_id: int):
|
||||
"""Get list of specified bot comments"""
|
||||
return self.make_request("GET", f"bot/{bot_id}/comments")
|
||||
|
||||
def post_bot_stats(self, stats: dict):
|
||||
def post_bot_stats(self, bot_id: int, stats: dict):
|
||||
"""Post bot's stats"""
|
||||
return self.make_request("POST", "stats", json=stats)
|
||||
return self.make_request("POST", f"bots/{bot_id}", json=stats)
|
||||
|
||||
def get_server_info(self, server_id: int):
|
||||
"""Get information about specified server"""
|
||||
return self.make_request("GET", f"server/{server_id}")
|
||||
return self.make_request("GET", f"servers/{server_id}")
|
||||
|
||||
# TODO
|
||||
def get_server_comments(self, server_id: int):
|
||||
"""Get list of specified server comments"""
|
||||
return self.make_request("GET", f"server/{server_id}/comments")
|
||||
|
||||
def post_server_stats(self, payload: dict):
|
||||
"""Post server's stats"""
|
||||
return self.make_request("POST", "server", json=payload)
|
||||
|
||||
def get_user_info(self, user_id: int):
|
||||
"""Get information about the user"""
|
||||
return self.make_request("GET", f"profile/{user_id}")
|
||||
|
||||
def get_user_comments(self, user_id: int):
|
||||
"""Get specified user's comments"""
|
||||
return self.make_request("GET", f"user/{user_id}/comments")
|
||||
|
||||
def get_user_bots(self, user_id: int):
|
||||
"""Get bots of specified user"""
|
||||
return self.make_request("GET", f"bots/{user_id}")
|
||||
|
||||
def get_my_shorted_links(self, code: str = None):
|
||||
"""Get shorted links of an authorized user"""
|
||||
body = {"code": code} if code is not None else {}
|
||||
|
||||
return self.make_request("POST", "links/get", json=body)
|
||||
|
||||
def create_shorted_link(self, code: str, link: str, *, domain: LinkDomain = 1):
|
||||
"""Create new shorted link"""
|
||||
return self.make_request(
|
||||
"POST",
|
||||
"links/create",
|
||||
json={"code": code, "link": link, "domain": int(domain)},
|
||||
)
|
||||
|
||||
def delete_shorted_link(self, code: str, domain: LinkDomain = 1):
|
||||
"""Delete shorted link"""
|
||||
return self.make_request(
|
||||
"POST", "links/delete", json={"code": code, "domain": int(domain)}
|
||||
)
|
||||
return self.make_request("GET", f"users/{user_id}")
|
||||
|
|
|
@ -98,105 +98,74 @@ class Bot(ApiData):
|
|||
id: str
|
||||
"""Bot's Id"""
|
||||
|
||||
short_code: typing.Optional[str]
|
||||
"""Bot's page short code"""
|
||||
name: str
|
||||
"""Bot's name"""
|
||||
|
||||
page_links: list
|
||||
"""List of bot's page urls"""
|
||||
|
||||
server: dict
|
||||
"""Bot's support server"""
|
||||
|
||||
bumps: int
|
||||
"""Bumps count"""
|
||||
|
||||
added: str
|
||||
"""How many times users have added the bot?"""
|
||||
|
||||
prefix: str
|
||||
"""Bot's commands prefix"""
|
||||
|
||||
permissions: int
|
||||
"""Bot's permissions"""
|
||||
|
||||
tags: list
|
||||
"""Bot's search-tags"""
|
||||
|
||||
developers: list
|
||||
"""List of bot's developers Ids"""
|
||||
|
||||
links: typing.Optional[dict]
|
||||
"""Bot's social medias"""
|
||||
|
||||
library: typing.Optional[str]
|
||||
"""Bot's library"""
|
||||
|
||||
short_description: typing.Optional[str]
|
||||
shortDescription: str
|
||||
"""Bot's short description"""
|
||||
|
||||
long_description: typing.Optional[str]
|
||||
description: str
|
||||
"""Bot's long description"""
|
||||
|
||||
badge: typing.Optional[str]
|
||||
"""Bot's badge"""
|
||||
avatar: typing.Optional[str]
|
||||
"""Bot's avatar"""
|
||||
|
||||
stats: dict
|
||||
"""Bot's stats"""
|
||||
shortLink: typing.Optional[str]
|
||||
"""Bot's page short code"""
|
||||
|
||||
status: str
|
||||
"""Bot's approval status"""
|
||||
inviteLink: str
|
||||
"""Bot's invite link"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**parse_with_information_dict(kwargs))
|
||||
premiumActive: bool
|
||||
"""Bot's premium status"""
|
||||
|
||||
premiumSplashURL: typing.Optional[str]
|
||||
"""Bot's splash URL"""
|
||||
|
||||
class Server(ApiData):
|
||||
"""This model represents a server, returned from the Boticord API"""
|
||||
premiumAutoFetch: typing.Optional[bool]
|
||||
"""Bot's auto fetch status"""
|
||||
|
||||
id: str
|
||||
"""Server's Id"""
|
||||
standardBannerID: int
|
||||
"""Bot's standart banner ID"""
|
||||
|
||||
short_code: typing.Optional[str]
|
||||
"""Server's page short code"""
|
||||
premiumBannerURL: typing.Optional[str]
|
||||
"""Bot's premium banner URL"""
|
||||
|
||||
status: str
|
||||
"""Server's approval status"""
|
||||
owner: str
|
||||
"""Bot's owner"""
|
||||
|
||||
page_links: list
|
||||
"""List of server's page urls"""
|
||||
status: int
|
||||
"""Bot's status"""
|
||||
|
||||
bot: dict
|
||||
"""Bot where this server is used for support users"""
|
||||
prefix: str
|
||||
"""Bot's prefix"""
|
||||
|
||||
name: str
|
||||
"""Name of the server"""
|
||||
discriminator: str
|
||||
"""Bot's discriminator (soon deprecated)"""
|
||||
|
||||
avatar: str
|
||||
"""Server's avatar"""
|
||||
createdDate: str
|
||||
"""Bot's creation date"""
|
||||
|
||||
members: list
|
||||
"""Members counts - `[all, online]`"""
|
||||
supportServerInviteLink: typing.Optional[str]
|
||||
"""Bot's support server"""
|
||||
|
||||
owner: typing.Optional[str]
|
||||
"""Server's owner Id"""
|
||||
library: typing.Optional[int]
|
||||
"""Bot's library"""
|
||||
|
||||
bumps: int
|
||||
"""Bumps count"""
|
||||
guilds: typing.Optional[int]
|
||||
"""Bot's guilds count"""
|
||||
|
||||
tags: list
|
||||
"""Server's search-tags"""
|
||||
shards: typing.Optional[int]
|
||||
"""Bot's shards count"""
|
||||
|
||||
links: dict
|
||||
"""Server's social medias"""
|
||||
members: typing.Optional[int]
|
||||
"""Bot's members count"""
|
||||
|
||||
short_description: typing.Optional[str]
|
||||
"""Server's short description"""
|
||||
website: typing.Optional[str]
|
||||
"""Bot's website"""
|
||||
|
||||
long_description: typing.Optional[str]
|
||||
"""Server's long description"""
|
||||
|
||||
badge: typing.Optional[str]
|
||||
"""Server's badge"""
|
||||
upCount: int
|
||||
"""Bot's up count"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**parse_with_information_dict(kwargs))
|
||||
|
|
|
@ -11,6 +11,8 @@ class Webhook:
|
|||
"""Represents a client that can be used to work with BotiCord Webhooks.
|
||||
IP of the server - your machine IP. (`0.0.0.0`)
|
||||
|
||||
Note: you need to have IPV6 support to use this
|
||||
|
||||
Args:
|
||||
x_hook_key (:obj:`str`)
|
||||
X-hook-key to check the auth of incoming request.
|
||||
|
|
Loading…
Reference in a new issue