Skip to content

Commit fbbd80a

Browse files
Complete Step 2: Update CLI with multi-platform support
- man_page.adb: Updated to reflect multi-platform (Telegram, Discord, Twitter/X) - Updated NAME, DESCRIPTION, SYNOPSIS sections - Added Platform Selection Options to OPTIONS - Added platform-specific environment variables - Added platform selection examples - Updated SEE ALSO with Discord and Twitter API links - Updated diagnostics to mention Platform API connectivity - Updated fault-tolerance to mention multi-platform session management - version_info.adb: Updated version strings - Added multi-platform description - Added architecture details (Ada/SPARK core, Idris2 ABI, Zig FFI) - Updated license text with unified-hexadeca-api reference - argument_parser.ads: Added Mode_List_Platforms execution mode - argument_parser.adb: Added Mode_List_Platforms handling - trigger.adb: Added Mode_List_Platforms case to display supported platforms - main_menu.ads: Added platform selection procedures - Display_Platform_Menu - Handle_Platform_Selection - Updated Run signature to in out for Config - main_menu.adb: Implemented platform selection TUI - Updated main menu to show multi-platform description - Added Select Platform as menu option 1 - Moved Exit to option 0 - Added Display_Platform_Menu procedure - Added Handle_Platform_Selection procedure - Updated API credentials menu to show platform-specific tokens Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1 parent a9440ba commit fbbd80a

8 files changed

Lines changed: 232 additions & 36 deletions

File tree

‎src/trigger/cli/argument_parser.adb‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ package body Trigger.CLI.Argument_Parser is
6161
end if;
6262
end String_To_Report_Reason;
6363

64+
-- Helper function to convert string to Platform_Type
65+
function String_To_Platform (S : String) return Platform_Type is
66+
begin
67+
if S = "telegram" or S = "TELEGRAM" or S = "tg" then
68+
return Platform_Telegram;
69+
elsif S = "discord" or S = "DISCORD" or S = "dc" then
70+
return Platform_Discord;
71+
elsif S = "twitter" or S = "TWITTER" or S = "tw" or S = "x" then
72+
return Platform_Twitter;
73+
else
74+
return Platform_Telegram; -- Default to Telegram
75+
end if;
76+
end String_To_Platform;
77+
6478
-- Helper function to check if a string is a valid integer
6579
function Is_Integer (S : String) return Boolean is
6680
use Ada.Strings;
@@ -117,6 +131,10 @@ package body Trigger.CLI.Argument_Parser is
117131
API_ID => 0,
118132
API_Hash => To_Unbounded_String (""),
119133
Set_Credentials => False,
134+
Platform => Platform_Telegram,
135+
List_Platforms => False,
136+
Discord_Token => To_Unbounded_String (""),
137+
Twitter_Token => To_Unbounded_String (""),
120138
Session_Dir => To_Unbounded_String (""),
121139
List_Sessions => False,
122140
Clean_Sessions => False,
@@ -240,6 +258,39 @@ package body Trigger.CLI.Argument_Parser is
240258
Config.Set_Credentials := True;
241259
J := J + 1;
242260

261+
-- Platform selection flags
262+
elsif Arg = "-P" or Arg = "--platform" then
263+
if J < Arg_Count then
264+
Config.Platform := String_To_Platform (Ada.Command_Line.Argument (J + 1));
265+
J := J + 2;
266+
else
267+
Exit_Code := 1;
268+
Ada.Text_IO.Put_Line ("Error: --platform requires a platform name argument");
269+
J := J + 1;
270+
end if;
271+
elsif Arg = "--list-platforms" then
272+
Config.List_Platforms := True;
273+
Mode := Mode_List_Platforms;
274+
J := J + 1;
275+
elsif Arg = "--discord-token" then
276+
if J < Arg_Count then
277+
Config.Discord_Token := To_Unbounded_String (Ada.Command_Line.Argument (J + 1));
278+
J := J + 2;
279+
else
280+
Exit_Code := 1;
281+
Ada.Text_IO.Put_Line ("Error: --discord-token requires a token argument");
282+
J := J + 1;
283+
end if;
284+
elsif Arg = "--twitter-token" then
285+
if J < Arg_Count then
286+
Config.Twitter_Token := To_Unbounded_String (Ada.Command_Line.Argument (J + 1));
287+
J := J + 2;
288+
else
289+
Exit_Code := 1;
290+
Ada.Text_IO.Put_Line ("Error: --twitter-token requires a token argument");
291+
J := J + 1;
292+
end if;
293+
243294
-- Session flags
244295
elsif Arg = "-s" or Arg = "--session-dir" then
245296
if J < Arg_Count then
@@ -531,6 +582,11 @@ package body Trigger.CLI.Argument_Parser is
531582
Ada.Text_IO.Put_Line (" API:");
532583
Ada.Text_IO.Put_Line (" API_ID: " & Integer'Image (Config.API_ID));
533584
Ada.Text_IO.Put_Line (" Set_Credentials: " & Boolean'Image (Config.Set_Credentials));
585+
Ada.Text_IO.Put_Line (" Platform:");
586+
Ada.Text_IO.Put_Line (" Platform: " & Platform_Type'Image (Config.Platform));
587+
Ada.Text_IO.Put_Line (" List_Platforms: " & Boolean'Image (Config.List_Platforms));
588+
Ada.Text_IO.Put_Line (" Discord_Token: " & (if Config.Discord_Token = "" then "[not set]" else "[set]"));
589+
Ada.Text_IO.Put_Line (" Twitter_Token: " & (if Config.Twitter_Token = "" then "[not set]" else "[set]"));
534590
Ada.Text_IO.Put_Line (" Session:");
535591
Ada.Text_IO.Put_Line (" Session_Dir: " & To_String (Config.Session_Dir));
536592
Ada.Text_IO.Put_Line (" List_Sessions: " & Boolean'Image (Config.List_Sessions));

‎src/trigger/cli/argument_parser.ads‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package Trigger.CLI.Argument_Parser is
1414
Mode_Man,
1515
Mode_Version,
1616
Mode_License,
17+
Mode_List_Platforms,
1718
Mode_Diagnose,
1819
Mode_Self_Heal,
1920
Mode_Check_Deps,
@@ -42,6 +43,9 @@ package Trigger.CLI.Argument_Parser is
4243
Reason_Other
4344
);
4445

46+
-- Platform type
47+
type Platform_Type is (Platform_Telegram, Platform_Discord, Platform_Twitter);
48+
4549
-- Configuration record for CLI options
4650
type Configuration_Type is tagged record
4751
-- Informational
@@ -80,6 +84,14 @@ package Trigger.CLI.Argument_Parser is
8084
No_Color : Boolean := False;
8185
Quiet : Boolean := False;
8286

87+
-- Platform selection
88+
Platform : Platform_Type := Platform_Telegram;
89+
List_Platforms : Boolean := False;
90+
Discord_Token : Ada.Strings.Unbounded.Unbounded_String :=
91+
Ada.Strings.Unbounded.To_Unbounded_String ("");
92+
Twitter_Token : Ada.Strings.Unbounded.Unbounded_String :=
93+
Ada.Strings.Unbounded.To_Unbounded_String ("");
94+
8395
-- Account settings
8496
Specific_Account : Ada.Strings.Unbounded.Unbounded_String :=
8597
Ada.Strings.Unbounded.To_Unbounded_String ("");

‎src/trigger/cli/help_generator.adb‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ package body Trigger.CLI.Help_Generator is
3636
" --api-hash HASH Set the Telegram API hash" & ASCII.LF &
3737
" --set-credentials Set API credentials interactively" & ASCII.LF &
3838
"" & ASCII.LF &
39+
"Platform Selection Options:" & ASCII.LF &
40+
" -P PLATFORM, --platform PLATFORM Set the platform (telegram, discord, twitter)" & ASCII.LF &
41+
" --list-platforms List all supported platforms and exit" & ASCII.LF &
42+
" --discord-token TOKEN Set the Discord bot/user token" & ASCII.LF &
43+
" --twitter-token TOKEN Set the Twitter bearer token" & ASCII.LF &
44+
"" & ASCII.LF &
3945
"Session Options:" & ASCII.LF &
4046
" -s DIR, --session-dir DIR Set the directory for session files" & ASCII.LF &
4147
" --list-sessions List all session files" & ASCII.LF &

‎src/trigger/cli/man_page.adb‎

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ package body Trigger.CLI.Man_Page is
1919
"trigger(1) - Trigger User Manual" & ASCII.LF &
2020
"" & ASCII.LF &
2121
"NAME" & ASCII.LF &
22-
" trigger - Telegram channel reporting utility with multi-account management" & ASCII.LF &
22+
" trigger - Multi-platform social media reporting utility with multi-account management" & ASCII.LF &
2323
"" & ASCII.LF &
2424
"SYNOPSIS" & ASCII.LF &
2525
" trigger [OPTIONS] [COMMAND]" & ASCII.LF &
2626
"" & ASCII.LF &
2727
"DESCRIPTION" & ASCII.LF &
28-
" trigger is a Telegram channel reporting utility featuring multi-account" & ASCII.LF &
28+
" trigger is a multi-platform social media reporting utility featuring multi-account" & ASCII.LF &
2929
" management, persistent sessions, proxy support, configurable reporting" & ASCII.LF &
30-
" options, automatic FloodWait handling, and an interactive TUI." & ASCII.LF &
30+
" options, automatic rate limit handling, and an interactive TUI." & ASCII.LF &
31+
"" & ASCII.LF &
32+
" Supported platforms: Telegram, Discord, Twitter/X" & ASCII.LF &
3133
"" & ASCII.LF &
3234
" This implementation uses Ada/SPARK for the core application, Zig for FFI" & ASCII.LF &
33-
" bindings to Telegram API, and Idris2 for API layer abstractions." & ASCII.LF &
35+
" bindings, and Idris2 for API layer abstractions following the unified-hexadeca-api." & ASCII.LF &
3436
"" & ASCII.LF &
3537
"ORIGINAL ATTRIBUTION" & ASCII.LF &
3638
" This project implements functionality originally designed in Ripper by" & ASCII.LF &
@@ -50,6 +52,12 @@ package body Trigger.CLI.Man_Page is
5052
" --save-config Save the current configuration to the specified file" & ASCII.LF &
5153
" --reset-config Reset configuration to default values" & ASCII.LF &
5254
"" & ASCII.LF &
55+
" Platform Selection Options:" & ASCII.LF &
56+
" -P PLATFORM, --platform PLATFORM Set the platform (telegram, discord, twitter)" & ASCII.LF &
57+
" --list-platforms List all supported platforms and exit" & ASCII.LF &
58+
" --discord-token TOKEN Set the Discord bot/user token" & ASCII.LF &
59+
" --twitter-token TOKEN Set the Twitter bearer token" & ASCII.LF &
60+
"" & ASCII.LF &
5361
" API Credentials Options:" & ASCII.LF &
5462
" -a ID, --api-id ID Set the Telegram API ID" & ASCII.LF &
5563
" --api-hash HASH Set the Telegram API hash" & ASCII.LF &
@@ -125,6 +133,9 @@ package body Trigger.CLI.Man_Page is
125133
" TRIGGER_LOG_LEVEL Log level. Default: info" & ASCII.LF &
126134
" TRIGGER_API_ID Telegram API ID" & ASCII.LF &
127135
" TRIGGER_API_HASH Telegram API hash" & ASCII.LF &
136+
" TRIGGER_PLATFORM Social media platform (telegram, discord, twitter)" & ASCII.LF &
137+
" TRIGGER_DISCORD_TOKEN Discord bot/user token" & ASCII.LF &
138+
" TRIGGER_TWITTER_TOKEN Twitter bearer token" & ASCII.LF &
128139
" TRIGGER_PROXY Proxy URL" & ASCII.LF &
129140
" NO_COLOR If set to any value, disables colored output" & ASCII.LF &
130141
"" & ASCII.LF &
@@ -145,8 +156,18 @@ package body Trigger.CLI.Man_Page is
145156
" Show version:" & ASCII.LF &
146157
" trigger --version" & ASCII.LF &
147158
"" & ASCII.LF &
159+
" List supported platforms:" & ASCII.LF &
160+
" trigger --list-platforms" & ASCII.LF &
161+
"" & ASCII.LF &
162+
" Platform Selection:" & ASCII.LF &
163+
" Set platform to Discord:" & ASCII.LF &
164+
" trigger --platform discord --discord-token YOUR_TOKEN" & ASCII.LF &
165+
"" & ASCII.LF &
166+
" Set platform to Twitter:" & ASCII.LF &
167+
" trigger --platform twitter --twitter-token YOUR_TOKEN" & ASCII.LF &
168+
"" & ASCII.LF &
148169
" Configuration:" & ASCII.LF &
149-
" Set API credentials:" & ASCII.LF &
170+
" Set Telegram API credentials:" & ASCII.LF &
150171
" trigger --api-id 12345 --api-hash abcdef123456 --save-config" & ASCII.LF &
151172
"" & ASCII.LF &
152173
" Or interactively:" & ASCII.LF &
@@ -169,6 +190,10 @@ package body Trigger.CLI.Man_Page is
169190
" --reason spam \\" & ASCII.LF &
170191
" --all-accounts" & ASCII.LF &
171192
"" & ASCII.LF &
193+
" Report on Discord platform:" & ASCII.LF &
194+
" trigger --platform discord --discord-token YOUR_TOKEN" & ASCII.LF &
195+
" --channel general --report-count 5" & ASCII.LF &
196+
"" & ASCII.LF &
172197
" Session Management:" & ASCII.LF &
173198
" List sessions:" & ASCII.LF &
174199
" trigger --list-sessions" & ASCII.LF &
@@ -194,7 +219,7 @@ package body Trigger.CLI.Man_Page is
194219
" Trigger includes comprehensive self-diagnostic capabilities that check:" & ASCII.LF &
195220
" GNAT compiler availability, Zig compiler availability, Idris2 compiler" & ASCII.LF &
196221
" availability (optional), Configuration file validity, Session directory" & ASCII.LF &
197-
" existence and permissions, Session file integrity, Telegram API connectivity," & ASCII.LF &
222+
" existence and permissions, Session file integrity, Platform API connectivity," & ASCII.LF &
198223
" Disk space availability." & ASCII.LF &
199224
"" & ASCII.LF &
200225
"SELF-HEALING" & ASCII.LF &
@@ -208,7 +233,7 @@ package body Trigger.CLI.Man_Page is
208233
" Session state persistence for recovery after crashes, Network error" & ASCII.LF &
209234
" handling with reconnection logic, Partial failure continuation," & ASCII.LF &
210235
" Comprehensive error logging for post-mortem analysis, Circuit breaker" & ASCII.LF &
211-
" pattern to prevent repeated failures." & ASCII.LF &
236+
" pattern to prevent repeated failures, Multi-platform session management." & ASCII.LF &
212237
"" & ASCII.LF &
213238
"SECURITY" & ASCII.LF &
214239
" Session data can be encrypted using EdD448 + Kyber-1024 + BLAKE3 + SHAKE-512," & ASCII.LF &
@@ -230,11 +255,14 @@ package body Trigger.CLI.Man_Page is
230255
" See LICENSE and LICENSES/ for full license texts." & ASCII.LF &
231256
"" & ASCII.LF &
232257
"SEE ALSO" & ASCII.LF &
233-
" Ripper (original concept): https://github.com/2nixx/Ripper" & ASCII.LF &
258+
" Trigger source: https://github.com/hyperpolymath/trigger" & ASCII.LF &
259+
" Original Ripper concept: https://github.com/2nixx/Ripper" & ASCII.LF &
234260
" Ada/SPARK: https://www.adacore.com" & ASCII.LF &
235261
" Zig: https://ziglang.org" & ASCII.LF &
236262
" Idris2: https://idris-lang.org" & ASCII.LF &
237-
" Telegram API: https://core.telegram.org/api";
263+
" Telegram API: https://core.telegram.org/api" & ASCII.LF &
264+
" Discord API: https://discord.com/developers/docs/intro" & ASCII.LF &
265+
" Twitter API: https://developer.twitter.com/en/docs/twitter-api";
238266
end Get_Man_Page_Text;
239267

240268
end Trigger.CLI.Man_Page;

‎src/trigger/cli/version_info.adb‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ package body Trigger.CLI.Version_Info is
2727
"Author: " & Trigger.Author_Name & " <" & Trigger.Author_Email & ">" & ASCII.LF &
2828
"Project URL: " & Trigger.Project_URL & ASCII.LF &
2929
"" & ASCII.LF &
30+
"Multi-platform social media reporting utility" & ASCII.LF &
31+
"Supported platforms: Telegram, Discord, Twitter/X" & ASCII.LF &
32+
"" & ASCII.LF &
33+
"Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-hexadeca-api)" & ASCII.LF &
34+
"" & ASCII.LF &
3035
"Original concept: " & Trigger.Original_Concept &
3136
" by " & Trigger.Original_Author & ASCII.LF &
3237
"" & ASCII.LF &
@@ -66,8 +71,9 @@ package body Trigger.CLI.Version_Info is
6671
"This project implements functionality originally designed in " &
6772
Trigger.Original_Concept & " by " & Trigger.Original_Author & "." & ASCII.LF &
6873
"The original concept and feature set are acknowledged with gratitude." & ASCII.LF &
69-
"This implementation is a complete rewrite in Ada/SPARK with Zig FFI bindings," & ASCII.LF &
70-
"and does not contain any code from the original project.";
74+
"This implementation is a complete rewrite in Ada/SPARK with Zig FFI bindings" & ASCII.LF &
75+
"following the unified-hexadeca-api, and Idris2 for API abstractions." & ASCII.LF &
76+
"It does not contain any code from the original project.";
7177
end Get_License_Text;
7278

7379
end Trigger.CLI.Version_Info;

‎src/trigger/trigger.adb‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
-- Trigger - Main Application Entry Point
22
--
3-
-- Telegram channel reporting utility with multi-account management
3+
-- Multi-platform social media reporting utility with multi-account management
4+
-- Supported platforms: Telegram, Discord, Twitter/X
45
--
56
-- Author: hyperpolymath
67
--
78
-- This is the main entry point for the Trigger application.
89
-- It provides both a comprehensive CLI and an ADI TUI (Advanced Dialog Interface).
10+
-- Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-hexadeca-api)
911

1012
with Ada.Text_IO;
1113
with Ada.Strings.Unbounded;
@@ -54,6 +56,13 @@ begin
5456
when Argument_Parser.Mode_License =>
5557
Version_Info.Display_License;
5658

59+
when Argument_Parser.Mode_List_Platforms =>
60+
Ada.Text_IO.Put_Line ("Supported platforms:");
61+
Ada.Text_IO.Put_Line (" - telegram (or tg)");
62+
Ada.Text_IO.Put_Line (" - discord (or dc)");
63+
Ada.Text_IO.Put_Line (" - twitter (or tw, x)");
64+
Ada.Text_IO.Put_Line ("Default: telegram");
65+
5766
when Argument_Parser.Mode_Diagnose =>
5867
System_Check.Run_Diagnostics (Config, Exit_Code);
5968

0 commit comments

Comments
 (0)