Guest User

Untitled

a guest
Jun 7th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Automatic Eldewrito banlist update from Google Drive doc
  2. # Created by Wyvern
  3. #
  4.  
  5. # Downloading text file and naming it
  6. $download = "https://docs.google.com/document/d/11rkTBGuSxSjm5Mz_YQD3cx68KEYlDQycg0H6b3ofmAY/export?format=txt"
  7. $output = "$PSScriptRoot\sbl.txt"
  8. Invoke-WebRequest -Uri $download -OutFile $output
  9.  
  10. # Loading text files and seeing if the list exists already.
  11. $sbl = Get-Content $PSScriptRoot\sbl.txt -Raw
  12. $banlist = Get-Content $PSScriptRoot\banlist.txt -Raw
  13. $containsWord = $banlist | %{$_ -match "#####"} #This will look for exactly 5 # in a row.
  14.  
  15. if ($containsWord -contains $True) { # If the shared ban list has already been downloaded before, replace it.
  16.     $banlist -replace "(?s)(?<=#####).*(?######)","`n$sbl`n"|Out-File $PSScriptRoot\banlist.txt
  17. }
  18.  
  19. if ($containsWord -contains $false) { # If the banlist has never been appended, add it.
  20.     Add-Content $PSScriptRoot\banlist.txt $sbl
  21. }
Advertisement
Add Comment
Please, Sign In to add comment