diff --git a/Behavior/GeneralSnarkCloudNative.cs b/Behavior/GeneralSnarkCloudNative.cs index 0eceb7b..90db765 100644 --- a/Behavior/GeneralSnarkCloudNative.cs +++ b/Behavior/GeneralSnarkCloudNative.cs @@ -22,7 +22,7 @@ public class GeneralSnarkCloudNative : Behavior if(Behaver.Instance.IsSelf(message.Author.Id)) return false; - if(message.Channel.EffectivePermissions.ReactionsPossible) + if(!message.Channel.EffectivePermissions.ReactionsPossible) return false; if((MeannessFilterLevel)message.Channel.EffectivePermissions.MeannessFilterLevel < MeannessFilterLevel.Medium) diff --git a/Behavior/GeneralSnarkMisspellDefinitely.cs b/Behavior/GeneralSnarkMisspellDefinitely.cs index 28425c2..0c32d6e 100644 --- a/Behavior/GeneralSnarkMisspellDefinitely.cs +++ b/Behavior/GeneralSnarkMisspellDefinitely.cs @@ -42,7 +42,7 @@ public class GeneralSnarkMisspellDefinitely : Behavior foreach(var k in snarkmap.Keys) { - if( Regex.IsMatch(message.Content, "\\b"+k+"\\b", RegexOptions.IgnoreCase)) + if( Regex.IsMatch(message.Content?.ToLower(), "\\b"+k+"\\b", RegexOptions.IgnoreCase)) return true; } return false; diff --git a/Conversion/Converter.cs b/Conversion/Converter.cs index b3b0ec3..e18d377 100644 --- a/Conversion/Converter.cs +++ b/Conversion/Converter.cs @@ -112,7 +112,7 @@ namespace vassago.Conversion accumulator = reverseConversion.Item4(accumulator); } } - if (normalizedDestUnit == currencyConf.Base || currencyConf.rates.Select(r => r.Key).Contains(normalizedDestUnit)) + if (currencyConf != null && (normalizedDestUnit == currencyConf.Base || currencyConf.rates.Select(r => r.Key).Contains(normalizedDestUnit))) { return $"{String.Format("approximately {0:0.00}", accumulator)} {normalizedDestUnit} as of {currencyConf.DateUpdated.ToLongDateString()}"; } diff --git a/Models/User.cs b/Models/User.cs index 92437b4..bd0ed03 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -11,6 +11,9 @@ public class User public Guid Id { get; set; } public List Accounts { get; set; } + //if I ever get lots and lots of tags, or some automatic way to register a feature's arbitrary tags, then I can move this off. + //public bool Tag_CanTwitchSummon { get; set; } + public string DisplayName { get diff --git a/ProtocolInterfaces/DiscordInterface/DiscordInterface.cs b/ProtocolInterfaces/DiscordInterface/DiscordInterface.cs index 38031ed..6234548 100644 --- a/ProtocolInterfaces/DiscordInterface/DiscordInterface.cs +++ b/ProtocolInterfaces/DiscordInterface/DiscordInterface.cs @@ -138,10 +138,9 @@ public class DiscordInterface var mentionOfMe = "<@" + client.CurrentUser.Id + ">"; m.MentionsMe = true; } - if (await Behaver.Instance.ActOn(m)) - { - m.ActedOn = true; - } + await Behaver.Instance.ActOn(m); + m.ActedOn = true; // for its own ruposess it might act on it later, but either way, fuck it, we checked. + _db.SaveChanges(); } diff --git a/ProtocolInterfaces/DiscordInterface/SlashCommandsHelper.cs b/ProtocolInterfaces/DiscordInterface/SlashCommandsHelper.cs index 2f3ceda..95ad279 100644 --- a/ProtocolInterfaces/DiscordInterface/SlashCommandsHelper.cs +++ b/ProtocolInterfaces/DiscordInterface/SlashCommandsHelper.cs @@ -16,7 +16,7 @@ namespace vassago.DiscordInterface new CommandSetup(){ Id = "freedomunits", UpdatedAt = new DateTime(2023, 5, 21, 13, 3, 0), - guild = 825293851110801428, + guild = 825293851110801428, //TODO: demagic this magic number register = register_FreedomUnits } }; diff --git a/WebInterface/Controllers/UsersController.cs b/WebInterface/Controllers/UsersController.cs index 6847b78..ae37360 100644 --- a/WebInterface/Controllers/UsersController.cs +++ b/WebInterface/Controllers/UsersController.cs @@ -24,8 +24,16 @@ public class UsersController : Controller } public async Task Details(Guid id) { + var user = await _db.Users + .Include(u => u.Accounts) + .FirstAsync(u => u.Id == id); + var allTheChannels = await _db.Channels.ToListAsync(); + foreach(var acc in user.Accounts) + { + acc.SeenInChannel = allTheChannels.FirstOrDefault(c => c.Id == acc.SeenInChannel.Id); + } return _db.Users != null ? - View(await _db.Users.Include(u => u.Accounts).FirstAsync(u => u.Id == id)) : + View(user) : Problem("Entity set '_db.Users' is null."); } diff --git a/WebInterface/Views/Channels/Details.cshtml b/WebInterface/Views/Channels/Details.cshtml index ab338a8..442089c 100644 --- a/WebInterface/Views/Channels/Details.cshtml +++ b/WebInterface/Views/Channels/Details.cshtml @@ -23,7 +23,7 @@ Lewdness Filter Level - ⤵ inherited - @Enumerations.GetDescription(IfInheritedLewdnessFilterLevel) @foreach (Enumerations.LewdnessFilterLevel enumVal in Enum.GetValues(typeof(Enumerations.LewdnessFilterLevel))) @@ -53,7 +53,7 @@ Meanness Filter Level - ⤵ inherited - @Enumerations.GetDescription(IfInheritedMeannessFilterLevel) @foreach (Enumerations.MeannessFilterLevel enumVal in Enum.GetValues(typeof(Enumerations.MeannessFilterLevel))) @@ -81,7 +81,7 @@ @(ThisChannel.SubChannels?.Count ?? 0) - Users + Accounts @(ThisChannel.Users?.Count ?? 0) @@ -109,5 +109,12 @@ console.log(channelNow); return channelNow; } + function getTree() { + var tree = @Html.Raw(ViewData["treeString"]); + console.log(tree); + return tree; + } + + $('#tree').bstreeview({ data: getTree() }); } \ No newline at end of file diff --git a/WebInterface/Views/Users/Details.cshtml b/WebInterface/Views/Users/Details.cshtml index bbda543..d127af4 100644 --- a/WebInterface/Views/Users/Details.cshtml +++ b/WebInterface/Views/Users/Details.cshtml @@ -1,21 +1,86 @@ @model User +@using Newtonsoft.Json +@using System.Text @{ ViewData["Title"] = "User details"; } + + + + + + + + + + + + +
+
+
+
+
+placeholderlink -User @Model.DisplayName
-
+@section Scripts{ + + } -
diff --git a/devuitls.sh b/devuitls.sh index fa53547..0445b36 100755 --- a/devuitls.sh +++ b/devuitls.sh @@ -5,21 +5,27 @@ pw_developmentdatabase="wnmhOttjA0wCiR9hVoG7jjrf90SxWvAV" connnectionstr="Host=localhost;Database=${servicename}_dev;Username=${servicename};Password=${pw_developmentdatabase};IncludeErrorDetail=true;" case "$1" in - "dbinit") + "initial") sudo -u postgres psql -c "create database ${servicename}_dev;" sudo -u postgres psql -c "create user $servicename with encrypted password '$pw_developmentdatabase';" sudo -u postgres psql -c "grant all privileges on database ${servicename}_dev to $servicename;" sudo -u postgres psql -d "${servicename}_dev" -c "GRANT ALL ON SCHEMA public TO $servicename" - #dotnet ef dbcontext scaffold "$connnectionstr" Npgsql.EntityFrameworkCore.PostgreSQL + cp appsettings.sample.json appsettings.json + dotnet ef database update --connection "$connnectionstr" ;; - "dbupdate") + "add-migration") dotnet ef migrations add "$2" - dotnet ef database update --connection "$connnectionstr";; + dotnet ef database update --connection "$connnectionstr" + ;; + + "dbupdate") + dotnet ef database update --connection "$connnectionstr" + ;; *) - echo "Unknown command '$1', try 'dbinit'" ;; + echo "Unknown command '$1', try 'initial'" + ;; esac - diff --git a/fail133653846161056785/error0.err b/fail133653846161056785/error0.err new file mode 100644 index 0000000..6750c36 --- /dev/null +++ b/fail133653846161056785/error0.err @@ -0,0 +1,15 @@ +{ + "ClassName": "System.ComponentModel.Win32Exception", + "Message": "An error occurred trying to start process 'convert' with working directory '/home/adam/Desktop/vassago'. No such file or directory", + "Data": null, + "InnerException": null, + "HelpURL": null, + "StackTraceString": " at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)\n at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)\n at vassago.ExternalProcess.GoPlz(String commandPath, String commandArguments) in /home/adam/Desktop/vassago/externalProcess.cs:line 30", + "RemoteStackTraceString": null, + "RemoteStackIndex": 0, + "ExceptionMethod": null, + "HResult": -2147467259, + "Source": "System.Diagnostics.Process", + "WatsonBuckets": null, + "NativeErrorCode": 2 +} \ No newline at end of file diff --git a/vassago.csproj b/vassago.csproj index f9392a8..dae7d44 100644 --- a/vassago.csproj +++ b/vassago.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable $(NoWarn);CA2254 diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js index ec49115..afe475b 100644 --- a/wwwroot/js/site.js +++ b/wwwroot/js/site.js @@ -2,12 +2,15 @@ // for details on configuring this project to bundle and minify static web assets. // Write your JavaScript code. - -function testfunct(caller){ - console.log("[gibberish]"); - console.log(caller); +function Account(displayName, accountId, protocol){ + this.displayName = displayName; + this.accountId = accountId; + this.protocol = protocol; } -function patchModel(model) +//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself. +//you selfish fuck... What are you, fox? +//as it stands, you want something like /api/Channels/, trailing slash intentional +function patchModel(model, apiUrl) { //structure the model your (dang) self into a nice object console.log(model); @@ -16,15 +19,12 @@ function patchModel(model) var components = window.location.pathname.split('/'); if(components[2] !== "Details") { - console.log("wtf are you doing? " + components[2] + " is something other than Details") + console.log("wtf are you doing? " + components[2] + " is something other than Details"); + //add different endpoings here, if you like } var type=components[1]; var id=components[3]; - //todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself. - //you selfish fuck. What are you, fox? - var apiUrl = "/api/Channels/" - console.log("dexter impression: I am now ready to post the following content:"); console.log(JSON.stringify(model)); fetch(apiUrl, {