diff --git a/bot.py b/bot.py index d3978b1..6a05e99 100644 --- a/bot.py +++ b/bot.py @@ -76,6 +76,19 @@ def init_db(): # Tables might already be utf8mb4 or might not exist yet print(f"Table conversion info: {e}") + # Add new columns if they don't exist + try: + cursor.execute('ALTER TABLE tickets ADD COLUMN original_text TEXT') + print("Added original_text column") + except Exception as e: + print(f"original_text column info: {e}") + + try: + cursor.execute('ALTER TABLE tickets ADD COLUMN download_link VARCHAR(512)') + print("Added download_link column") + except Exception as e: + print(f"download_link column info: {e}") + conn.commit() cursor.close() conn.close() @@ -285,7 +298,7 @@ async def create_ticket( # Create embed for the ticket with improved design embed = discord.Embed( - title=f"šŸŽ« {title}", + title=f"{title}", description=f"**Project:** {project_name}\n**Ticket ID:** `{ticket_id}`", color=0x5865F2, # Discord Blurple timestamp=datetime.utcnow() @@ -294,25 +307,24 @@ async def create_ticket( # Add original request if available if original_text and original_author: embed.add_field( - name="šŸ’¬ Original Request", + name="Original Request", value=f"> {original_text}\n\n— {original_author.mention}", inline=False ) # Status and creator info - embed.add_field(name="šŸ“Š Status", value=TicketStatus.PENDING, inline=True) - embed.add_field(name="šŸ‘¤ Created By", value=interaction.user.mention, inline=True) - embed.add_field(name="šŸ“… Created", value=f"", inline=True) + embed.add_field(name="Status", value=TicketStatus.PENDING, inline=True) + embed.add_field(name="Created By", value=interaction.user.mention, inline=True) + embed.add_field(name="Created", value=f"", inline=True) # Project links embed.add_field( - name="🌐 Links", - value=f"[šŸ“¦ All Projects](https://devanturas.net/projects) • [šŸ“‹ {project_name}](https://devanturas.net/projects/{project_name})", + name="Links", + value=f"[All Projects](https://devanturas.net/projects) • [{project_name}](https://devanturas.net/projects/{project_name})", inline=False ) - embed.set_footer(text=f"Update Ticket System • {ticket_id}", icon_url="https://cdn.discordapp.com/emojis/1234567890.png") - embed.set_thumbnail(url="https://devanturas.net/assets/logo.png") + embed.set_footer(text=f"Update Ticket System • {ticket_id}") # Send to active channel ticket_message = await active_channel.send(embed=embed) @@ -405,8 +417,8 @@ async def update_status( # Update the status field for i, field in enumerate(embed.fields): - if field.name == "šŸ“Š Status": - embed.set_field_at(i, name="šŸ“Š Status", value=new_status_text, inline=True) + if "Status" in field.name: + embed.set_field_at(i, name="Status", value=new_status_text, inline=True) break # Change color based on status @@ -424,14 +436,14 @@ async def update_status( # Update or add download link field download_field_exists = False for i, field in enumerate(embed.fields): - if "Download" in field.name or "šŸ”—" in field.name: - embed.set_field_at(i, name="šŸ”— Download", value=f"[Download Update]({download_link})", inline=False) + if "Download" in field.name: + embed.set_field_at(i, name="Download", value=f"[Download Update]({download_link})", inline=False) download_field_exists = True break if not download_field_exists: embed.add_field( - name="šŸ”— Download", + name="Download", value=f"[Download Update]({download_link})", inline=False ) @@ -443,15 +455,15 @@ async def update_status( # Check if update history field exists history_exists = False for i, field in enumerate(embed.fields): - if "Update History" in field.name or "šŸ“" in field.name: + if "Update History" in field.name: current_history = field.value - embed.set_field_at(i, name="šŸ“ Update History", value=f"{current_history}\n{update_text}", inline=False) + embed.set_field_at(i, name="Update History", value=f"{current_history}\n{update_text}", inline=False) history_exists = True break if not history_exists: embed.add_field( - name="šŸ“ Update History", + name="Update History", value=update_text, inline=False )