mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 02:37:57 -05:00
Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts: # redbot/cogs/customcom/customcom.py # redbot/core/errors.py
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import importlib.machinery
|
||||
from typing import Optional
|
||||
|
||||
import discord
|
||||
|
||||
from .i18n import Translator
|
||||
|
||||
_ = Translator(__name__, __file__)
|
||||
|
||||
|
||||
class RedError(Exception):
|
||||
@@ -21,3 +28,24 @@ class CogLoadError(RedError):
|
||||
The message will be send to the user."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BankError(RedError):
|
||||
"""Base error class for bank-related errors."""
|
||||
|
||||
|
||||
class BalanceTooHigh(BankError, OverflowError):
|
||||
"""Raised when trying to set a user's balance to higher than the maximum."""
|
||||
|
||||
def __init__(
|
||||
self, user: discord.abc.User, max_balance: int, currency_name: str, *args, **kwargs
|
||||
):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.user = user
|
||||
self.max_balance = max_balance
|
||||
self.currency_name = currency_name
|
||||
|
||||
def __str__(self) -> str:
|
||||
return _("{user}'s balance cannot rise above {max:,} {currency}.").format(
|
||||
user=self.user, max=self.max_balance, currency=self.currency_name
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user