This is my table
@client.event
async def on_ready():
db = sqlite3.connect('Smilewin.sqlite')
cursor = db.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS Introduce(
guild_id TEXT,
channel_id TEXT,
boarder TEXT,
status TEXT
)
''')
I wanted to store anything from a normal text to something like this ☆? ゜?☆? ゜?☆? ゜?☆? ゜?☆? ゜?☆
(basically anything)
When I try to store ☆? ゜?☆? ゜?☆? ゜?☆? ゜?☆? ゜?☆
It is giving an error.
Traceback (most recent call last):
File "C:UsersardilDesktopDesktop appANAPAHCodeReactV9Smilewin-envlibsite-packagesdiscordclient.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:UsersardilDesktopDesktop appANAPAHCodeReactV9SmileWinbot.py", line 618, in on_command_error
raise error
File "C:UsersardilDesktopDesktop appANAPAHCodeReactV9Smilewin-envlibsite-packagesdiscordextcommandsot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:UsersardilDesktopDesktop appANAPAHCodeReactV9Smilewin-envlibsite-packagesdiscordextcommandscore.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:UsersardilDesktopDesktop appANAPAHCodeReactV9Smilewin-envlibsite-packagesdiscordextcommandscore.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'text'
The code which I use to store that special symbols is:
@client.command()
@commands.has_permissions(administrator=True)
async def setboarder(ctx, *,boarder):
db = sqlite3.connect('Smilewin.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT boarder FROM Introduce WHERE guild_id = {ctx.guild.id}")
result = cursor.fetchone
if result is None:
sql = ("INSERT INTO Introduce(guild_id, boarder) VALUES(?,?)")
val = (ctx.guild.id , boarder)
embed = discord.Embed(
colour= 0x00FFFF,
title = "?????????????????????",
description= f"?????????????????? {boarder}"
)
message = await ctx.send(embed=embed)
await message.add_reaction('?')
elif result is not None:
sql = ("UPDATE Introduce boarder = ? WHERE guild_id = ?")
val = (boarder , ctx.guild.id)
embed = discord.Embed(
colour= 0x00FFFF,
title = "?????????????????????",
description= f"???????????????????? {boarder}"
)
message = await ctx.send(embed=embed)
await message.add_reaction('?')
cursor.execute(sql, val)
db.commit()
cursor.close()
db.close()
I want to know is it possible to store that kind of data in sqlite. If yes how can I do it please provide some example. thank you so much
question from:
https://stackoverflow.com/questions/65951534/how-to-store-speacial-symbols-in-sqlite 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…