TLSharp/TLSharp.Core/Requests/ImportByUserName.cs

36 lines
756 B
C#
Raw Normal View History

using System;
using System.IO;
using TLSharp.Core.MTProto;
namespace TLSharp.Core.Requests
{
public class ImportByUserName : MTProtoRequest
{
private readonly string _userName;
2016-02-01 21:58:51 +01:00
public int id { get; private set; }
public ImportByUserName(string userName)
{
_userName = userName;
}
public override void OnSend(BinaryWriter writer)
{
2016-02-01 21:58:51 +01:00
writer.Write(0xBF0131C);
Serializers.String.write(writer, _userName);
}
public override void OnResponse(BinaryReader reader)
{
var code = reader.ReadUInt32();
2016-02-01 21:58:51 +01:00
id = reader.ReadInt32();
}
public override void OnException(Exception exception)
{
throw new NotImplementedException();
}
2016-02-01 21:58:51 +01:00
public override bool Confirmed => true;
public override bool Responded { get; }
}
}