TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

Start Bot Via Link

Open abrpr opened this issue 4 years ago • 2 comments

hi i wanna start bat with link. for example i wanna start bot X like that: https://t.me/X?start=123 how can i do it ? actually 123 is referral id and i wanna start bot with it. in my code i found and start a BOT like below: //BOT is my bot name TeleSharp.TL.Contacts.TLFound found = await this.client.SearchUserAsync(BOT); var FromUser = found.Users .Where(x => x.GetType() == typeof(TLUser)) .Cast<TLUser>() .FirstOrDefault(c => c.Username == BOT); peer = new TLInputPeerUser { UserId = FromUser.Id, AccessHash = FromUser.AccessHash.Value }; await this.client.SendMessageAsync(peer, "/start");

abrpr avatar Mar 09 '20 00:03 abrpr

See messages.startBot You can find this as class in TeleSharp.TL.Messages.TLRequestStartBot And do like this:

var startMsg = new TeleSharp.TL.Messages.TLRequestStartBot()
{
    Bot = peer, // Bot user
    Peer = me, // Chat or user who send message
    StartParam = "123" // Your own start parameter
};
// Send request
TelegramClient.SendRequestAsync<TeleSharp.TL.Messages.TLRequestStartBot>(startMsg);

Muaath5 avatar Jan 17 '21 07:01 Muaath5

On Sun, Jan 17, 2021 at 10:59 مُعَاذ القَرْنِي [email protected] wrote:

See messages.startBot https://core.telegram.org/method/messages.startBot You can find this as class in TeleSharp.TL.Messages.TLRequestStartBot https://github.com/sochix/TLSharp/blob/master/TeleSharp.TL/TL/Messages/TLRequestStartBot.cs And do like this:

var startMsg = new TeleSharp.TL.Messages.TLRequestStartBot() { Bot = peer, // Bot user Peer = me, // Chat or user who send message StartParam = "123" // Your own start parameter };// Send requestTelegramClient.SendRequestAsync<TeleSharp.TL.Messages.TLRequestStartBot>(startMsg);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sochix/TLSharp/issues/914#issuecomment-761747988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFUPUTPXQOSDOSFJXNNVVLS2KGXHANCNFSM4LD6SGKA .

Thanks a lot my friend

abrpr avatar Jan 21 '21 15:01 abrpr