From 04a22e5995a165ce8ada667d291768a26bba7174 Mon Sep 17 00:00:00 2001 From: Toastie Date: Thu, 7 Nov 2024 18:35:51 +1300 Subject: [PATCH] Fixed missing example in commands --- src/EllieBot/clean-migrations.ps1 | 49 +++++++++++++++++++ .../data/strings/commands/commands.en-US.yml | 2 + 2 files changed, 51 insertions(+) create mode 100644 src/EllieBot/clean-migrations.ps1 diff --git a/src/EllieBot/clean-migrations.ps1 b/src/EllieBot/clean-migrations.ps1 new file mode 100644 index 0000000..7db1541 --- /dev/null +++ b/src/EllieBot/clean-migrations.ps1 @@ -0,0 +1,49 @@ +# WORK IN PROGRESS + +# Define the folders to search for designer.cs files +$folders = @("Migrations/PostgreSql", "Migrations/Sqlite") + +# Loop through each folder +foreach ($folder in $folders) { + # Get all designer.cs files in the folder and subfolders + $files = Get-ChildItem -Path $folder -Filter *.designer.cs -Recurse + + $excludedPattern = "cleanup|mysql-init|squash|rero-cascade" + +$filteredFiles = $files | Where-Object { $_.Name -notmatch $excludedPattern } + # Loop through each file + foreach ($file in ($files | Where-Object { $_.Name -notmatch $excludedPattern })) { + # Read the contents of the file + $content = Get-Content -Path $file.FullName | Select-Object -First 30 + + # Find the attribute lines + $attributes = $content | Where-Object { $_ -match '\[.*\]' } | ForEach-Object { ' ' + $_.Trim() } + + # Find the namespace + $namespace = $content | Where-Object { $_ -match 'namespace' } | ForEach-Object { $_.Split(' ')[1] } + + # Find the class name + $class_name = $content | Where-Object { $_ -match 'partial class' } | ForEach-Object { $_.Trim().Split(' ')[2] } + + # Replace the contents with the new template + $new_content = @" +// +using EllieBot.Db; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace $namespace +{ +$($attributes -join "`n") + partial class $class_name + { + } +} +"@ + + # Write the new contents to the file + Set-Content -Path $file.FullName -Value $new_content + } +} \ No newline at end of file diff --git a/src/EllieBot/data/strings/commands/commands.en-US.yml b/src/EllieBot/data/strings/commands/commands.en-US.yml index 3ef1c5b..d3918ca 100644 --- a/src/EllieBot/data/strings/commands/commands.en-US.yml +++ b/src/EllieBot/data/strings/commands/commands.en-US.yml @@ -4668,5 +4668,7 @@ rakeback: Rakeback is accumulated by betting (not by winning or losing). Default rakeback is 0.05 * house edge House edge is defined per game + ex: + - '' params: - {} \ No newline at end of file