Removed old embed handling
This commit is contained in:
parent
5ae525121c
commit
aa929de8d7
@ -1,25 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
gismo sh-edraft Gismo
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
sh-edraft Dicord bot Gismo
|
||||
|
||||
:copyright: (c) 2021 - 2022 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'gismo_core.model'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2021 - 2022 sh-edraft.de'
|
||||
__version__ = '0.4.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
# imports
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='0', minor='4', micro='2')
|
@ -1,58 +0,0 @@
|
||||
from bot_core.model.embed_description_field import EmbedDescriptionField
|
||||
|
||||
|
||||
class EmbedDescription:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
title: str = None,
|
||||
description: str = None,
|
||||
url: str = None,
|
||||
color: str = None,
|
||||
fields: list[EmbedDescriptionField] = None,
|
||||
footer: str = None
|
||||
):
|
||||
self._title = title
|
||||
self._description = description
|
||||
self._url = url
|
||||
self._color = color
|
||||
self._fields = fields
|
||||
self._footer = footer
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
return self._title
|
||||
|
||||
@title.setter
|
||||
def title(self, value: str):
|
||||
self._title = value
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return self._description
|
||||
|
||||
@description.setter
|
||||
def description(self, value: str):
|
||||
self._description = value
|
||||
|
||||
@property
|
||||
def url(self) -> str:
|
||||
return self._url
|
||||
|
||||
@property
|
||||
def color(self) -> str:
|
||||
return self._color
|
||||
|
||||
@property
|
||||
def fields(self) -> list[EmbedDescriptionField]:
|
||||
return self._fields
|
||||
|
||||
@fields.setter
|
||||
def fields(self, value: list[EmbedDescriptionField]):
|
||||
self._fields = value
|
||||
|
||||
@property
|
||||
def footer(self) -> str:
|
||||
return self._footer
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
class EmbedDescriptionField:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
value: str,
|
||||
inline: bool
|
||||
):
|
||||
self._name = name
|
||||
self._value = value
|
||||
self._inline = inline
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def value(self) -> str:
|
||||
return self._value
|
||||
|
||||
@value.setter
|
||||
def value(self, value: str):
|
||||
self._value = value
|
||||
|
||||
@property
|
||||
def inline(self) -> bool:
|
||||
return self._inline
|
@ -1,23 +0,0 @@
|
||||
import discord
|
||||
|
||||
from bot_core.model.embed_description import EmbedDescription
|
||||
|
||||
|
||||
class EmbedService:
|
||||
|
||||
@staticmethod
|
||||
def get_embed(description: EmbedDescription) -> discord.Embed:
|
||||
embed = discord.Embed(
|
||||
title=description.title,
|
||||
url=description.url,
|
||||
description=description.description,
|
||||
color=int(description.color, 16)
|
||||
)
|
||||
|
||||
for field in description.fields:
|
||||
embed.add_field(name=field.name, value=field.value, inline=field.inline)
|
||||
|
||||
if description.footer is not None:
|
||||
embed.set_footer(text=description.footer)
|
||||
|
||||
return embed
|
Loading…
Reference in New Issue
Block a user