JavaScript
x
26
26
1
class EconomyCog(commands.Cog, name="Help"):
2
3
def __init__(self, bot):
4
self.bot = bot
5
6
@commands.command()
7
async def Money(self, ctx):
8
db = sqlite3.connect("main.sqlite")
9
cursor = db.cursor()
10
cursor.execute(f"SELECT money FROM main WHERE member_id = {ctx.message.author.id}")
11
result = cursor.fetchone()
12
if result is None:
13
sql = ("INSERT INTO main(member_id, money) VALUES(?,?)")
14
val = (ctx.message.author.id, 500)
15
cursor.execute(sql, val)
16
await ctx.send("Because you didn't have an account, I just made one for you!")
17
db.commit()
18
else:
19
emoji = ":dollar:"
20
cursor.execute(f"SELECT money FROM main WHERE member_id = {ctx.message.author.id}")
21
result1 = cursor.fetchone()
22
embed = discord.Embed(title = f"{ctx.message.author.name}'s Money", description=f"${result1} {emoji}", color = discord.Colour.random())
23
await ctx.send(embed=embed)
24
cursor.close()
25
db.close()
26
Everything works fine, but now when the amount is sent it looks like this:
when I try the {result1[1]}
(where the money is at) the command doesn’t even work. What am I missing?
Advertisement
Answer
The tuple is of length 1, so you should be using {result1[0]}
rather than {result1[1]}
.