Beispiel #1
0
        public async Task MarkChatMessagesAsReadAsync(TLAbsInputChannel channel)
        {
            var r = new TeleSharp.TL.Channels.TLRequestReadHistory
            {
                channel = channel,
                max_id  = 0
            };

            await _telegramClient.SendRequestAsync <object>(r);
        }
Beispiel #2
0
 public override void deserializeBody(InputStream stream, TLContext context)
 {
     this.flags             = StreamingUtils.readInt(stream);
     base.id                = StreamingUtils.readInt(stream);
     this.title             = StreamingUtils.readTLString(stream);
     this.photo             = StreamingUtils.readTLObject(stream, context);
     this.participantsCount = StreamingUtils.readInt(stream);
     this.date              = StreamingUtils.readInt(stream);
     this.version           = StreamingUtils.readInt(stream);
     if ((this.flags & 0x40) != 0)
     {
         this.migratedTo = StreamingUtils.readTLObject(stream, context);
     }
 }
        private static TLInputChannel GetChannel(TLAbsInputChannel channel)
        {
            if (channel == null)
            {
                return(null);
            }

            if (channel is TLInputChannel c2)
            {
                return(c2);
            }

            return(null);
        }
Beispiel #4
0
 public override void DeserializeBody(BinaryReader br)
 {
     Flags             = br.ReadInt32();
     Creator           = (Flags & 1) != 0;
     Kicked            = (Flags & 2) != 0;
     Left              = (Flags & 4) != 0;
     AdminsEnabled     = (Flags & 8) != 0;
     Admin             = (Flags & 16) != 0;
     Deactivated       = (Flags & 32) != 0;
     Id                = br.ReadInt32();
     Title             = StringUtil.Deserialize(br);
     Photo             = (TLAbsChatPhoto)ObjectUtils.DeserializeObject(br);
     ParticipantsCount = br.ReadInt32();
     Date              = br.ReadInt32();
     Version           = br.ReadInt32();
     if ((Flags & 64) != 0)
     {
         MigratedTo = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br);
     }
     else
     {
         MigratedTo = null;
     }
 }
Beispiel #5
0
 public virtual void setMigratedTo(TLAbsInputChannel migratedTo)
 {
     this.migratedTo = migratedTo;
 }
        private static async Task <Tuple <bool?, DateTime?> > FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot4(
            TLChat x5, TLAbsInputPeer u, TelegramBotAbstract telegramBotAbstract)
        {
            if (x5 == null)
            {
                return(null);
            }

            ;

            ;

            if (x5.MigratedTo == null)
            {
                var r4 = await FixTheFactThatSomeGroupsDoesNotHaveOurModerationBot6Async(x5, u, telegramBotAbstract);

                return(r4);
            }

            var            x6 = x5.MigratedTo;
            TLInputChannel x8 = null;

            if (x6 is TLInputChannel x7)
            {
                x8 = x7;
            }
            else
            {
                ;
                return(null);
            }

            if (x5.MigratedTo == null)
            {
                return(null);
            }

            TLAbsInputChannel channel = x8;
            TLChatFull        x       = null;

            var channel2 = GetChannel(channel);

            if (channel2 == null)
            {
                return(new Tuple <bool?, DateTime?>(false, null));
            }

            var isOurBotPresent2 = await CheckIfOurBotIsPresent2Async(channel2, telegramBotAbstract);

            if (isOurBotPresent2 == null)
            {
                return(new Tuple <bool?, DateTime?>(false, null));
            }

            if (isOurBotPresent2.Item2 != null)
            {
                return(new Tuple <bool?, DateTime?>(null, isOurBotPresent2.Item2));
            }

            if (isOurBotPresent2.Item1 != null && isOurBotPresent2.Item1.Value)
            {
                return(new Tuple <bool?, DateTime?>(true, null));
            }

            var r3 = await InsertOurBotAsyncChat(x5, u, x8.AccessHash, telegramBotAbstract);

            return(new Tuple <bool?, DateTime?>(r3, null));
        }