mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-25 01:44:12 +00:00
Add time zone to export, implements #4
This commit is contained in:
parent
36526e07fc
commit
5ef7505a94
1 changed files with 9 additions and 3 deletions
|
@ -221,7 +221,8 @@ public class BirthdayModule : BotModuleBase {
|
||||||
select new {
|
select new {
|
||||||
UserId = (ulong)row.UserId,
|
UserId = (ulong)row.UserId,
|
||||||
Month = row.BirthMonth,
|
Month = row.BirthMonth,
|
||||||
Day = row.BirthDay
|
Day = row.BirthDay,
|
||||||
|
Zone = row.TimeZone
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = new List<ListItem>();
|
var result = new List<ListItem>();
|
||||||
|
@ -234,7 +235,8 @@ public class BirthdayModule : BotModuleBase {
|
||||||
BirthDay = row.Day,
|
BirthDay = row.Day,
|
||||||
DateIndex = DateIndex(row.Month, row.Day),
|
DateIndex = DateIndex(row.Month, row.Day),
|
||||||
UserId = guildUser.Id,
|
UserId = guildUser.Id,
|
||||||
DisplayName = Common.FormatName(guildUser, false)
|
DisplayName = Common.FormatName(guildUser, false),
|
||||||
|
TimeZone = row.Zone
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -254,6 +256,7 @@ public class BirthdayModule : BotModuleBase {
|
||||||
writer.Write(item.UserId);
|
writer.Write(item.UserId);
|
||||||
writer.Write(" " + user.Username + "#" + user.Discriminator);
|
writer.Write(" " + user.Username + "#" + user.Discriminator);
|
||||||
if (user.Nickname != null) writer.Write(" - Nickname: " + user.Nickname);
|
if (user.Nickname != null) writer.Write(" - Nickname: " + user.Nickname);
|
||||||
|
if (item.TimeZone != null) writer.Write(" | Time zone: " + item.TimeZone);
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
|
@ -267,7 +270,7 @@ public class BirthdayModule : BotModuleBase {
|
||||||
var writer = new StreamWriter(result, Encoding.UTF8);
|
var writer = new StreamWriter(result, Encoding.UTF8);
|
||||||
|
|
||||||
// Conforming to RFC 4180; with header
|
// Conforming to RFC 4180; with header
|
||||||
writer.Write("UserId,Username,Nickname,MonthDayDisp,Month,Day");
|
writer.Write("UserId,Username,Nickname,MonthDayDisp,Month,Day,TimeZone");
|
||||||
writer.Write("\r\n"); // crlf line break is specified by the standard
|
writer.Write("\r\n"); // crlf line break is specified by the standard
|
||||||
foreach (var item in list) {
|
foreach (var item in list) {
|
||||||
var user = guild.GetUser(item.UserId);
|
var user = guild.GetUser(item.UserId);
|
||||||
|
@ -283,6 +286,8 @@ public class BirthdayModule : BotModuleBase {
|
||||||
writer.Write(item.BirthMonth);
|
writer.Write(item.BirthMonth);
|
||||||
writer.Write(',');
|
writer.Write(',');
|
||||||
writer.Write(item.BirthDay);
|
writer.Write(item.BirthDay);
|
||||||
|
writer.Write(',');
|
||||||
|
writer.Write(item.TimeZone);
|
||||||
writer.Write("\r\n");
|
writer.Write("\r\n");
|
||||||
}
|
}
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
|
@ -325,6 +330,7 @@ public class BirthdayModule : BotModuleBase {
|
||||||
public int BirthDay;
|
public int BirthDay;
|
||||||
public ulong UserId;
|
public ulong UserId;
|
||||||
public string DisplayName;
|
public string DisplayName;
|
||||||
|
public string? TimeZone;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
Loading…
Reference in a new issue