mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-23 11:13:51 -05:00
[Audio] Handle Missing SQL deps more gracefully (#3066)
* Removes `MAX_BALANCE` from bank, user `bank.get_max_balance()` now `[p]bankset maxbal` can be used to set the maximum bank balance Signed-off-by: Guy <guyreis96@gmail.com> * Remove duplicated call in `[p]playlist update` Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com> * Handle both ModuleNotFoundError and ImportError and pull a more complete error message to forward to the user and fix grammar. Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com> * Since we aren't 100% certain of message length here due to using the error message for the raised error ... lets use pagify so this doesn't bite us in the future. Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com> * .... Lets not reinvent the wheel Signed-off-by: guyre <27962761+drapersniper@users.noreply.github.com> * Address Jack's review
This commit is contained in:
@@ -7,6 +7,7 @@ import logging
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
import traceback
|
||||
from collections import namedtuple
|
||||
from typing import Callable, Dict, List, Mapping, NoReturn, Optional, Tuple, Union
|
||||
|
||||
@@ -15,11 +16,14 @@ try:
|
||||
from databases import Database
|
||||
|
||||
HAS_SQL = True
|
||||
except ModuleNotFoundError:
|
||||
_ERROR = None
|
||||
except ImportError as err:
|
||||
_ERROR = "".join(traceback.format_exception_only(type(err), err)).strip()
|
||||
HAS_SQL = False
|
||||
SQLError = ModuleNotFoundError
|
||||
SQLError = err.__class__
|
||||
Database = None
|
||||
|
||||
|
||||
import aiohttp
|
||||
import discord
|
||||
import lavalink
|
||||
|
||||
Reference in New Issue
Block a user