我知道如何使用TLSharp创建新频道,但我如何才能将用户添加到此频道?
答案 0 :(得分:1)
var contacts = new TLVector<TLInputPhoneContact>();
contacts.lists.Add(new TLInputPhoneContact { first_name = "xxx", last_name = "xxx", phone = "xxx" });
var req = new TLRequestImportContacts()
{
contacts = contacts
};
var contact = client.SendRequestAsync<TLImportedContacts>(req).GetAwaiter().GetResult();
答案 1 :(得分:1)
用client.SendRequestAsync替换SendRequestAsync,所以:
public async Task<TLUpdates> InviteUserToChannel(TLAbsInputUser user, TLInputChannel channelid)
{
TLVector<TLAbsInputUser> u = new TLVector<TLAbsInputUser>();
u.lists.Add(user);
var req = new TLRequestInviteToChannel()
{
channel = channelid,
users = u
};
var update = await client.SendRequestAsync<TLUpdates>(req);
return update;
}
答案 2 :(得分:0)
也许它会帮助某人
public async Task<TLUpdates> InviteUserToChannel(TLAbsInputUser user, TLInputChannel channelid)
{
TLVector<TLAbsInputUser> u = new TLVector<TLAbsInputUser>();
u.lists.Add(user);
var req = new TLRequestInviteToChannel()
{
channel = channelid,
users = u
};
TLUpdates update = await SendRequestAsync<TLUpdates>(req);
return update;
}