1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-03 06:13:13 +00:00
Lumi/lib/embeds/error.py

238 lines
7.9 KiB
Python
Raw Normal View History

import discord
from lib import formatter
question_icon = "https://i.imgur.com/8xccUws.png"
2024-03-17 19:24:54 +00:00
exclam_icon = "https://i.imgur.com/vitwMUu.png"
2024-03-17 19:24:54 +00:00
def clean_error_embed(ctx):
embed = discord.Embed(
2024-03-17 19:24:54 +00:00
color=discord.Color.red(),
description=f"**{ctx.author.name}** "
)
return embed
class GenericErrors:
@staticmethod
def default_exception(ctx):
embed = clean_error_embed(ctx)
embed.description += "something went wrong."
embed.set_footer(text="Try the command again", icon_url=exclam_icon)
return embed
@staticmethod
def missing_permissions(ctx):
embed = clean_error_embed(ctx)
embed.description += "you are missing permissions to run this command."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def bot_missing_permissions(ctx):
embed = clean_error_embed(ctx)
embed.description += "I can't perform this command because I don't have the required permissions."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def command_on_cooldown(ctx, cooldown):
embed = clean_error_embed(ctx)
embed.description += "you are on cooldown."
embed.set_footer(text=f"Try again in {cooldown}", icon_url=exclam_icon)
return embed
@staticmethod
def owner_only(ctx):
embed = clean_error_embed(ctx)
embed.description += "this command requires Racu ownership permissions."
return embed
2024-03-18 17:48:12 +00:00
@staticmethod
def private_message_only(ctx):
embed = clean_error_embed(ctx)
embed.description += f"this command can only be used in private messages."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-19 07:34:29 +00:00
@staticmethod
def guild_only(ctx):
embed = clean_error_embed(ctx)
embed.description += f"this command can only be used in a server."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-19 12:13:17 +00:00
@staticmethod
def channel_not_allowed(ctx, channel):
embed = clean_error_embed(ctx)
embed.description += f"you can only do that command in {channel.mention}."
2024-03-19 12:25:59 +00:00
embed.set_footer(text="This message will delete itself after 5s", icon_url=exclam_icon)
2024-03-19 12:13:17 +00:00
return embed
class EconErrors:
@staticmethod
def missing_bet(ctx):
"""
See MissingRequiredArgument
"""
2024-03-17 19:24:54 +00:00
embed = clean_error_embed(ctx)
embed.description += "please enter a bet."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-17 19:57:01 +00:00
@staticmethod
def missing_argument(ctx):
"""
See MissingRequiredArgument
"""
embed = clean_error_embed(ctx)
embed.description += "your command is missing an argument."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def bad_bet_argument(ctx):
"""
See BadArgument
"""
2024-03-17 19:24:54 +00:00
embed = clean_error_embed(ctx)
embed.description += "the bet you entered is invalid."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def bad_argument(ctx):
"""
See BadArgument
"""
embed = clean_error_embed(ctx)
embed.description += "the argument you entered is invalid."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def insufficient_balance(ctx):
2024-03-17 19:24:54 +00:00
embed = clean_error_embed(ctx)
embed.description += "you don't have enough cash."
embed.set_footer(text=f"Do '{formatter.get_prefix(ctx)}balance' to see how much you can spend",
icon_url=question_icon)
return embed
@staticmethod
def daily_already_claimed(ctx, unix_time):
2024-03-17 19:24:54 +00:00
embed = clean_error_embed(ctx)
embed.description += f"already claimed. You can claim your reward again <t:{unix_time}:R>."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-17 19:24:54 +00:00
@staticmethod
def out_of_time(ctx):
embed = clean_error_embed(ctx)
embed.description += "you ran out of time."
embed.set_footer(text="Your bet was forfeited", icon_url=exclam_icon)
return embed
@staticmethod
def already_playing(ctx):
embed = clean_error_embed(ctx)
embed.description += f"you already have a game of {ctx.command.name} running."
embed.set_footer(text="Please finish this game first", icon_url=exclam_icon)
return embed
2024-03-17 20:44:21 +00:00
class BdayErrors:
@staticmethod
def birthdays_disabled(ctx):
embed = clean_error_embed(ctx)
embed.description += "birthdays are disabled in this server."
return embed
@staticmethod
def invalid_date(ctx):
embed = clean_error_embed(ctx)
embed.description += "the date you entered is invalid."
2024-03-18 14:40:58 +00:00
return embed
2024-03-19 07:34:29 +00:00
@staticmethod
def slash_command_only(ctx):
embed = clean_error_embed(ctx)
embed.description += "you can use only slash commands for the birthday system."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def bad_month(ctx):
embed = clean_error_embed(ctx)
embed.description += "I couldn't recognize that month."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def missing_arg(ctx):
embed = clean_error_embed(ctx)
embed.description += "please enter a month and a day, in that order."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-18 14:40:58 +00:00
2024-03-19 17:35:51 +00:00
class MiscErrors:
@staticmethod
def prefix_too_long(ctx):
embed = clean_error_embed(ctx)
embed.description += "this prefix is too long."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
@staticmethod
def prefix_missing(ctx):
embed = clean_error_embed(ctx)
embed.description += "please specify a new prefix."
embed.set_footer(text=f"For more info do '{formatter.get_prefix(ctx)}help {formatter.get_invoked_name(ctx)}'",
icon_url=question_icon)
return embed
2024-03-18 14:40:58 +00:00
class HelpErrors:
@staticmethod
def error_message(ctx, error):
"""
See discord.ext.commands.HelpCommand.send_error_message
"""
embed = clean_error_embed(ctx)
embed.description += error
embed.set_footer(text=f"See '{formatter.get_prefix(ctx)}help'", icon_url=question_icon)
2024-03-17 20:44:21 +00:00
return embed