mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Fixed leeks
This commit is contained in:
parent
5927c65c70
commit
4a07582d5d
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import collections
|
||||
import logging
|
||||
import re
|
||||
from typing import Union, Optional
|
||||
from src.database import db
|
||||
|
||||
|
@ -14,8 +15,14 @@ class UpdateDB:
|
|||
self.updated: list[tuple[str, tuple[Union[str, int], ...]]] = []
|
||||
|
||||
def json(self):
|
||||
def remove_webhooks(arg):
|
||||
re_match = re.match(r"^(\d{17,20})/[a-zA-Z0-9_-]{68}$", arg)
|
||||
if re_match is not None:
|
||||
return f"{re_match.group(1)}/[CENSORED DISCORD WEBHOOK TOKEN]"
|
||||
else:
|
||||
return arg
|
||||
# since pickled Discord messages are bytes object which is not serializable, we strip it here
|
||||
return [(item[0], [arg for arg in item[1] if not isinstance(arg, bytes)]) for item in self.updated]
|
||||
return [(item[0], [remove_webhooks(arg) for arg in item[1] if not isinstance(arg, bytes)]) for item in self.updated]
|
||||
|
||||
def add(self, sql_expression: tuple[str, tuple[Union[str, int, bytes], ...]]):
|
||||
self.updated.append(sql_expression)
|
||||
|
|
Loading…
Reference in a new issue