hey guys, I'm automating some telegram stuff in Windows, though I was wonder if it's possible to open tg links directly in telegram client rather than first open by browser and then by telegram, all programmatically?
I'm coding in visual studio with C#, opening telegram can be done by the following code:
System.Diagnostics.Process.Start("TelegramPath\Telegram.exe", arguments);
for arguments parameter I tried "t.me//chatUsername" and "tg://resolver?domain=chatUsername" etc... the Telegram client app is being opened but there is no an appropriate chat opened
any suggestions would be appreciated.
@ShariatPanah Try "blabla\Telegram.exe -- tg://blabla"
for the double quotes I assume that I'm supposed to pass it as first parameter to Process.Start Method?
by the way for the first one, it throws exception: "The system cannot find the file specified."
but if I pass "tg://somechat" for second parameter, the telegram will be opened but without appropriate chat opened.
in the log file, I can see this command line:
Command line: path\Telegram.exe tg://someChat
@ShariatPanah Before tg:// place two dashes, like Telegram.exe -- tg://
yes I tried that like this:
Process.Start(@"path\Telegram.exe -- tg://some");
but it throws exception: "The system cannot find the file specified."
thanks by the way
@ShariatPanah And if you just remove those two dashes - it runs normally, but without opening the chat?
i tried your command in CMD and nothing successful, just opens telegram app
if I use your command for the first parameter it throws exception anyway, but if I use "tg://some" for second parameter, it would opens telegram but without opening the chat
@ShariatPanah I tried to run:
Telegram.exe -- tg://resolve?domain=preston
from CMD and it launched the app and opened the requested chat.
oh that worked, yay :)
Can you provide log.txt for that launch?
hey thanks buddy it worked in my application, I put it here for future references:
Process.Start(@"path\Telegram.exe", "-- tg://resolve?domain=preston");
thank you so much :)
Most helpful comment
@ShariatPanah Try "blabla\Telegram.exe -- tg://blabla"