I was making a custom prefix using the sqlite3 database when I recieve this error whenever I try using the prefix.
Traceback (most recent call last):
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordclient.py", line 333, in _run_event
await coro(*args, **kwargs)
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandsbot.py", line 943, in on_message
await self.process_commands(message)
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandsbot.py", line 939, in process_commands
ctx = await self.get_context(message)
File "C:UsersachutAppDataRoamingPythonPython39site-packagesdiscordextcommandsbot.py", line 876, in get_context
raise TypeError("Iterable command_prefix or list returned from get_prefix must "
TypeError: Iterable command_prefix or list returned from get_prefix must contain only strings, not Cursor
The line of code that it gets an error with is this:
def get_prefix(bot, message):
prefix = cursor.execute(f"SELECT prefix FROM guilds WHERE serverid = {message.guild.id}")
return when_mentioned_or(current_prefix)(bot, message)
I have tried doing things like this but then the bot does not respond to the prefix:
def get_prefix(bot, message):
prefix = cursor.execute(f"SELECT prefix FROM guilds WHERE serverid = {message.guild.id}")
prefix = str(prefix)
return when_mentioned_or(current_prefix)(bot, message)
And this:
def get_prefix(bot, message):
prefix = cursor.execute(f"SELECT prefix FROM guilds WHERE serverid = {message.guild.id}")
return when_mentioned_or(str(current_prefix))(bot, message)
And this:
def get_prefix(bot, message):
prefix = cursor.execute(f"SELECT prefix FROM guilds WHERE serverid = {message.guild.id}")
return when_mentioned_or(f"{current_prefix}")(bot, message)
Thanks!!!