-
Notifications
You must be signed in to change notification settings - Fork 0
/
embed_ui.py
30 lines (26 loc) · 1.14 KB
/
embed_ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import discord
import data
import os
import json
config = data.config()
def base(title: str, description: str, color = config.get('color'), img="", footer=""):
embed = discord.Embed(title=title,description=description,color=color)
embed.set_image(url=img)
embed.set_footer(text="{} {}".format(
config.get('name'),footer),
icon_url=os.environ["botAvatar"])
return embed
def bot_base(title: str, description: str, thumbnail="", img="", footer="",\
author={"name":"","icon_url":"","url":""}, color = config.get('color')):
embed = base(title, description, img=img, footer=', '+footer,color=color)
if "url" in author.keys() :
embed.set_author(name=author["name"], icon_url=author["icon_url"],url=author["url"])
else:
embed.set_author(name=author["name"], icon_url=author["icon_url"])
embed.set_thumbnail(url=thumbnail)
return embed
def embed():
data = json.load(open("json/message_body.json",'r'))
return bot_base(data["title"], data["description"], thumbnail=data["thumbnail"], \
img= data["img"], footer=data["footer"],\
author=data["author"], color = config.get('color'))