(sponsors): Allow prompt to be nullable.

This commit is contained in:
2022-03-19 16:18:33 +02:00
parent b21e0e21e5
commit 2ff83b90fa
3 changed files with 10 additions and 20 deletions

View File

@@ -15,11 +15,12 @@ sponsored_commands = {'profile', 'stats', 'weekly', 'monthly'}
@LionContext.reply.add_wrapper
async def sponsor_reply_wrapper(func, ctx: LionContext, *args, **kwargs):
if ctx.cmd and ctx.cmd.name in sponsored_commands:
sponsor_hint = discord.Embed(
description=ctx.client.settings.sponsor_prompt.value,
colour=discord.Colour.dark_theme()
)
if 'embed' not in kwargs:
kwargs['embed'] = sponsor_hint
if (prompt := ctx.client.settings.sponsor_prompt.value):
sponsor_hint = discord.Embed(
description=prompt,
colour=discord.Colour.dark_theme()
)
if 'embed' not in kwargs:
kwargs['embed'] = sponsor_hint
return await func(ctx, *args, **kwargs)