Skip to content

Commit 6208528

Browse files
Merge pull request #23 from rarDevelopment/dev
updating discord helper lib
2 parents 6ec4b1c + 3ee0c55 commit 6208528

14 files changed

+58
-58
lines changed

TimeZoneBot/Commands/BirthdayAllCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public async Task BirthdayAllSlashCommand(
4343
.WithButton("Sort Alphabetically", $"birthdaySort:{BirthdaySortOrder.Alphabetical}",
4444
emote: new Emoji("🔤"));
4545

46-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Birthdays", message, Context.User), components: buttonBuilder.Build());
46+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Birthdays", message, Context.User), components: buttonBuilder.Build());
4747
}
4848

4949
private async Task<string> BuildAllBirthdaysMessage(IEnumerable<SocketGuildUser> members,
@@ -128,7 +128,7 @@ public async Task SortButton(string sortingTypeParam)
128128
await Context.Interaction.ModifyOriginalResponseAsync(properties =>
129129
{
130130
properties.Embed =
131-
_discordFormatter.BuildRegularEmbed($"Birthdays ({ParseSortByName(birthdaySortOrderType)})",
131+
_discordFormatter.BuildRegularEmbedWithUserFooter($"Birthdays ({ParseSortByName(birthdaySortOrderType)})",
132132
message, Context.User);
133133
});
134134
}

TimeZoneBot/Commands/BirthdayCommand.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,31 @@ public async Task BirthdaySlashCommand(
4141
var birthday = await _birthdayBusinessLayer.GetBirthdayForPerson(user.Id.ToString());
4242
if (birthday == null)
4343
{
44-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Error Finding Birthday",
44+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Error Finding Birthday",
4545
"Could not find birthday for person.", Context.User));
4646
return;
4747
}
4848

4949
var message = BuildBirthdayMessage(birthday.Value);
50-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed($"{user.GetNameToDisplay()}'s Birthday",
50+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter($"{user.GetNameToDisplay()}'s Birthday",
5151
message, Context.User));
5252
}
5353
catch (PersonNotFoundException ex)
5454
{
5555
_logger.LogError(ex, "PersonNotFound in BirthdaySlashCommand");
56-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Person Not Found",
56+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Person Not Found",
5757
"That person wasn't found!", Context.User));
5858
}
5959
catch (NoBirthdayException ex)
6060
{
6161
_logger.LogError(ex, "NoBirthday in BirthdaySlashCommand");
62-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Birthday Not Found",
62+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Birthday Not Found",
6363
"No birthday is configured for this person.", Context.User));
6464
}
6565
catch (Exception ex)
6666
{
6767
_logger.LogError(ex, "Unhandled error in BirthdaySlashCommand");
68-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Something Went Wrong",
68+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Something Went Wrong",
6969
"There was an unexpected error.", Context.User));
7070
}
7171
}
@@ -87,31 +87,31 @@ public async Task BirthdayMessageCommand(SocketMessage message)
8787
var birthdayForPerson = await _birthdayBusinessLayer.GetBirthdayForPerson(user.Id.ToString());
8888
if (birthdayForPerson == null)
8989
{
90-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Error Finding Time",
90+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Error Finding Time",
9191
"Could not find time for person.", Context.User));
9292
return;
9393
}
9494

9595
var messageToSend = BuildBirthdayMessage(birthdayForPerson.Value);
96-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed($"{user.GetNameToDisplay()}'s Birthday",
96+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter($"{user.GetNameToDisplay()}'s Birthday",
9797
messageToSend, Context.User));
9898
}
9999
catch (PersonNotFoundException ex)
100100
{
101101
_logger.LogError(ex, "PersonNotFound in BirthdayMessageCommand");
102-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Person Not Found",
102+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Person Not Found",
103103
"That person wasn't found!", Context.User));
104104
}
105105
catch (NoBirthdayException ex)
106106
{
107107
_logger.LogError(ex, "NoBirthday in BirthdayMessageCommand");
108-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Birthday Not Found",
108+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Birthday Not Found",
109109
"No birthday is configured for this person.", Context.User));
110110
}
111111
catch (Exception ex)
112112
{
113113
_logger.LogError(ex, "Unhandled error in BirthdayMessageCommand");
114-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Something Went Wrong",
114+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Something Went Wrong",
115115
"There was an unexpected error.", Context.User));
116116
}
117117
}
@@ -126,31 +126,31 @@ public async Task BirthdayUserCommand(SocketUser user)
126126
var birthdayForPerson = await _birthdayBusinessLayer.GetBirthdayForPerson(user.Id.ToString());
127127
if (birthdayForPerson == null)
128128
{
129-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Error Finding Time",
129+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Error Finding Time",
130130
"Could not find time for person.", Context.User));
131131
return;
132132
}
133133

134134
var messageToSend = BuildBirthdayMessage(birthdayForPerson.Value);
135-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed($"{user.GetNameToDisplay()} 's Birthday",
135+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter($"{user.GetNameToDisplay()} 's Birthday",
136136
messageToSend, Context.User));
137137
}
138138
catch (PersonNotFoundException ex)
139139
{
140140
_logger.LogError(ex, "PersonNotFound in BirthdayUserCommand");
141-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Person Not Found",
141+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Person Not Found",
142142
"That person wasn't found!", Context.User));
143143
}
144144
catch (NoBirthdayException ex)
145145
{
146146
_logger.LogError(ex, "NoBirthday in BirthdayUserCommand");
147-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Birthday Not Found",
147+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Birthday Not Found",
148148
"No birthday is configured for this person.", Context.User));
149149
}
150150
catch (Exception ex)
151151
{
152152
_logger.LogError(ex, "Unhandled error in BirthdayUserCommand");
153-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Something Went Wrong",
153+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Something Went Wrong",
154154
"There was an unexpected error.", Context.User));
155155
}
156156
}

TimeZoneBot/Commands/SetBirthdayAnnouncementsEnabledCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public async Task SetReactionsEnabledSlashCommand(
4444
if (!wasSet)
4545
{
4646
_logger.LogError($"Failed to set EnableBirthdayAnnouncements to {isEnabled} - SetReactionsEnabled returned false.");
47-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Birthday Announcements Configuration",
47+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Failed to Set Birthday Announcements Configuration",
4848
"There was an error changing that setting.", Context.User));
4949
return;
5050
}
5151

52-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Birthday Announcements Configuration Set Successfully",
52+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Birthday Announcements Configuration Set Successfully",
5353
$"Birthday Announcements are **{(isEnabled ? "ON" : "OFF")}**", Context.User));
5454
}
5555
}

TimeZoneBot/Commands/SetBirthdayCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public async Task SetBirthdaySlashCommand(
4545
catch (Exception ex)
4646
{
4747
_logger.LogError(ex, "Failed to parse birthday from entered date");
48-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Birthday",
48+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Invalid Birthday",
4949
"The provided birthday was not valid.",
5050
member));
5151
return;
@@ -56,12 +56,12 @@ await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Birthday",
5656
if (!wasSet)
5757
{
5858
_logger.LogError($"Failed to set birthday to {birthdayDate} - SetBirthday returned false.");
59-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Time Zone",
59+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Failed to Set Time Zone",
6060
"There was an error setting the time zone.", Context.User));
6161
return;
6262
}
6363

64-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Birthday Set Successfully",
64+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Birthday Set Successfully",
6565
$"Birthday was successfully set to {birthdayDate}", Context.User));
6666
}
6767
}

TimeZoneBot/Commands/SetDefaultTimeZoneCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public async Task SetDefaultTimeZoneSlashCommand(
4343
var timeZone = DateTimeZoneProviders.Tzdb.GetZoneOrNull(timeZoneName);
4444
if (timeZone == null)
4545
{
46-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Time Zone",
46+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Invalid Time Zone",
4747
"The provided time zone was not valid. Please visit https://rardk64.com/timezones/ and set your time zone there, or copy it and set it here.",
4848
member));
4949
return;
@@ -54,12 +54,12 @@ await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Time Zone"
5454
if (!wasSet)
5555
{
5656
_logger.LogError($"Failed to set DefaultTimeZone to {timeZoneName} - SetDefaultTimeZone returned false.");
57-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Time Reactions Configuration",
57+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Failed to Set Time Reactions Configuration",
5858
"There was an error changing that setting.", Context.User));
5959
return;
6060
}
6161

62-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Default Time Zone Set Successfully",
62+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Default Time Zone Set Successfully",
6363
$"Server Default Time Zone is set to **{timeZoneName}**", Context.User));
6464
}
6565
}

TimeZoneBot/Commands/SetReactionsEnabledCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public async Task SetReactionsEnabledSlashCommand(
4444
if (!wasSet)
4545
{
4646
_logger.LogError($"Failed to set EnableReactions to {isEnabled} - SetReactionsEnabled returned false.");
47-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Time Reactions Configuration",
47+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Failed to Set Time Reactions Configuration",
4848
"There was an error changing that setting.", Context.User));
4949
return;
5050
}
5151

52-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Time Reactions Configuration Set Successfully",
52+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Time Reactions Configuration Set Successfully",
5353
$"Time Reactions are **{(isEnabled ? "ON" : "OFF")}**", Context.User));
5454
}
5555
}

TimeZoneBot/Commands/SetTimeZoneCommand.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task SetTimeZoneSlashCommand(
3838
var timeZone = DateTimeZoneProviders.Tzdb.GetZoneOrNull(timeZoneName);
3939
if (timeZone == null)
4040
{
41-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Time Zone",
41+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Invalid Time Zone",
4242
"The provided time zone was not valid. Please visit https://rardk64.com/timezones/ and set your time zone there, or copy it and set it here..",
4343
member));
4444
return;
@@ -49,7 +49,7 @@ await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Invalid Time Zone"
4949
if (!wasSet)
5050
{
5151
_logger.LogError($"Failed to set time zone with name {timeZoneName} - SetTimeZone returned false.");
52-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Time Zone",
52+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Failed to Set Time Zone",
5353
"There was an error setting the time zone.", Context.User));
5454
return;
5555
}
@@ -59,24 +59,24 @@ await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Failed to Set Time
5959
var time = await _timeZoneBusinessLayer.GetTimeForPerson(Context.User.Id.ToString());
6060
if (time == null)
6161
{
62-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Error Finding Time",
62+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Error Finding Time",
6363
"Could not find time for person.", Context.User));
6464
return;
6565
}
6666

67-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Time Zone Set Successfully",
67+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Time Zone Set Successfully",
6868
$"Time Zone was successfully set to {timeZoneName}, and the current time should be: {TimeHelpers.FormatTime(time.Value.TimeOfDay)}", Context.User));
6969
}
7070
catch (NoTimeZoneException ex)
7171
{
7272
_logger.LogError(ex, "NoTimeZone in SetTimeZoneCommand");
73-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Time Zone Not Found",
73+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Time Zone Not Found",
7474
"The associated time zone was not valid.", Context.User));
7575
}
7676
catch (Exception ex)
7777
{
7878
_logger.LogError(ex, "Unhandled error in SetTimeZoneCommand");
79-
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbed("Something Went Wrong",
79+
await FollowupAsync(embed: _discordFormatter.BuildErrorEmbedWithUserFooter("Something Went Wrong",
8080
"There was an unexpected error.", Context.User));
8181
}
8282
}

TimeZoneBot/Commands/TimeAllCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task TimeAllSlashCommand(
6262

6363
if (!string.IsNullOrEmpty(messageToSend))
6464
{
65-
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbed("Current Time for Everyone in this Channel",
65+
await FollowupAsync(embed: _discordFormatter.BuildRegularEmbedWithUserFooter("Current Time for Everyone in this Channel",
6666
messageToSend, Context.User));
6767
}
6868
}

0 commit comments

Comments
 (0)