crxsnake 1.4.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crxsnake/__init__.py +12 -7
- crxsnake/cogs.py +12 -11
- crxsnake/files.py +0 -7
- crxsnake/logger.py +1 -0
- crxsnake/tortoise.py +10 -9
- crxsnake/utils/misc.py +0 -6
- {crxsnake-1.4.0.dist-info → crxsnake-1.4.1.dist-info}/METADATA +4 -4
- crxsnake-1.4.1.dist-info/RECORD +16 -0
- crxsnake-1.4.0.dist-info/RECORD +0 -16
- {crxsnake-1.4.0.dist-info → crxsnake-1.4.1.dist-info}/LICENSE +0 -0
- {crxsnake-1.4.0.dist-info → crxsnake-1.4.1.dist-info}/WHEEL +0 -0
- {crxsnake-1.4.0.dist-info → crxsnake-1.4.1.dist-info}/top_level.txt +0 -0
crxsnake/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from .logger import
|
1
|
+
from .logger import log
|
2
2
|
from .cogs import load_cogs
|
3
3
|
from .files import read_json, write_json
|
4
4
|
from .tortoise import Database
|
@@ -9,16 +9,21 @@ from .utils.hotline import IssueHotline
|
|
9
9
|
from .utils.crx import IssueCRX
|
10
10
|
from .utils.convert import steam_to_be_guid, steam_to_dayz_guid
|
11
11
|
|
12
|
-
|
13
12
|
__all__ = [
|
14
|
-
"logger",
|
15
|
-
"load_cogs",
|
16
|
-
"read_json",
|
17
|
-
"write_json",
|
18
13
|
"Database",
|
19
14
|
"IssueHotline",
|
20
15
|
"IssueCRX",
|
21
16
|
"EmbedMessage",
|
17
|
+
"load_cogs",
|
18
|
+
"read_json",
|
19
|
+
"write_json",
|
22
20
|
"steam_to_be_guid",
|
23
|
-
"steam_to_dayz_guid"
|
21
|
+
"steam_to_dayz_guid",
|
22
|
+
"log",
|
23
|
+
"trans",
|
24
|
+
"green",
|
25
|
+
"red",
|
26
|
+
"blue",
|
27
|
+
"yellow",
|
28
|
+
"purple"
|
24
29
|
]
|
crxsnake/cogs.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
from loguru import logger
|
2
|
-
|
3
1
|
from sys import path
|
4
2
|
from pathlib import Path
|
3
|
+
from logger import log
|
5
4
|
|
6
5
|
|
7
|
-
async def load_cogs(bot) -> None:
|
8
|
-
|
9
|
-
|
6
|
+
async def load_cogs(bot, folder: str = "src", utils_folder: str = "utils") -> None:
|
7
|
+
try:
|
8
|
+
path.append(str(Path(folder)))
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
try:
|
10
|
+
for entry in Path(folder).iterdir():
|
11
|
+
for filename in entry.iterdir():
|
12
|
+
if filename.suffix == ".py" and entry.name != utils_folder:
|
15
13
|
bot.load_extension(f"{entry.name}.{filename.stem}")
|
16
|
-
|
17
|
-
|
14
|
+
|
15
|
+
log.info(f"[Discord] Cogs success loaded")
|
16
|
+
|
17
|
+
except Exception as e:
|
18
|
+
log.error(f"[Discord] An error occurred while loading modules\n╰─> Error: {e}")
|
crxsnake/files.py
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
from typing import Optional, Any
|
2
2
|
from json import loads, dumps
|
3
|
-
|
4
3
|
from aiofiles import open
|
5
4
|
|
6
5
|
|
7
6
|
async def read_json(path: str, *keys: str) -> Optional[Any]:
|
8
|
-
"""
|
9
|
-
Read data from json file.
|
10
|
-
"""
|
11
7
|
try:
|
12
8
|
async with open(path, "r", encoding="utf-8") as file:
|
13
9
|
file_content = await file.read()
|
@@ -25,9 +21,6 @@ async def read_json(path: str, *keys: str) -> Optional[Any]:
|
|
25
21
|
|
26
22
|
|
27
23
|
async def write_json(path: str, data: Any) -> bool:
|
28
|
-
"""
|
29
|
-
Write data to json file.
|
30
|
-
"""
|
31
24
|
try:
|
32
25
|
async with open(path, "w", encoding="utf-8") as file:
|
33
26
|
await file.write(dumps(data, ensure_ascii=False, indent=2))
|
crxsnake/logger.py
CHANGED
crxsnake/tortoise.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from
|
1
|
+
from logger import log
|
2
2
|
from tortoise import Tortoise
|
3
3
|
|
4
4
|
|
@@ -6,15 +6,16 @@ class Database:
|
|
6
6
|
DB_URL = "sqlite://settings/database/database.db"
|
7
7
|
DB_MODEL = {"models": ["src.utils"]}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
Connect to the database.
|
12
|
-
"""
|
9
|
+
@staticmethod
|
10
|
+
async def db_connect() -> None:
|
13
11
|
try:
|
14
|
-
await Tortoise.init(db_url=
|
12
|
+
await Tortoise.init(db_url=Database.DB_URL, modules=Database.DB_MODEL)
|
15
13
|
await Tortoise.generate_schemas()
|
16
|
-
|
17
|
-
logger.exception("An error occurred while connecting to the database")
|
14
|
+
log.info("[Database] SqLite connected")
|
18
15
|
|
19
|
-
|
16
|
+
except Exception as e:
|
17
|
+
log.error(f"[Database] Failed to connect SqLite: {e}")
|
18
|
+
|
19
|
+
@staticmethod
|
20
|
+
async def disconnect_db() -> None:
|
20
21
|
await Tortoise.close_connections()
|
crxsnake/utils/misc.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
import os
|
3
3
|
import sys
|
4
|
-
|
5
|
-
from datetime import datetime
|
6
4
|
from disnake import Embed
|
7
5
|
|
8
6
|
|
@@ -19,10 +17,6 @@ def restart():
|
|
19
17
|
os.execl(python, python, '-B', *sys.argv)
|
20
18
|
|
21
19
|
|
22
|
-
def get_unix_time() -> int:
|
23
|
-
return int(datetime.now().timestamp())
|
24
|
-
|
25
|
-
|
26
20
|
def get_user_id(field_index: int, embed: Embed) -> int:
|
27
21
|
user_id_str = re.search(r"<@!?(\d+)>", embed.fields[field_index].value).group(1)
|
28
22
|
return int(user_id_str)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crxsnake
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.1
|
4
4
|
Home-page: https://discord.gg/EEp67FWQDP
|
5
5
|
Author: CRX-DEV
|
6
6
|
Author-email: cherniq66@gmail.com
|
@@ -9,9 +9,9 @@ Project-URL: Repository, https://github.com/cyrax-dev/crxsnake
|
|
9
9
|
Project-URL: Discord, https://discord.gg/EEp67FWQDP
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
|
-
Requires-Dist: setuptools==
|
13
|
-
Requires-Dist: tortoise-orm==0.
|
14
|
-
Requires-Dist: disnake==2.
|
12
|
+
Requires-Dist: setuptools==75.8.0
|
13
|
+
Requires-Dist: tortoise-orm==0.24.0
|
14
|
+
Requires-Dist: disnake==2.10.1
|
15
15
|
Requires-Dist: aiofiles==23.2.1
|
16
16
|
Requires-Dist: loguru==0.7.2
|
17
17
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
crxsnake/__init__.py,sha256=arrwu6wGSLKjgpaNdP3qK68XqSkmZiw-ZWMzfBgqjvo,624
|
2
|
+
crxsnake/cogs.py,sha256=tzw-YCm1hCp2qMFub-0byR4L2Qm7kB4asVrdFU41ZQw,632
|
3
|
+
crxsnake/embed.py,sha256=NnOqgTJ38BokdeduSVJ4M2nxNl45t7bm0ciJNrUbcI8,2709
|
4
|
+
crxsnake/files.py,sha256=qBn8azQq_RMUZI2y0IK6lEXi8qQHWB-9HlgB-Z_gjRc,811
|
5
|
+
crxsnake/logger.py,sha256=yv1298VWx0TwoBE2X9wJq1WOsGTRwDfdJ-BLds0Jnew,778
|
6
|
+
crxsnake/tortoise.py,sha256=VBQC5tAms-EKnCmGVg7WwkbFBQcYwMS_zUPPvnzOQJc,636
|
7
|
+
crxsnake/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
crxsnake/utils/convert.py,sha256=lfS4fhePDdNJ4LS0PqT523bs34auIA5114NfZi4aaeE,542
|
9
|
+
crxsnake/utils/crx.py,sha256=iBZzz71u-TSWynynSLLfWqcr2CX_Zba4DbPwFmYd7iM,437
|
10
|
+
crxsnake/utils/hotline.py,sha256=DEs70kjdG0MLXTQF2c2Bj2QzfFhCwpp7BM3xKlXmMw0,4042
|
11
|
+
crxsnake/utils/misc.py,sha256=eV6WBod5yMpWVH4PaCG4vNIWN9xhoeO-b6z3mRNPe0Q,434
|
12
|
+
crxsnake-1.4.1.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
13
|
+
crxsnake-1.4.1.dist-info/METADATA,sha256=eiLLmS1AqkVn0EhDph986yLMvrPTY8RaSicG4KDZ9CU,1454
|
14
|
+
crxsnake-1.4.1.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
15
|
+
crxsnake-1.4.1.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
16
|
+
crxsnake-1.4.1.dist-info/RECORD,,
|
crxsnake-1.4.0.dist-info/RECORD
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
crxsnake/__init__.py,sha256=0dxJ7FbMMTw63eLNF16oURtvhhGK24ULF6RnjWCZWXM,549
|
2
|
-
crxsnake/cogs.py,sha256=MesrIo_bJb_Omq_gIi6I_WIGLTHyJb9oN29kU4Vr84E,581
|
3
|
-
crxsnake/embed.py,sha256=NnOqgTJ38BokdeduSVJ4M2nxNl45t7bm0ciJNrUbcI8,2709
|
4
|
-
crxsnake/files.py,sha256=TCbwhqa4TKVX3hcjTf1ESRFgVmGcXw0BWdd7mPK6g48,910
|
5
|
-
crxsnake/logger.py,sha256=-TXqHfagCV-TrnwJrucKEa61BRePW34sep0K9RCbHn8,764
|
6
|
-
crxsnake/tortoise.py,sha256=zx51jsL9eMbEm7-3D2ObqrmtemUMzQxHA_mgfKOX_zM,617
|
7
|
-
crxsnake/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
crxsnake/utils/convert.py,sha256=lfS4fhePDdNJ4LS0PqT523bs34auIA5114NfZi4aaeE,542
|
9
|
-
crxsnake/utils/crx.py,sha256=iBZzz71u-TSWynynSLLfWqcr2CX_Zba4DbPwFmYd7iM,437
|
10
|
-
crxsnake/utils/hotline.py,sha256=DEs70kjdG0MLXTQF2c2Bj2QzfFhCwpp7BM3xKlXmMw0,4042
|
11
|
-
crxsnake/utils/misc.py,sha256=Oj7kZQVkcBY3GbtrPs-Lmc5cd6slGuLLYPNxMfZEqPQ,544
|
12
|
-
crxsnake-1.4.0.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
13
|
-
crxsnake-1.4.0.dist-info/METADATA,sha256=D62NgP-b-IH8EvmwMXKnnsVndwIF3AoR_ywNNo7cBv0,1453
|
14
|
-
crxsnake-1.4.0.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
15
|
-
crxsnake-1.4.0.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
16
|
-
crxsnake-1.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|