From 8563826442e77056783e9c5c76de5a84a6f5d505 Mon Sep 17 00:00:00 2001 From: rambros Date: Sun, 1 Mar 2026 14:15:21 +0530 Subject: [PATCH] simplify user menu --- src/exodus/exporter.py | 40 ---------------------------------------- src/ui/exodus_app.py | 37 ++++++------------------------------- 2 files changed, 6 insertions(+), 71 deletions(-) diff --git a/src/exodus/exporter.py b/src/exodus/exporter.py index 0774d78..8c907f6 100644 --- a/src/exodus/exporter.py +++ b/src/exodus/exporter.py @@ -189,45 +189,6 @@ class DiscordExporter: return len(emoji_data), len(sticker_data) - async def export_members(self): - """Exports server members to server_assets.json.""" - member_data = [] - logger.info("Attempting to export members (requires Server Members Intent)...") - try: - members = await self.reader.get_members() - for m in members: - member_data.append({ - "id": str(m.id), - "name": m.name, - "display_name": m.display_name, - "discriminator": m.discriminator, - "avatar_url": str(m.avatar.url) if m.avatar else None, - "bot": m.bot, - "roles": [str(r.id) for r in m.roles if not r.is_default()] - }) - logger.info(f"Successfully exported {len(member_data)} members.") - except discord.Forbidden: - logger.warning("403 Forbidden: Missing Access to fetch members. Skipping members export.") - return 0 - except Exception as e: - logger.error(f"Failed to fetch members: {e}") - return 0 - - # Merge with existing assets - custom_file = self.export_path / "server_assets.json" - customization = {"emojis": [], "stickers": [], "members": member_data} - if custom_file.exists(): - try: - with open(custom_file, "r", encoding="utf-8") as f: - old_data = json.load(f) - customization["emojis"] = old_data.get("emojis", []) - customization["stickers"] = old_data.get("stickers", []) - except Exception: pass - - with open(custom_file, "w", encoding="utf-8") as f: - json.dump(customization, f, indent=4, ensure_ascii=False) - - return len(member_data) async def export_channels_structure(self): """Exports categories and channels hierarchy.""" @@ -381,7 +342,6 @@ class DiscordExporter: thread_msg_count += (t.message_count or 0) output_data = { - "channelName": channel_name, "channelID": str(channel_id), "messageCount": len(messages), "threadCount": thread_count, diff --git a/src/ui/exodus_app.py b/src/ui/exodus_app.py index 48db944..89ac12e 100644 --- a/src/ui/exodus_app.py +++ b/src/ui/exodus_app.py @@ -83,21 +83,18 @@ class ExodusCLI: console.print("\n[bold]Main Menu[/bold]") console.print("(1) Backup Server Profile") - console.print("(2) Backup User Names & Avatars") - console.print("(3) Backup Messages") - console.print("(4) Update & Sync Backup") + console.print("(2) Backup Messages") + console.print("(3) Update & Sync Backup") console.print("(C) Configuration") console.print("(Q) Exit") - choice = Prompt.ask("\nSelect an option", choices=["1", "2", "3", "4", "C", "Q"], default="Q", show_choices=False).upper() + choice = Prompt.ask("\nSelect an option", choices=["1", "2", "3", "C", "Q"], default="Q", show_choices=False).upper() if choice == "1": await self.backup_server_profile() elif choice == "2": - await self.backup_customization() - elif choice == "3": await self.backup_messages() - elif choice == "4": + elif choice == "3": await self.sync_backup() elif choice == "C": await self.edit_configuration() @@ -145,29 +142,8 @@ class ExodusCLI: finally: await self.engine.close_connections() - async def backup_customization(self): - """Option 2: Backup User Names & Avatars (Members).""" - if not self.tokens_valid: return - try: - await self.engine.discord_reader.start() - await self.exporter.setup() - with console.status("[yellow]Backing up members and names...[/yellow]"): - m_count = await self.exporter.export_members() - - if m_count > 0: - console.print(f"[bold green]Backup complete: {m_count} members and avatars saved to customization.json[/bold green]") - else: - console.print("[yellow]No members exported. Ensure 'Server Members Intent' is enabled.[/yellow]") - except discord.Forbidden as e: - console.print(f"[bold red]Member backup failed: {e}[/bold red]") - console.print("[yellow]Hint: Missing Access. Ensure 'Server Members Intent' is enabled in the Developer Portal.[/yellow]") - except Exception as e: - console.print(f"[bold red]Member backup failed: {e}[/bold red]") - finally: - await self.engine.close_connections() - async def backup_messages(self): - """Option 3: Backup Channels structure and all message history.""" + """Option 2: Backup Channels structure and all message history.""" if not self.tokens_valid: return try: await self.engine.discord_reader.start() @@ -241,10 +217,9 @@ class ExodusCLI: await self.engine.close_connections() async def sync_backup(self): - """Option 4: Update & Sync Backup (Runs a full pass but overwrites where needed).""" + """Option 3: Update & Sync Backup (Runs a full pass but overwrites where needed).""" console.print("[yellow]Syncing backup... (Re-validating all data)[/yellow]") await self.backup_server_profile() - await self.backup_customization() await self.backup_messages() async def edit_configuration(self):