[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:
Draper
2019-10-22 03:36:24 +01:00
committed by Michael H
parent 3723b4b1ea
commit 2ba6fb17ca
3 changed files with 14 additions and 9 deletions

View File

@@ -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