CHANGE: The 'stack' is a list of quotes that happened, it exists so that the same quote doesn't repeat immediately.

The stack limit determines how big the id stack can grow before quoted instances may repeat. Now it is only calculated when booting up the bot, and when adding/deleting new quotes
pull/3/head
Kamal Curi 2 years ago
parent 9ebb44a261
commit 3dd2cd0f8e

@ -23,6 +23,8 @@ from utils.weather import displayweather, getweatherdata
client = commands.Bot(command_prefix='--', intents=Intents.all())
logger = logging.getLogger(__name__)
stack_limit = int((count_quotes() * .25))
with open(QUOTE_STACK, mode='r') as f:
quote_id_stack = json.load(f)
@ -53,6 +55,8 @@ async def quote(bot: object, *quote: str) -> str:
"exact match!")
return await bot.send(f'{ex.args}\n_What the fuck are you doing?_')
else:
global stack_limit
stack_limit = int((count_quotes() * .25))
return await bot.send(f"Done: `{quote}\n` ID: `{qtid}`")
@ -168,6 +172,8 @@ async def delete_quote(bot, _id: int=None) -> str:
try:
if not remove_quote(_id):
return await bot.send('_Something wrong happened, dude!_')
global stack_limit
stack_limit = int((count_quotes() * .25))
return await bot.send('_Evidence deleted, fella!_')
except Exception as ex:

Loading…
Cancel
Save