Merge pull request #9 from KevinCaires/qidr

Last changes for the night
pull/3/head
Kevin Caires 4 years ago committed by GitHub
commit 41d02745d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,7 +5,7 @@
█ ▄ █ ▄▄▄█ ▄▄▄█ ▄ ██ █▄▄▄█ ▄▄▄█ █ ▄ █ ▄▄▄█ ▄▄▄█ ▄ ██ █▄▄▄█ ▄▄▄█
█ █ █ █ █▄▄▄█ █▄▄▄█ █▄█ █ █ █▄▄▄ █ █ █ █ █▄▄▄█ █▄▄▄█ █▄█ █ █ █▄▄▄
█▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█ █▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█
Neeble version: 2022.08.18b Neeble version: 2022.08.19
You can help the development of neeble in You can help the development of neeble in
https://github.com/KevinCaires/neeble https://github.com/KevinCaires/neeble
Thank you! Thank you!

@ -29,11 +29,13 @@ async def quote(bot: object, *quote: str) -> str:
try: try:
user = bot.author.name user = bot.author.name
set_quote(user, quote) qtid = set_quote(user, quote)
except Exception as ex: except Exception as ex:
if ex.args[0].find("Duplicate") != -1:
return await bot.send("There's already a quote from that same person, with that exact match!")
return await bot.send(f'{ex.args}\n_What the fuck are you doing?_') return await bot.send(f'{ex.args}\n_What the fuck are you doing?_')
else: else:
return await bot.send('Done:\n`%s`' % quote) return await bot.send("Done: `" + quote + "` ID: `" + str(qtid) + "`")
@client.command(aliases=['rq']) @client.command(aliases=['rq'])

@ -58,16 +58,20 @@ def migrate() -> None:
logger.error(ex.args) logger.error(ex.args)
def set_quote(user: str, quote: str) -> None: def set_quote(user: str, quote: str) -> int:
""" """
Set a quote into database. Set a quote into database.
""" """
qt = Quotes(quote=quote, user=user,)
qtid = 0
with Session(SQLACHEMY) as session: with Session(SQLACHEMY) as session:
session.add(Quotes( session.add(qt)
quote=quote, session.flush()
user=user, session.refresh(qt)
)) qtid = qt.id
session.commit() session.commit()
return qtid
def get_quotes(ids: list) -> tuple: def get_quotes(ids: list) -> tuple:

Loading…
Cancel
Save