I am trying to make a discord bot in python with a note command where te user can make a note. The note gets saved using the database from replit.
Imports, commands, prefix ect, ect (Prefix = !)
@bot.command()
async def note(ctx, *, note_add):
author = ctx.author
if note_add.lower() == "note" or "see":
note_text = db[author]
print(note_text)
else:
db[author] = note_add
Output when I tried !note (Some text)
2023-03-01 13:37:01 ERROR discord.ext.commands.bot Ignoring exception in command note
Traceback (most recent call last):
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 267, in note
note_text = db[author]
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/replit/database/database.py", line 439, in __getitem__
raw_val = self.get_raw(key)
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/replit/database/database.py", line 477, in get_raw
r = self.sess.get(self.db_url + "/" + urllib.parse.quote(key))
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/urllib/parse.py", line 870, in quote
return quote_from_bytes(string, safe)
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/urllib/parse.py", line 895, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/runner/DiscordBot/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: quote_from_bytes() expected bytes