예제 #1
0
        private void Selected(Int32 idUser)
        {
            FeaturedUserNew featured = db.GetFeaturedUsers(idUser);

            db._featuredUserNews.Remove(featured);
            db.Save();
            SelectedUser(featured.UserId);
        }
예제 #2
0
        public void SendMessage(TelegramBotClient botClient)
        {
            InlineButton inlineButton = new InlineButton();

            System.String temp = InfoUser.Search(userTwo, user);
            if (db._featuredUserNews.Any(p => p.UserId == userTwo.ID && p.UserWhoAddedId == user.ID))
            {
                if (user.IsAdmin > 0)
                {
                    botClient.EditMessage(user.ID, user.MessageID, temp, "39 - AddPhotoInDataBase", user, inlineButton.InteractionUsers(userTwo, true, db.GetFeaturedUsers(user, userTwo), isAdmin: true));
                }
                else
                {
                    botClient.EditMessage(user.ID, user.MessageID, temp, "39 - AddPhotoInDataBase", user, inlineButton.InteractionUsers(userTwo, true, db.GetFeaturedUsers(user, userTwo)));
                }
            }
            else
            {
                if (user.IsAdmin > 0)
                {
                    botClient.EditMessage(user.ID, user.MessageID, temp, "39 - AddPhotoInDataBase", user, inlineButton.InteractionUsers(userTwo, false, isAdmin: true));
                }
                else
                {
                    botClient.EditMessage(user.ID, user.MessageID, temp, "39 - AddPhotoInDataBase", user, inlineButton.InteractionUsers(userTwo, false));
                }
            }
        }
        public void SendMessage(TelegramBotClient botClient)
        {
            InlineButton inlineButton = new InlineButton();

            if (user.IsAdmin == 3)
            {
                botClient.EditMessage(_message.From.Id, user.MessageID, "Пользователь забанен на 2 дня!", "36 - LimitedUser", replyMarkup: inlineButton.InteractionUsers(userTwo, db._featuredUserNews.Any(p => p.UserId == userTwo.ID && p.UserWhoAddedId == user.ID), db.GetFeaturedUsers(user, userTwo), isAdmin: true));
            }
            else if (userTwo.IsAdmin != 3 && userTwo.IsAdmin != 2)
            {
                botClient.EditMessage(_message.From.Id, user.MessageID, "Пользователь забанен на 2 дня!", "36 - LimitedUser", replyMarkup: inlineButton.InteractionUsers(userTwo, db._featuredUserNews.Any(p => p.UserId == userTwo.ID && p.UserWhoAddedId == user.ID), db.GetFeaturedUsers(user, userTwo), isAdmin: true));
            }
            else
            {
                user.IsAdmin    = 0;
                userTwo.BanDate = System.DateTime.Today;
                if (user.BanDate.Date < System.DateTime.Today)
                {
                    user.BanDate = System.DateTime.Now;
                }
                user.BanDate = user.BanDate.AddDays(30);
                db.Save();
                Settings settings = db.GetSettings();
                IsBanUser.ThisBan(botClient, _message, user, settings);

                System.String temp = "Администратор " + user.IsAdmin + " уровня: @" + user.Username + " пытался забанить другого администратора " + "\nID: " + userTwo.ID + "\nФИО: " + userTwo.FIO + "\nНомер: " + user.Number + "\nС данного администратора снята админка, так же он был забанен во всех чатах! Если бан был выдан случайно пропишите /UbBan " + user.ID;

                Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup answer = inlineButton.AdminPanelAppeal(_message, user.ID, _message.Data);
                botClient.SendText(settings.ChannelAdmin, temp, replyMarkup: answer);
            }
        }
        internal void SendMessage(TelegramBotClient botClient, Message _message)
        {
            DataBase db = Singleton.GetInstance().Context;

            Settings settings = db.GetSettings();

            InlineButton inlineBatton = new InlineButton();

            System.String temp = InfoUser.Search(userTwo, user);

            botClient.DeleteMessage(_message.From.Id, _message.MessageId, "33 - MessageUserBot");
            if (user.IsAdmin > 0)
            {
                botClient.EditMessage(_message.From.Id, user.MessageID, temp, "45 - MessageUserBot", user, replyMarkup: inlineBatton.InteractionUsers(userTwo, db._featuredUserNews.Any(p => p.UserId == userTwo.ID && p.UserWhoAddedId == user.ID), db.GetFeaturedUsers(user, userTwo), isAdmin: true));
            }
            else
            {
                botClient.EditMessage(_message.From.Id, user.MessageID, temp, "45 - MessageUserBot", user, replyMarkup: inlineBatton.InteractionUsers(userTwo, db._featuredUserNews.Any(p => p.UserId == userTwo.ID && p.UserWhoAddedId == user.ID), db.GetFeaturedUsers(user, userTwo), isAdmin: false));
            }
        }