crxsnake 1.3.6__py3-none-any.whl → 1.3.8__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 CHANGED
@@ -2,6 +2,7 @@ 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 .embed import EmbedMessage
5
6
 
6
7
  from .utils.misc import *
7
8
  from .utils.hotline import IssueHotline
@@ -17,4 +18,7 @@ __all__ = [
17
18
  "Database",
18
19
  "IssueHotline",
19
20
  "IssueCRX",
21
+ "EmbedMessage",
22
+ "steam_to_be_guid",
23
+ "steam_to_dayz_guid"
20
24
  ]
crxsnake/embed.py CHANGED
@@ -1,26 +1,90 @@
1
- from disnake import Embed, Forbidden, Color
1
+ from typing import Optional, Dict, Any
2
+
3
+ from disnake import Embed, Forbidden, Colour
2
4
  from disnake.ext import commands
5
+ from crxsnake.utils.misc import trans
3
6
 
4
7
 
5
- class Embed:
8
+ class EmbedMessage:
6
9
 
7
10
  def __init__(self, bot: commands.Bot):
8
11
  self.bot = bot
9
12
 
10
- async def send_channel(self, channel_id: int, title: str, desc: str, color: Color):
13
+ async def send_channel(
14
+ self,
15
+ channel_id: int,
16
+ title: Optional[str] = None,
17
+ description: Optional[str] = None,
18
+ color: Optional[Colour] = trans,
19
+ url: Optional[str] = None,
20
+ image: Optional[str] = None,
21
+ footer: Optional[str] = None,
22
+ fields: Optional[Dict[str, Any]] = None
23
+ ) -> None:
24
+ """Send an Embed message to the channel"""
11
25
  channel = await self.bot.fetch_channel(channel_id)
12
26
  if channel:
13
- embed = self.__create_embed(title, desc, color)
27
+ embed = self.__create_embed(
28
+ title,
29
+ description,
30
+ color,
31
+ url,
32
+ image,
33
+ footer,
34
+ fields
35
+ )
14
36
  await channel.send(embed=embed)
15
37
 
16
- async def send_user(self, user_id: int, title: str, desc: str, color: Color):
38
+ async def send_user(
39
+ self,
40
+ user_id: int,
41
+ title: Optional[str] = None,
42
+ description: Optional[str] = None,
43
+ color: Optional[Colour] = trans,
44
+ url: Optional[str] = None,
45
+ image: Optional[str] = None,
46
+ footer: Optional[str] = None,
47
+ fields: Optional[Dict[str, Any]] = None
48
+ ) -> None:
49
+ """Send an Embed message to the user"""
17
50
  try:
18
51
  user = await self.bot.fetch_user(user_id)
19
52
  if user:
20
- embed = self.__create_embed(title, desc, color)
53
+ embed = self.__create_embed(
54
+ title,
55
+ description,
56
+ color,
57
+ url,
58
+ image,
59
+ footer,
60
+ fields
61
+ )
21
62
  await user.send(embed=embed)
22
63
  except Forbidden:
23
64
  pass
24
65
 
25
- def __create_embed(self, title: str, desc: str, color: Color):
26
- return Embed(title=title, description=desc, color=color)
66
+ @staticmethod
67
+ def __create_embed(
68
+ title: Optional[str] = None,
69
+ description: Optional[str] = None,
70
+ color: Optional[Colour] = trans,
71
+ url: Optional[str] = None,
72
+ image: Optional[str] = None,
73
+ footer: Optional[str] = None,
74
+ fields: Optional[Dict[str, Any]] = None
75
+ ) -> Embed:
76
+ """Return Embed"""
77
+ embed = Embed(
78
+ title=title if title else "Без названия",
79
+ description=description if description else "Описание отсутствует",
80
+ url=url,
81
+ color=color
82
+ )
83
+ if image:
84
+ embed.set_image(url=image)
85
+ if footer:
86
+ embed.set_footer(text=footer)
87
+ if fields:
88
+ for name, value in fields.items():
89
+ embed.add_field(name=name, value=value, inline=False)
90
+ return embed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crxsnake
3
- Version: 1.3.6
3
+ Version: 1.3.8
4
4
  Home-page: https://discord.gg/EEp67FWQDP
5
5
  Author: CRX-DEV
6
6
  Author-email: cherniq66@gmail.com
@@ -1,6 +1,6 @@
1
- crxsnake/__init__.py,sha256=5wsmYQtnqufR1WXHTXuDjLlWJ5eUDJTBEbE3IUr1dnY,444
1
+ crxsnake/__init__.py,sha256=0dxJ7FbMMTw63eLNF16oURtvhhGK24ULF6RnjWCZWXM,549
2
2
  crxsnake/cogs.py,sha256=MesrIo_bJb_Omq_gIi6I_WIGLTHyJb9oN29kU4Vr84E,581
3
- crxsnake/embed.py,sha256=CNgBOy1DLnhbuZ62wBCuT8-YJLjAeBkEYZZ1oI41RdQ,913
3
+ crxsnake/embed.py,sha256=WT-sgaG11I7nvLiPSuxf1CbXFh6fnW9cfcdBuMfPyVo,2811
4
4
  crxsnake/files.py,sha256=TCbwhqa4TKVX3hcjTf1ESRFgVmGcXw0BWdd7mPK6g48,910
5
5
  crxsnake/logger.py,sha256=-TXqHfagCV-TrnwJrucKEa61BRePW34sep0K9RCbHn8,764
6
6
  crxsnake/tortoise.py,sha256=zx51jsL9eMbEm7-3D2ObqrmtemUMzQxHA_mgfKOX_zM,617
@@ -9,8 +9,8 @@ crxsnake/utils/convert.py,sha256=lfS4fhePDdNJ4LS0PqT523bs34auIA5114NfZi4aaeE,542
9
9
  crxsnake/utils/crx.py,sha256=iBZzz71u-TSWynynSLLfWqcr2CX_Zba4DbPwFmYd7iM,437
10
10
  crxsnake/utils/hotline.py,sha256=m67Li-jByQ-9EER0USLoFsa1SnxCufwbhGvIfq2qlWM,3901
11
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,,
12
+ crxsnake-1.3.8.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
13
+ crxsnake-1.3.8.dist-info/METADATA,sha256=bfhGW8ulhAEohqu-fIE1-XPISmcOMxCmWpZLbQbjr68,1453
14
+ crxsnake-1.3.8.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
15
+ crxsnake-1.3.8.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
16
+ crxsnake-1.3.8.dist-info/RECORD,,