(sponsors): Allow prompt to be nullable.
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
from cmdClient.checks import is_owner
|
|
||||||
|
|
||||||
from .module import module
|
from .module import module
|
||||||
|
|
||||||
|
|
||||||
@@ -7,20 +5,10 @@ from .module import module
|
|||||||
name="sponsors",
|
name="sponsors",
|
||||||
group="Meta",
|
group="Meta",
|
||||||
desc="Check out our wonderful partners!",
|
desc="Check out our wonderful partners!",
|
||||||
flags=('edit', 'prompt')
|
|
||||||
)
|
)
|
||||||
async def cmd_sponsors(ctx, flags):
|
async def cmd_sponsors(ctx):
|
||||||
"""
|
"""
|
||||||
Usage``:
|
Usage``:
|
||||||
{prefix}sponsors
|
{prefix}sponsors
|
||||||
"""
|
"""
|
||||||
if await is_owner.run(ctx) and any(flags.values()):
|
|
||||||
if flags['edit']:
|
|
||||||
# Run edit setting command
|
|
||||||
await ctx.client.settings.sponsor_message.command(ctx, ctx.client.conf.bot['data_appid'])
|
|
||||||
elif flags['prompt']:
|
|
||||||
# Run prompt setting command
|
|
||||||
await ctx.client.settings.sponsor_prompt.command(ctx, ctx.client.conf.bot['data_appid'])
|
|
||||||
else:
|
|
||||||
# Display message
|
|
||||||
await ctx.reply(**ctx.client.settings.sponsor_message.args(ctx))
|
await ctx.reply(**ctx.client.settings.sponsor_message.args(ctx))
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ sponsored_commands = {'profile', 'stats', 'weekly', 'monthly'}
|
|||||||
@LionContext.reply.add_wrapper
|
@LionContext.reply.add_wrapper
|
||||||
async def sponsor_reply_wrapper(func, ctx: LionContext, *args, **kwargs):
|
async def sponsor_reply_wrapper(func, ctx: LionContext, *args, **kwargs):
|
||||||
if ctx.cmd and ctx.cmd.name in sponsored_commands:
|
if ctx.cmd and ctx.cmd.name in sponsored_commands:
|
||||||
|
if (prompt := ctx.client.settings.sponsor_prompt.value):
|
||||||
sponsor_hint = discord.Embed(
|
sponsor_hint = discord.Embed(
|
||||||
description=ctx.client.settings.sponsor_prompt.value,
|
description=prompt,
|
||||||
colour=discord.Colour.dark_theme()
|
colour=discord.Colour.dark_theme()
|
||||||
)
|
)
|
||||||
if 'embed' not in kwargs:
|
if 'embed' not in kwargs:
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ from .setting_types import * # noqa
|
|||||||
|
|
||||||
from .user_settings import UserSettings, UserSetting # noqa
|
from .user_settings import UserSettings, UserSetting # noqa
|
||||||
from .guild_settings import GuildSettings, GuildSetting # noqa
|
from .guild_settings import GuildSettings, GuildSetting # noqa
|
||||||
|
from .app_settings import AppSettings
|
||||||
|
|||||||
Reference in New Issue
Block a user