Skip to content

Commit

Permalink
Merge pull request #201 from devFelicity/develop
Browse files Browse the repository at this point in the history
feat(s24): TFS update
  • Loading branch information
MoonieGZ authored Jun 19, 2024
2 parents 062167c + 4dc1d4f commit 4ad4206
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore Felicity/Felicity.csproj
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Felicity/Felicity.csproj", "Felicity/"]
RUN dotnet restore "Felicity/Felicity.csproj"
Expand Down
46 changes: 36 additions & 10 deletions Felicity/DiscordCommands/Interactions/CraftingCommands.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using System.Text;
using System.Diagnostics.Eventing.Reader;
using System.Text;
using Discord;
using Discord.Interactions;
using DotNetBungieAPI.Extensions;
using DotNetBungieAPI.HashReferences;
using DotNetBungieAPI.Models;
using DotNetBungieAPI.Models.Authorization;
using DotNetBungieAPI.Models.Destiny;
using DotNetBungieAPI.Models.Destiny.Components;
using DotNetBungieAPI.Models.Destiny.Definitions.InventoryItems;
using DotNetBungieAPI.Models.Destiny.Definitions.Records;
using DotNetBungieAPI.Models.Destiny.Responses;
Expand Down Expand Up @@ -157,11 +160,7 @@ public async Task Recipes(
DestinyComponentType.ProfileInventories
}, user.GetTokenData());

var deepDeepsight = await IsDeepsightAvailable(8721509,
user.DestinyMembershipType, user.DestinyMembershipId, user.GetTokenData(),
request.Response.Characters.Data.Keys.First());

var wishDeepsight = await IsDeepsightAvailable(1251298789,
var failsafeDeepsight = await IsDeepsightAvailable(DefinitionHashes.Vendors.SeasonalEngramDecoding,
user.DestinyMembershipType, user.DestinyMembershipId, user.GetTokenData(),
request.Response.Characters.Data.Keys.First());

Expand Down Expand Up @@ -203,7 +202,35 @@ public async Task Recipes(
_bungieClient.Repository.TryGetDestinyDefinition<DestinyRecordDefinition>(weaponId,
out var manifestRecord);

var record = request.Response.ProfileRecords.Data.Records[weaponId];
DestinyRecordComponent? record = null;
var characterWeapons = new List<uint>
{
DefinitionHashes.Records.FaithKeeper,
DefinitionHashes.Records.IllOmen,
DefinitionHashes.Records.SightlineSurvey,
DefinitionHashes.Records.TimewornWayfarer,
DefinitionHashes.Records.VeiledThreat
};

if (characterWeapons.Contains(weaponId))
{
foreach (var characterKey in request.Response.Characters.Data.Keys)
{
if (!request.Response.CharacterRecords.Data[characterKey].Records.ContainsKey(weaponId))
continue;

record = request.Response.CharacterRecords.Data[characterKey].Records[weaponId];
break;
}
}
else
{
record = request.Response.ProfileRecords.Data.Records[weaponId];
}

if (record == null)
continue;

var obj = record.Objectives.First();

if (obj.IsComplete)
Expand All @@ -226,7 +253,7 @@ public async Task Recipes(
field.Value += $"\n > `{obj.Progress}/{obj.CompletionValue}`";
}

if ((keyValuePair.Key is "Deep" && deepDeepsight) || (keyValuePair.Key is "Wish" && wishDeepsight))
if (keyValuePair.Key is "Failsafe" && failsafeDeepsight)
{
if (field.Value.ToString()!.Contains("⚠️"))
field.Value += "💰 ";
Expand Down Expand Up @@ -302,8 +329,7 @@ private async Task<bool> IsDeepsightAvailable(uint vendorId, BungieMembershipTyp

var categoryIndex = vendorId switch
{
8721509 => 1,
1251298789 => 1,
908390552 => 1,
_ => 0
};

Expand Down
4 changes: 2 additions & 2 deletions Felicity/DiscordCommands/Interactions/LookupCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private static async Task<Embed> GenerateLookupEmbed(BungieResponse<DestinyProfi
DefinitionHashes.Collectibles.IzanagisBurden,
DefinitionHashes.Collectibles.LegendofAcrius,
DefinitionHashes.Collectibles.LeviathansBreath,
DefinitionHashes.Collectibles.OutbreakPerfected,
DefinitionHashes.Collectibles.OutbreakPerfected_449896716,
DefinitionHashes.Collectibles.Parasite,
DefinitionHashes.Collectibles.Riskrunner,
DefinitionHashes.Collectibles.SleeperSimulant,
Expand All @@ -278,7 +278,7 @@ private static async Task<Embed> GenerateLookupEmbed(BungieResponse<DestinyProfi
DefinitionHashes.Collectibles.TractorCannon,
DefinitionHashes.Collectibles.Witherhoard,
DefinitionHashes.Collectibles.Xenophage,
DefinitionHashes.Collectibles.WhisperoftheWorm,
DefinitionHashes.Collectibles.WhisperoftheWorm_545218287,
DefinitionHashes.Collectibles.AeonSafe,
DefinitionHashes.Collectibles.AeonSoul,
DefinitionHashes.Collectibles.AeonSwift,
Expand Down
36 changes: 18 additions & 18 deletions Felicity/Felicity.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>581e6930-6463-4c70-a3cb-9932d090442e</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Discord.Net" Version="3.13.0" />
<PackageReference Include="DotNetBungieAPI" Version="2.12.2" />
<PackageReference Include="Discord.Net" Version="3.15.2" />
<PackageReference Include="DotNetBungieAPI" Version="2.12.3" />
<PackageReference Include="DotNetBungieAPI.AspNet.Security.OAuth.Providers" Version="1.0.2" />
<PackageReference Include="DotNetBungieAPI.DefinitionProvider.Sqlite" Version="1.5.3" />
<PackageReference Include="DotNetBungieAPI.HashReferences" Version="1.22.1" />
<PackageReference Include="DotNetBungieAPI.Models" Version="2.11.3" />
<PackageReference Include="DotNetBungieAPI.Service.Abstractions" Version="2.11.1" />
<PackageReference Include="Fergun.Interactive" Version="1.7.3" />
<PackageReference Include="DotNetBungieAPI.DefinitionProvider.Sqlite" Version="1.5.4" />
<PackageReference Include="DotNetBungieAPI.HashReferences" Version="1.23.0" />
<PackageReference Include="DotNetBungieAPI.Models" Version="2.11.4" />
<PackageReference Include="DotNetBungieAPI.Service.Abstractions" Version="2.11.2" />
<PackageReference Include="Fergun.Interactive" Version="1.7.7" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Sentry.AspNetCore" Version="3.41.3" />
<PackageReference Include="Sentry.Serilog" Version="3.41.3" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<PackageReference Include="Sentry.AspNetCore" Version="4.7.0" />
<PackageReference Include="Sentry.Serilog" Version="4.7.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="TwitchLib" Version="3.5.3" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Felicity/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Felicity": {
"commandName": "Project",
"workingDirectory": "bin/Debug/net6.0",
"workingDirectory": "bin/Debug/net8.0",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -16,7 +16,7 @@
},
"WSL": {
"commandName": "WSL2",
"workingDirectory": "{ProjectDir}/bin/Debug/net6.0",
"workingDirectory": "{ProjectDir}/bin/Debug/net8.0",
"launchUrl": "https://localhost:4259",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
Expand Down
3 changes: 3 additions & 0 deletions Felicity/Services/Hosted/DiscordStartupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ private static async Task OnSlashCommandExecuted(SlashCommandInfo arg1, IInterac

var errorMessage = $"{result.Error}: {result.ErrorReason}";

if(result is ExecuteResult eResult)
errorMessage = $"{eResult.Exception.InnerException!.GetType()}: {eResult.Exception.InnerException!.Message}";

errorEmbed.AddField("Command", $"```{options!.Name}```");
errorEmbed.AddField("Parameters", $"```{JsonSerializer.Serialize(debugOptions)}```");
errorEmbed.AddField("Error", $"```{errorMessage}```");
Expand Down
Loading

0 comments on commit 4ad4206

Please sign in to comment.