So i have a discord bot (using python) that connect to a sqlite database, and i want to show the data using embed. The data is containing my daily anime schedule.
Here's the code :
@commands.command(aliases=['Schedule'])
async def schedule(self, ctx, day = None):
if (day==None):
conn = sqlite3.connect('./cogs/animelist.db')
cursor1 = conn.execute("SELECT name, status_eps from Animelist where day = 'monday'")
cursor2 = conn.execute("SELECT name, status_eps from Animelist where day = 'tuesday'")
cursor3 = conn.execute("SELECT name, status_eps from Animelist where day = 'wednesday'")
cursor4 = conn.execute("SELECT name, status_eps from Animelist where day = 'thursday'")
cursor5 = conn.execute("SELECT name, status_eps from Animelist where day = 'friday'")
cursor6 = conn.execute("SELECT name, status_eps from Animelist where day = 'saturday'")
cursor7 = conn.execute("SELECT name, status_eps from Animelist where day = 'sunday'")
embed = discord.Embed(
title=f'Anime Schedule:',
colour=discord.Color.blue())
for row in cursor1:
embed.add_field(name=f'Monday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor2:
embed.add_field(name=f'Tuesday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor3:
embed.add_field(name=f'Wednesday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor4:
embed.add_field(name=f'Thursday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor5:
embed.add_field(name=f'Friday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor6:
embed.add_field(name=f'Saturday', value=f'{row[0]} (Eps : {row[1]})', inline=False)
for row in cursor7:
embed.add_field(name=f'Sunday',value=f'{row[0]} (Eps : {row[1]})',inline=False)
await ctx.send(embed=embed)
conn.close()
The problem is this Discord Embed
There are 2 'Sunday' which is not what i wanted. What i want is (example for Sunday), the 'Value' will showing 'aot (eps :)'\n'wataten (eps :)' So that the result will showing this :
Sunday :
aot (eps : )
wataten (eps : )
I try to write this
Value=f'{for row in cursor7:
{row[0]}\n}'
So that for every row in cursor 7, it will automatically creating a new line. But i know it wont working. Can someone help me please?