mirror of
https://github.com/boticord/boticordpy.git
synced 2024-11-11 19:07:29 +03:00
fix comments classes
This commit is contained in:
parent
a909555ed2
commit
2c0b1d1de8
4 changed files with 6 additions and 3 deletions
|
@ -14,5 +14,5 @@ class Config:
|
||||||
events_list = {
|
events_list = {
|
||||||
"new_bot_comment": types.Comment,
|
"new_bot_comment": types.Comment,
|
||||||
"edit_bot_comment": types.EditedComment,
|
"edit_bot_comment": types.EditedComment,
|
||||||
"delete_bot_comment": types.EditedComment
|
"delete_bot_comment": types.Comment
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Comment:
|
||||||
self.raw_data = raw_data["data"]
|
self.raw_data = raw_data["data"]
|
||||||
self.user_id = int(self.raw_data["user"])
|
self.user_id = int(self.raw_data["user"])
|
||||||
self.comment = self.raw_data["comment"]
|
self.comment = self.raw_data["comment"]
|
||||||
self.at = datetime.fromtimestamp(self.raw_data["at"])
|
self.at = datetime.fromtimestamp(self.raw_data["at"] / 1000)
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
name = self.__class__.__name__
|
name = self.__class__.__name__
|
||||||
|
|
|
@ -72,7 +72,9 @@ class BoticordWebhook:
|
||||||
auth = request.headers.get("X-Hook-Key")
|
auth = request.headers.get("X-Hook-Key")
|
||||||
|
|
||||||
if auth == self._webhooks["bot"]["hook_key"]:
|
if auth == self._webhooks["bot"]["hook_key"]:
|
||||||
data = (await request.json())
|
|
||||||
|
data = await request.json()
|
||||||
|
|
||||||
event_in_config = config.Config.events_list.get(data["type"])
|
event_in_config = config.Config.events_list.get(data["type"])
|
||||||
|
|
||||||
if event_in_config is not None:
|
if event_in_config is not None:
|
||||||
|
|
|
@ -13,4 +13,5 @@ boticord_webhook.run(5000)
|
||||||
async def on_boticord_comment_edit(data):
|
async def on_boticord_comment_edit(data):
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
|
|
||||||
bot.run("bot-token")
|
bot.run("bot-token")
|
Loading…
Reference in a new issue