コード例 #1
0
        public async Task AddUserArchievement(SocketUser user, [Remainder] string archievement)
        {
            UserArchievements account = UsersArchievements.GetUserArchievements(user.Id);

            account.Archievements.Add(archievement);

            UsersArchievements.Save();

            await Context.Channel.SendMessageAsync($"Dodano osiągnięcie: {archievement} Użytkownikowi {user.Mention}");
        }
コード例 #2
0
        private static UserArchievements CreateUserArchievements(ulong id)
        {
            UserArchievements ua = new UserArchievements()
            {
                ID            = id,
                Archievements = new List <string>()
            };

            _usersArchievements.Add(ua);
            Save();

            return(ua);
        }
コード例 #3
0
        private static UserArchievements GetOrCreateUserArchievements(ulong id)
        {
            var result = from u in _usersArchievements
                         where u.ID == id
                         select u;

            UserArchievements userArchievements = result.FirstOrDefault();

            if (userArchievements == null)
            {
                return(CreateUserArchievements(id));
            }

            return(userArchievements);
        }
コード例 #4
0
        public async Task CheckStatus(SocketUser user = null)
        {
            if (user == null)
            {
                user = Context.User;
            }

            UserExpMute       userExp        = UsersExpMute.GetExpMute(user.Id);
            UserPraises       uPraises       = UsersPraises.GetUserPraises(user.Id);
            UserArchievements uArchievements = UsersArchievements.GetUserArchievements(user.Id);
            UserWarnings      accountWarns   = UsersWarnings.GetUserWarnings(user);

            Methods.DeleteExpiredWarnings(accountWarns);

            string archievements = "Osiągnięcia:\n";

            foreach (string item in uArchievements.Archievements)
            {
                archievements += $"{item}\n";
            }

            await Context.Channel.SendMessageAsync($"{user.Username} ma {userExp.LevelNumber} lvl, {userExp.XP} xp. Został pochwalony {uPraises.Praises.Count} razy oraz otrzymał {accountWarns.Warnings.Count} ostrzeżeń.\n{archievements}");
        }