fix comments classes

This commit is contained in:
grey-cat-1908 2021-09-18 17:53:48 +03:00
parent a909555ed2
commit 2c0b1d1de8
4 changed files with 6 additions and 3 deletions

View file

@ -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
} }

View file

@ -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__

View file

@ -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:

View file

@ -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")