mirror of
https://github.com/boticord/boticordpy.git
synced 2024-09-22 19:32:01 +03:00
commit
ff59029927
7 changed files with 27 additions and 15 deletions
|
@ -56,7 +56,7 @@ bot = commands.Bot(command_prefix="!")
|
||||||
|
|
||||||
# Function that will return the current bot's stats.
|
# Function that will return the current bot's stats.
|
||||||
async def get_stats():
|
async def get_stats():
|
||||||
return {"guilds": len(bot.guilds), "shards": 0, "members": len(bot.users)}
|
return {"servers": len(bot.guilds), "shards": 0, "members": len(bot.users)}
|
||||||
|
|
||||||
|
|
||||||
# Function that will be called if stats are posted successfully.
|
# Function that will be called if stats are posted successfully.
|
||||||
|
|
|
@ -10,7 +10,7 @@ __title__ = "boticordpy"
|
||||||
__author__ = "Marakarka"
|
__author__ = "Marakarka"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright 2021 - 2023 Marakarka"
|
__copyright__ = "Copyright 2021 - 2023 Marakarka"
|
||||||
__version__ = "3.0.0"
|
__version__ = "3.0.1"
|
||||||
|
|
||||||
from .client import BoticordClient
|
from .client import BoticordClient
|
||||||
from .types import *
|
from .types import *
|
||||||
|
|
|
@ -54,20 +54,20 @@ class BoticordClient:
|
||||||
self,
|
self,
|
||||||
bot_id: typing.Union[str, int],
|
bot_id: typing.Union[str, int],
|
||||||
*,
|
*,
|
||||||
servers: int = 0,
|
servers: typing.Optional[int] = None,
|
||||||
shards: int = 0,
|
shards: typing.Optional[int] = None,
|
||||||
users: int = 0,
|
users: typing.Optional[int] = None,
|
||||||
) -> boticord_types.ResourceBot:
|
) -> boticord_types.ResourceBot:
|
||||||
"""Post Bot's stats.
|
"""Post Bot's stats.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
bot_id (Union[:obj:`str`, :obj:`int`])
|
bot_id (Union[:obj:`str`, :obj:`int`])
|
||||||
Id of the bot to post stats of.
|
Id of the bot to post stats of.
|
||||||
servers ( :obj:`int` )
|
servers ( Optional[:obj:`int`] )
|
||||||
Bot's servers count
|
Bot's servers count
|
||||||
shards ( :obj:`int` )
|
shards ( Optional[:obj:`int`] )
|
||||||
Bot's shards count
|
Bot's shards count
|
||||||
users ( :obj:`int` )
|
users ( Optional[:obj:`int`] )
|
||||||
Bot's users count
|
Bot's users count
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -77,7 +77,7 @@ class BoticordClient:
|
||||||
_logger.info("Posting bot stats")
|
_logger.info("Posting bot stats")
|
||||||
|
|
||||||
response = await self.http.post_bot_stats(
|
response = await self.http.post_bot_stats(
|
||||||
bot_id, {"guilds": servers, "shards": shards, "members": users}
|
bot_id, {"servers": servers, "shards": shards, "members": users}
|
||||||
)
|
)
|
||||||
return boticord_types.ResourceBot.from_dict(response)
|
return boticord_types.ResourceBot.from_dict(response)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class HttpClient:
|
||||||
|
|
||||||
def __init__(self, auth_token: str = None, version: int = 3, **kwargs):
|
def __init__(self, auth_token: str = None, version: int = 3, **kwargs):
|
||||||
self.token = auth_token
|
self.token = auth_token
|
||||||
self.API_URL = f"https://api.boticord.top/v{version}"
|
self.API_URL = f"https://api.boticord.top/v{version}/"
|
||||||
|
|
||||||
loop = kwargs.get("loop") or asyncio.get_event_loop()
|
loop = kwargs.get("loop") or asyncio.get_event_loop()
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@ class BotiCordWebsocket:
|
||||||
self.loop = asyncio.get_event_loop()
|
self.loop = asyncio.get_event_loop()
|
||||||
self.ws = None
|
self.ws = None
|
||||||
self._listeners = {}
|
self._listeners = {}
|
||||||
self.not_closed = True
|
self.not_closed = False
|
||||||
|
|
||||||
self._token = token
|
self._token = token
|
||||||
|
|
||||||
def listener(self):
|
def listener(self):
|
||||||
|
|
|
@ -17,6 +17,19 @@ BotiCord Websocket
|
||||||
|
|
||||||
Notification types
|
Notification types
|
||||||
-------------------
|
-------------------
|
||||||
.. function:: comment_removed(data)
|
.. function:: up_added(data)
|
||||||
|
|
||||||
|
Called when up is added.
|
||||||
|
|
||||||
|
.. function:: comment_added(data)
|
||||||
|
|
||||||
|
Called when comment is added.
|
||||||
|
|
||||||
|
.. function:: comment_edited(data)
|
||||||
|
|
||||||
|
Called when comment is edited.
|
||||||
|
|
||||||
Called when comment is deleted.
|
.. function:: comment_removed(data)
|
||||||
|
|
||||||
|
Called when comment is deleted.
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ bot = commands.Bot(command_prefix="!")
|
||||||
|
|
||||||
# Function that will return the current bot's stats.
|
# Function that will return the current bot's stats.
|
||||||
async def get_stats():
|
async def get_stats():
|
||||||
return {"guilds": len(bot.guilds), "shards": 0, "members": len(bot.users)}
|
return {"servers": len(bot.guilds), "shards": 0, "members": len(bot.users)}
|
||||||
|
|
||||||
|
|
||||||
# Function that will be called if stats are posted successfully.
|
# Function that will be called if stats are posted successfully.
|
||||||
|
|
Loading…
Reference in a new issue