public async Task <T> GetChatFullAsync <T>(TLAbsChat chat) { if (chat is TLChannel) { var c = ((TLChannel)chat); if (c.access_hash == null) { throw new NullReferenceException("Access Hash for channel is null"); } return(await SendRequestAsync <T>(new TLRequestGetFullChannel() { channel = new TLInputChannel() { access_hash = c.access_hash.Value, channel_id = c.id } })); } if (chat is TLChat) { return(await SendRequestAsync <T>(new TLRequestGetFullChat() { chat_id = ((TLChat)chat).id })); } //invalid type throw new ArgumentException("Argument must be TLChat or TLChannel", nameof(chat)); }
//**********************************************************// //** Below is Group routines **// //**********************************************************// // Find a specified group Name and return ots ID private static int GetGroupIdByName(string gname, out long hash) { hash = 0; TLAbsChat ch = null; TLDialogs dlgs = (TLDialogs)client.GetUserDialogsAsync().GetAwaiter().GetResult(); GroupsLogAndSave(dlgs.Chats, @"groups.txt", gname); ch = dlgs.Chats .Where(c => c.GetType() == typeof(TLChannel)) .Cast <TLChannel>() .FirstOrDefault(c => c.Title == gname); if (null != ch) { hash = (long)((TLChannel)ch).AccessHash; return(((TLChannel)ch).Id); } ch = dlgs.Chats .Where(c => c.GetType() == typeof(TLChat)) .Cast <TLChat>() .FirstOrDefault(c => c.Title == gname); return((null != ch) ? ((TLChat)ch).Id : 0); }
public override void DeserializeBody(BinaryReader br) { Chat = (TLAbsChat)ObjectUtils.DeserializeObject(br); }
private static async Task <Tuple <bool?, string, long> > FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot3( TLAbsChat x4, TLAbsInputPeer u, TelegramBotAbstract telegramBotAbstract) { if (x4 == null) { return(null); } if (x4 is TLChat x5) { if (GlobalVariables.ExcludedChatsForBot.Contains(x5.Id)) { return(new Tuple <bool?, string, long>(null, x5.Title, x5.Id)); } var r5 = await FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot4(x5, u, telegramBotAbstract); if (r5 == null) { return(new Tuple <bool?, string, long>(null, x5.Title, x5.Id)); } if (r5.Item2 == null) { return(new Tuple <bool?, string, long>(r5.Item1, x5.Title, x5.Id)); } WaitUntil(r5.Item2); var r6 = await FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot4(x5, u, telegramBotAbstract); if (r6 == null) { ; return(new Tuple <bool?, string, long>(null, x5.Title, x5.Id)); } if (r6.Item2 == null) { return(new Tuple <bool?, string, long>(r6.Item1, x5.Title, x5.Id)); } ; } else if (x4 is TLChannel x6) { if (GlobalVariables.ExcludedChatsForBot.Contains(x6.Id)) { return(new Tuple <bool?, string, long>(null, x6.Title, x6.Id)); } var r2 = await FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot5(x6, u, telegramBotAbstract); if (r2 == null) { ; return(new Tuple <bool?, string, long>(null, x6.Title, x6.Id)); } if (r2.Item2 == null) { return(new Tuple <bool?, string, long>(r2.Item1, x6.Title, x6.Id)); } WaitUntil(r2.Item2); var r3 = await FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot5(x6, u, telegramBotAbstract); if (r3 == null) { ; return(new Tuple <bool?, string, long>(null, x6.Title, x6.Id)); } if (r3.Item2 == null) { return(new Tuple <bool?, string, long>(r3.Item1, x6.Title, x6.Id)); } ; } else if (x4 is TLChatForbidden chatForbidden) { ; } else { ; } return(null); }
public virtual void setChat(TLAbsChat chat) { this.chat = chat; }
public override void deserializeBody(InputStream stream, TLContext context) { base.deserializeBody(stream, context); this.chat = StreamingUtils.readTLObject(stream, context); }