public static void SetBirthday(ulong userID, DateTime day) { // Well that's a lot easier than looping each time, these could prove useful to fully understand. Date oldDate = birthdays.Find(x => x.userID == userID); Date newDate; newDate = new Date(userID, day); birthdays.Remove(oldDate); birthdays.Add(newDate); UserConfiguration.SetSetting(userID, "Birthday", newDate); }
public Task OnMinutePassed(DateTime time) { if (birthdays != null) { foreach (Date date in birthdays) { // userID = 0 if the user hasn't set a date. if (date.userID == 0) { continue; } DateTime dateThisYear = new DateTime(DateTime.Now.Year, date.day.Month, date.day.Day, date.day.Hour, date.day.Minute, date.day.Second); if (DateTime.Now > dateThisYear && date.lastPassedYear != DateTime.Now.Year) { AnnounceBirthday(date); date.lastPassedYear = DateTime.Now.Year; UserConfiguration.SetSetting(date.userID, "Birthday", date); } } } return(Task.CompletedTask); }
public Task <Result> Execute(SocketUserMessage e, CultureInfo info) { UserConfiguration.SetSetting(e.Author.Id, "Culture", info); return(TaskResult(info, "Successfully sat culture to " + info.DisplayName)); }