mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:07:48 +00:00
niku is gonna work on this
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
from typing import Optional
|
||||
|
||||
import discord
|
||||
from discord import Embed
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
class EmbedGenerator:
|
||||
@staticmethod
|
||||
async def Error(ctx: Context, message: str, **kwargs):
|
||||
color = ctx.bot.colors["embed"]
|
||||
em = Embed(title='Error:', description=message, color=color)
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def Message(ctx: Context,
|
||||
title: str,
|
||||
message: Optional[str] = '',
|
||||
**kwargs):
|
||||
color = ctx.bot.colors["embed"]
|
||||
em = Embed(title=title, description=message, color=color)
|
||||
return await EmbedGenerator.SendWithFooter(ctx, em, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def Image(ctx: Context,
|
||||
title: str,
|
||||
url: str,
|
||||
message: Optional[str] = '',
|
||||
**kwargs):
|
||||
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):
|
||||
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:
|
||||
avatar = ctx.author.avatar_url_as()
|
||||
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)
|
||||
Reference in New Issue
Block a user