mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
improved bot ux/ui
This commit is contained in:
+11
-7
@@ -1,8 +1,8 @@
|
||||
from typing import Optional
|
||||
from typing import Optional, Union
|
||||
|
||||
import discord
|
||||
from discord import Embed
|
||||
from discord.ext.commands import Context
|
||||
from discord import Embed
|
||||
|
||||
|
||||
class EmbedGenerator:
|
||||
@@ -13,7 +13,9 @@ class EmbedGenerator:
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def Message(ctx: Context, title: str, message: Optional[str] = "", **kwargs):
|
||||
async def Message(
|
||||
ctx: Context, title: str, message: Optional[str] = "", **kwargs
|
||||
) -> Embed:
|
||||
color = ctx.bot.colors["embed"]
|
||||
em = Embed(title=title, description=message, color=color)
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
@@ -21,22 +23,24 @@ class EmbedGenerator:
|
||||
@staticmethod
|
||||
async def Image(
|
||||
ctx: Context, title: str, url: str, message: Optional[str] = "", **kwargs
|
||||
):
|
||||
) -> Embed:
|
||||
color = ctx.bot.colors["embed"]
|
||||
em = Embed(title=title, description=message, url=url, color=color)
|
||||
em.set_image(url=url)
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def Title(ctx: Context, title: str, **kwargs):
|
||||
async def Title(ctx: Context, title: str, **kwargs) -> Embed:
|
||||
color = ctx.bot.colors["embed"]
|
||||
em = Embed(title=title, color=color)
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def SendWithFooter(ctx: Context, em: Embed, **kwargs) -> discord.Message:
|
||||
async def SendWithFooter(
|
||||
ctx: Context, em: Embed, **kwargs
|
||||
) -> Union[discord.Message, Embed]:
|
||||
avatar = ctx.author.avatar.with_static_format("jpeg")
|
||||
em.set_footer(text=f"Requested by: {ctx.author}", icon_url=avatar)
|
||||
if kwargs.get("no_send", False):
|
||||
return em
|
||||
return await ctx.send(embed=em, **kwargs)
|
||||
return await ctx.send(embed=em, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user