crxsnake 1.3.4__py3-none-any.whl → 1.3.6__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 +4 -3
- crxsnake/cogs.py +2 -2
- crxsnake/embed.py +26 -0
- crxsnake/files.py +5 -6
- crxsnake/tortoise.py +0 -3
- crxsnake/utils/convert.py +19 -0
- crxsnake/{issues → utils}/crx.py +3 -3
- crxsnake/utils/misc.py +28 -0
- {crxsnake-1.3.4.dist-info → crxsnake-1.3.6.dist-info}/METADATA +6 -6
- crxsnake-1.3.6.dist-info/RECORD +16 -0
- crxsnake/misc.py +0 -24
- crxsnake-1.3.4.dist-info/RECORD +0 -14
- /crxsnake/{issues → utils}/__init__.py +0 -0
- /crxsnake/{issues → utils}/hotline.py +0 -0
- {crxsnake-1.3.4.dist-info → crxsnake-1.3.6.dist-info}/LICENSE +0 -0
- {crxsnake-1.3.4.dist-info → crxsnake-1.3.6.dist-info}/WHEEL +0 -0
- {crxsnake-1.3.4.dist-info → crxsnake-1.3.6.dist-info}/top_level.txt +0 -0
crxsnake/__init__.py
CHANGED
@@ -2,10 +2,11 @@ from .logger import logger
|
|
2
2
|
from .cogs import load_cogs
|
3
3
|
from .files import read_json, write_json
|
4
4
|
from .tortoise import Database
|
5
|
-
from .misc import *
|
6
5
|
|
7
|
-
from .
|
8
|
-
from .
|
6
|
+
from .utils.misc import *
|
7
|
+
from .utils.hotline import IssueHotline
|
8
|
+
from .utils.crx import IssueCRX
|
9
|
+
from .utils.convert import steam_to_be_guid, steam_to_dayz_guid
|
9
10
|
|
10
11
|
|
11
12
|
__all__ = [
|
crxsnake/cogs.py
CHANGED
@@ -4,8 +4,8 @@ from sys import path
|
|
4
4
|
from pathlib import Path
|
5
5
|
|
6
6
|
|
7
|
-
async def load_cogs(bot
|
8
|
-
directory_path = Path(
|
7
|
+
async def load_cogs(bot) -> None:
|
8
|
+
directory_path = Path("src")
|
9
9
|
path.append(str(directory_path))
|
10
10
|
|
11
11
|
for entry in directory_path.iterdir():
|
crxsnake/embed.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
from disnake import Embed, Forbidden, Color
|
2
|
+
from disnake.ext import commands
|
3
|
+
|
4
|
+
|
5
|
+
class Embed:
|
6
|
+
|
7
|
+
def __init__(self, bot: commands.Bot):
|
8
|
+
self.bot = bot
|
9
|
+
|
10
|
+
async def send_channel(self, channel_id: int, title: str, desc: str, color: Color):
|
11
|
+
channel = await self.bot.fetch_channel(channel_id)
|
12
|
+
if channel:
|
13
|
+
embed = self.__create_embed(title, desc, color)
|
14
|
+
await channel.send(embed=embed)
|
15
|
+
|
16
|
+
async def send_user(self, user_id: int, title: str, desc: str, color: Color):
|
17
|
+
try:
|
18
|
+
user = await self.bot.fetch_user(user_id)
|
19
|
+
if user:
|
20
|
+
embed = self.__create_embed(title, desc, color)
|
21
|
+
await user.send(embed=embed)
|
22
|
+
except Forbidden:
|
23
|
+
pass
|
24
|
+
|
25
|
+
def __create_embed(self, title: str, desc: str, color: Color):
|
26
|
+
return Embed(title=title, description=desc, color=color)
|
crxsnake/files.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
from loguru import logger
|
2
|
-
from aiofiles import open
|
3
|
-
|
4
1
|
from typing import Optional, Any
|
5
2
|
from json import loads, dumps
|
6
3
|
|
4
|
+
from aiofiles import open
|
5
|
+
|
7
6
|
|
8
7
|
async def read_json(path: str, *keys: str) -> Optional[Any]:
|
9
8
|
"""
|
@@ -17,12 +16,12 @@ async def read_json(path: str, *keys: str) -> Optional[Any]:
|
|
17
16
|
for key in keys:
|
18
17
|
if key not in file_data:
|
19
18
|
return None
|
20
|
-
|
21
19
|
file_data = file_data[key]
|
20
|
+
|
22
21
|
return file_data
|
23
22
|
|
24
23
|
except Exception:
|
25
|
-
|
24
|
+
raise
|
26
25
|
|
27
26
|
|
28
27
|
async def write_json(path: str, data: Any) -> bool:
|
@@ -34,4 +33,4 @@ async def write_json(path: str, data: Any) -> bool:
|
|
34
33
|
await file.write(dumps(data, ensure_ascii=False, indent=2))
|
35
34
|
return True
|
36
35
|
except Exception:
|
37
|
-
|
36
|
+
raise
|
crxsnake/tortoise.py
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
from hashlib import sha256, md5
|
2
|
+
from base64 import b64encode
|
3
|
+
|
4
|
+
|
5
|
+
def steam_to_be_guid(steam_id: int) -> str:
|
6
|
+
parts = [0x42, 0x45] + [0] * 8
|
7
|
+
for i in range(2, 10):
|
8
|
+
steam_id, remainder = divmod(steam_id, 256)
|
9
|
+
parts[i] = remainder
|
10
|
+
|
11
|
+
byte_array = bytes(parts)
|
12
|
+
hash_object = md5(byte_array)
|
13
|
+
return hash_object.hexdigest()
|
14
|
+
|
15
|
+
|
16
|
+
def steam_to_dayz_guid(steam_id: int) -> str:
|
17
|
+
hashed = sha256()
|
18
|
+
hashed.update(str(steam_id).encode("utf-8"))
|
19
|
+
return b64encode(hashed.digest()).decode("utf-8")
|
crxsnake/{issues → utils}/crx.py
RENAMED
@@ -2,10 +2,10 @@ from typing import List, Dict, Any
|
|
2
2
|
|
3
3
|
|
4
4
|
class IssueCRX:
|
5
|
+
|
6
|
+
|
5
7
|
async def create_items(
|
6
|
-
|
7
|
-
issue_type: str,
|
8
|
-
items_list: List[Dict[str, Any]]
|
8
|
+
self, issue_type: str, items_list: List[Dict[str, Any]]
|
9
9
|
) -> Dict[str, List[Dict[str, Any]]]:
|
10
10
|
"""
|
11
11
|
Create a dictionary with generated codes and processed items.
|
crxsnake/utils/misc.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import re
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from datetime import datetime
|
6
|
+
from disnake import Embed
|
7
|
+
|
8
|
+
|
9
|
+
red = 16711680
|
10
|
+
green = 65280
|
11
|
+
blue = 255
|
12
|
+
yellow = 16776960
|
13
|
+
purple = 9109759
|
14
|
+
trans = 2829617
|
15
|
+
|
16
|
+
|
17
|
+
def restart():
|
18
|
+
python = sys.executable
|
19
|
+
os.execl(python, python, '-B', *sys.argv)
|
20
|
+
|
21
|
+
|
22
|
+
def get_unix_time() -> int:
|
23
|
+
return int(datetime.now().timestamp())
|
24
|
+
|
25
|
+
|
26
|
+
def get_user_id(field_index: int, embed: Embed) -> int:
|
27
|
+
user_id_str = re.search(r"<@!?(\d+)>", embed.fields[field_index].value).group(1)
|
28
|
+
return int(user_id_str)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crxsnake
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.6
|
4
4
|
Home-page: https://discord.gg/EEp67FWQDP
|
5
5
|
Author: CRX-DEV
|
6
6
|
Author-email: cherniq66@gmail.com
|
@@ -9,11 +9,11 @@ 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
|
14
|
-
Requires-Dist: disnake
|
15
|
-
Requires-Dist: aiofiles
|
16
|
-
Requires-Dist: loguru
|
12
|
+
Requires-Dist: setuptools==72.2.0
|
13
|
+
Requires-Dist: tortoise-orm==0.21.0
|
14
|
+
Requires-Dist: disnake==2.9.2
|
15
|
+
Requires-Dist: aiofiles==23.2.1
|
16
|
+
Requires-Dist: loguru==0.7.2
|
17
17
|
|
18
18
|
# CRX-Snake
|
19
19
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
crxsnake/__init__.py,sha256=5wsmYQtnqufR1WXHTXuDjLlWJ5eUDJTBEbE3IUr1dnY,444
|
2
|
+
crxsnake/cogs.py,sha256=MesrIo_bJb_Omq_gIi6I_WIGLTHyJb9oN29kU4Vr84E,581
|
3
|
+
crxsnake/embed.py,sha256=CNgBOy1DLnhbuZ62wBCuT8-YJLjAeBkEYZZ1oI41RdQ,913
|
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=m67Li-jByQ-9EER0USLoFsa1SnxCufwbhGvIfq2qlWM,3901
|
11
|
+
crxsnake/utils/misc.py,sha256=Oj7kZQVkcBY3GbtrPs-Lmc5cd6slGuLLYPNxMfZEqPQ,544
|
12
|
+
crxsnake-1.3.6.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
13
|
+
crxsnake-1.3.6.dist-info/METADATA,sha256=dDOABcE-M8UsNU5iFNQlktJVbINxgpjh9UOcp60kZqc,1453
|
14
|
+
crxsnake-1.3.6.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
15
|
+
crxsnake-1.3.6.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
16
|
+
crxsnake-1.3.6.dist-info/RECORD,,
|
crxsnake/misc.py
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import sys
|
3
|
-
|
4
|
-
from datetime import datetime
|
5
|
-
|
6
|
-
red = 16711680
|
7
|
-
green = 65280
|
8
|
-
blue = 255
|
9
|
-
yellow = 16776960
|
10
|
-
purple = 9109759
|
11
|
-
trans = 2829617
|
12
|
-
|
13
|
-
timestamp = int(datetime.now().timestamp())
|
14
|
-
time_short = f"<t:{timestamp}:d>"
|
15
|
-
time_long_date = f"<t:{timestamp}:D>"
|
16
|
-
time_short_time = f"<t:{timestamp}:t>"
|
17
|
-
time_long_time = f"<t:{timestamp}:T>"
|
18
|
-
time_full = f"<t:{timestamp}:f>"
|
19
|
-
time_relative = f"<t:{timestamp}:R>"
|
20
|
-
|
21
|
-
|
22
|
-
async def restart():
|
23
|
-
python = sys.executable
|
24
|
-
os.execl(python, python, '-B', *sys.argv)
|
crxsnake-1.3.4.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
crxsnake/__init__.py,sha256=Va8nawElNujlj6tmw30e3X723hkBbOcX0eP96D_F9iM,375
|
2
|
-
crxsnake/cogs.py,sha256=yllAQ7WEES0mrIrVacAjtW103XL-Z-kdC1wWKliKTTU,602
|
3
|
-
crxsnake/files.py,sha256=nNFUcyYefu-DrLiT2HkWoDpMjZ9mSxLxPp0tmtSlOLg,1049
|
4
|
-
crxsnake/logger.py,sha256=-TXqHfagCV-TrnwJrucKEa61BRePW34sep0K9RCbHn8,764
|
5
|
-
crxsnake/misc.py,sha256=cgrtl9r2rlm_M9qpx-2BPVn42UEzaeSMRa2hY6YCa3g,529
|
6
|
-
crxsnake/tortoise.py,sha256=lQQzxrdXw_4reKtLVUzlD8UL3BYehUSWaeEQXd8eJ-c,682
|
7
|
-
crxsnake/issues/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
crxsnake/issues/crx.py,sha256=Ka6V7q4ISJdoH2tI_avYzT67rGWcaKFTHIX4p6V5biI,447
|
9
|
-
crxsnake/issues/hotline.py,sha256=m67Li-jByQ-9EER0USLoFsa1SnxCufwbhGvIfq2qlWM,3901
|
10
|
-
crxsnake-1.3.4.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
11
|
-
crxsnake-1.3.4.dist-info/METADATA,sha256=dMqTZ2LiLbs-x-B2FiwTgepkl_t5R2EtpGQzDAiHQ_E,1458
|
12
|
-
crxsnake-1.3.4.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
13
|
-
crxsnake-1.3.4.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
14
|
-
crxsnake-1.3.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|