Skip to content

Commit 2a3fe6e

Browse files
committed
minor update to the half mast command
1 parent c2c0f64 commit 2a3fe6e

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

src/FischBot/FischBot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
44
<TargetFramework>net6.0</TargetFramework>
5-
<AssemblyVersion>0.4.4</AssemblyVersion>
6-
<Version>0.4-dragonfish-rev4</Version>
5+
<AssemblyVersion>0.4.5</AssemblyVersion>
6+
<Version>0.4-dragonfish-rev5</Version>
77
<Deterministic>false</Deterministic>
88
</PropertyGroup>
99
<ItemGroup>

src/FischBot/Modules/HalfMastModule.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public HalfMastModule(IDiscordModuleService moduleService, IHalfMastService half
2525

2626
if (halfMastStatus.IsHalfStaff)
2727
{
28-
var embedTitle = CreateHalfMastInfoEmbedTitle(halfMastStatus.State);
28+
var embedTitle = CreateHalfMastInfoEmbedTitle(halfMastStatus.State, halfMastStatus.IsHalfStaff);
2929
var embedBuilder = new EmbedBuilder()
3030
.WithTitle(embedTitle)
3131
.WithDescription(halfMastStatus.Description)
@@ -36,26 +36,39 @@ public HalfMastModule(IDiscordModuleService moduleService, IHalfMastService half
3636
}
3737
else
3838
{
39-
if (string.IsNullOrEmpty(stateAbbreviation))
40-
{
41-
await RespondAsync($"I couldn't find any recent half mast alerts for the entire US.");
42-
}
43-
else
44-
{
45-
await RespondAsync($"I couldn't find any recent half mast alerts for {stateAbbreviation.ToUpper()}.");
46-
}
39+
var embedTitle = CreateHalfMastInfoEmbedTitle(halfMastStatus.State, halfMastStatus.IsHalfStaff);
40+
var embedBuilder = new EmbedBuilder()
41+
.WithTitle(embedTitle)
42+
.WithFooter($"Source: {halfMastStatus.SourceUrl}",
43+
$"https://raw.githubusercontent.com/flyingfisch/FischBotDiscord-csharp/master/assets/us-flag.png");
44+
45+
await RespondAsync(embed: embedBuilder.Build());
4746
}
4847
}
4948

50-
private string CreateHalfMastInfoEmbedTitle(string state)
49+
private string CreateHalfMastInfoEmbedTitle(string state, bool isHalfMast)
5150
{
52-
if (string.IsNullOrEmpty(state))
51+
if (isHalfMast)
5352
{
54-
return "The flag is at half mast";
53+
if (string.IsNullOrEmpty(state))
54+
{
55+
return $"The flag is at half mast";
56+
}
57+
else
58+
{
59+
return $"The flag is at half mast in {state}";
60+
}
5561
}
5662
else
5763
{
58-
return $"The flag is at half mast in {state}";
64+
if (string.IsNullOrEmpty(state))
65+
{
66+
return $"The flag is not at half mast";
67+
}
68+
else
69+
{
70+
return $"The flag is not at half mast in {state}";
71+
}
5972
}
6073
}
6174
}

0 commit comments

Comments
 (0)