diff --git a/readme.md b/readme.md index 654203c..4e7b3d3 100644 --- a/readme.md +++ b/readme.md @@ -95,23 +95,23 @@ A docker image is available to host the bot ### Building the Image ```bash -docker build -t quotebot:2.5.0 . +docker build -t quotebot:2.5.1 . ``` ### Running the Container #### Quick Start ( If running in the root directory ) ```bash -docker run --rm -it -d -e TOKEN= quotebot:2.5.0 +docker run --rm -it -d -e TOKEN= quotebot:2.5.1 ``` To reattach, run `docker attach quotebot` #### Explanation ```bash # Just using token -docker run --rm -it -d -e TOKEN= -v :/app/data/db --name quotebot quotebot:2.5.0 +docker run --rm -it -d -e TOKEN= -v :/app/data/db --name quotebot quotebot:2.5.1 # or using env file -docker run --rm -it -d --env-file -v :/app/data/db --name quotebot quotebot:2.5.0 +docker run --rm -it -d --env-file -v :/app/data/db --name quotebot quotebot:2.5.1 ``` - `--rm`: Remove container when finished - `-it`: Open interactive shell to allow for `docker attach` @@ -121,7 +121,7 @@ docker run --rm -it -d --env-file -v `: Name of image to use, in this case `quotebot:2.5.0` +- ``: Name of image to use, in this case `quotebot:2.5.1` ## Debug QuoteBot has an additional command, `qkill`, which will kill the bot process from inside Discord. This can only be used diff --git a/src/quotebot/bot/QuoteBot.py b/src/quotebot/bot/QuoteBot.py index 70af8a8..1a58052 100644 --- a/src/quotebot/bot/QuoteBot.py +++ b/src/quotebot/bot/QuoteBot.py @@ -13,7 +13,7 @@ from log.Logger import Logger, Status from quote.Quote import format_quotee, is_quote, parse_quote -VERSION = "2.5" +VERSION = "2.5.1" SOURCE_CODE = "github.com/dlg1206/Discord-Quote-Bot" COMMANDS_REGEX = re.compile("!qadd|!q|!qall|!qrand|!qsearch|!qstat|!qhelp|!qkill") # list of commands diff --git a/src/quotebot/db/Database.py b/src/quotebot/db/Database.py index 3280b02..05d2a6c 100644 --- a/src/quotebot/db/Database.py +++ b/src/quotebot/db/Database.py @@ -81,7 +81,7 @@ def add_quote(self, quote: Quote, contributor: str) -> int: with self.get_cursor(conn) as cur: # Add new quotee if does not exist try: - cur.execute("INSERT INTO quotee VALUES (?);", (quote.quotee,)) + cur.execute("INSERT INTO quotee VALUES (?);", (quote.quotee.lower(),)) conn.commit() except sqlite3.IntegrityError as ie: conn.commit() @@ -98,7 +98,7 @@ def add_quote(self, quote: Quote, contributor: str) -> int: # Upload quote cur.execute( "INSERT INTO quote (pre_context, quote, post_context, quotee, contributor) VALUES (?, ?, ?, ?, ?);", - (quote.pre_context, quote.quote, quote.post_context, quote.quotee, contributor) + (quote.pre_context, quote.quote, quote.post_context, quote.quotee.lower(), contributor) ) conn.commit() @@ -116,7 +116,7 @@ def find_similar_quotee(self, quotee: str) -> list[str]: with self.open_connection() as conn: with self.get_cursor(conn) as cur: # Find similar quotees - cur.execute("SELECT name FROM quotee WHERE name LIKE ?;", (f"%{quotee}%",)) + cur.execute("SELECT name FROM quotee WHERE name LIKE ?;", (f"%{quotee.lower()}%",)) data = cur.fetchall() conn.commit() return [q[0] for q in data] # convert list of tuples for list of strings @@ -152,7 +152,7 @@ def get_all_quotes(self, quotee: str = None) -> list[Quote]: else: cur.execute( "SELECT quote, quotee, pre_context, post_context FROM quote WHERE quotee = ?;", - (quotee,) + (quotee.lower(),) ) data = cur.fetchall() return [Quote(q[0], q[1], q[2], q[3]) for q in data] # convert list of tuples for list of Quotes @@ -185,7 +185,7 @@ def get_quote_total(self, quotee: str = None) -> int: cur.execute("SELECT COUNT(ROWID) FROM quote;") # Else get count for specific quotee else: - cur.execute("SELECT COUNT(ROWID) FROM quote WHERE quotee = ?;", (quotee,)) + cur.execute("SELECT COUNT(ROWID) FROM quote WHERE quotee = ?;", (quotee.lower(),)) count = cur.fetchall()[0][0] return count