Exemplo n.º 1
0
        public async Task ResetServer()
        {
            IUserMessage message = await ReplyAsync("Reseting...");

            DiscordServer server = DiscordServer.GetServerFromID(Context.Guild.Id);

            if (server != null)
            {
                server.Users = new List <ServerUser>();
                foreach (SocketGuildUser user in server.Guild.Users)
                {
                    if (server.Users.Find(x => x.userID == user.Id) == null)
                    {
                        server.Users.Add(new ServerUser(user));
                    }
                }
            }
            else
            {
                await message.ModifyAsync(x => x.Content = "I dont think i did it right.");
            }

            server.SaveData();
            server.LoadData();
            await message.ModifyAsync(x => x.Content = "L-Like this?");
        }
Exemplo n.º 2
0
        public void SaveAndLoad()
        {
            DiscordServer server = DiscordServer.GetServerFromID(Context.Guild.Id);

            if (server != null)
            {
                server.SaveData();
                server.LoadData();
            }
            else
            {
                Program.discordServers.Add(new DiscordServer(Context.Guild));
            }
        }