Beispiel #1
0
 static UserAccounts()
 {
     if (Datastorage.SaveExists(accountsfile))
     {
         accounts = Datastorage.LoadUserAccounts(accountsfile).ToList();
     }
     else
     {
         accounts = new List <UserAccount>();
         SaveAccounts();
     }
 }
Beispiel #2
0
        public static UserAccount GetAccount(SocketUser user, SocketGuild guild)
        {
            var accountsFile = $"Data/UserData/{guild.Id}/{user.Id}.json";

            if (Datastorage.SaveExists(accountsFile))
            {
                Accounts = Datastorage.LoadUserAccounts(accountsFile).ToList();
            }
            else
            {
                Directory.CreateDirectory($"Data/UserData/{guild.Id}");
                Accounts = new List <UserAccount>();
                SaveAccounts(user, guild);
            }
            return(GetOrCreateAccount(user.Id));
        }
Beispiel #3
0
        public async Task allUsers()
        {
            UserAccount.UserAccount useraccount = new UserAccount.UserAccount();
            var GuildUser = await((IGuild)Context.Guild).GetUserAsync(Context.User.Id);

            if (admins.Contains(GuildUser.Id))
            {
                Console.WriteLine(Datastorage.LoadUserAccounts("Data/UserData/accounts.json"));
                foreach (object User in useraccount.ToString())
                {
                    var Id            = useraccount.ID;
                    var Level         = useraccount.Level;
                    var TimeConnected = useraccount.TimeConnected;
                    Console.WriteLine($"{Id}, {Level}, {TimeConnected}");
                }
            }
        }