Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not upload files, only text #6

Open
Tarkiin opened this issue Jan 31, 2023 · 1 comment
Open

Do not upload files, only text #6

Tarkiin opened this issue Jan 31, 2023 · 1 comment

Comments

@Tarkiin
Copy link

Tarkiin commented Jan 31, 2023

A few days ago I was using it and it worked perfectly
Now it does not upload files, can you verify that it works and what causes the error?
Some errors:
Error 1

curl.exe : curl: (26) Failed to open/read local data from file/application
En C:\Users\admin\Desktop\upload-discord.ps1: 20 Carácter: 44

  • ... [string]::IsNullOrEmpty($file))){curl.exe -F "file1=@$file" $hookurl}
  •                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (curl: (26) Fail...ile/application:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

Error 2

curl.exe : % Total % Received % Xferd Average Speed Time Time Time Current
In C:\Users\admin\Desktop\ Upload files to discord.ps1: 21 Character: 44

  • ... [string]::IsNullOrEmpty($file))){curl.exe -F "file1=@$file" $hookurl}
  •    + CategoryInfo : NotSpecified: ( % Total % ... Time Current:String) [], RemoteException
       + FullyQualifiedErrorId : NativeCommandError
    
                                    Dload Upload Total Spent Left Speed
     0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
     0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
    

curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function cannot check revocation for the certificate.


function Upload-Discord {

[CmdletBinding()]
param (
    [parameter(Position=0,Mandatory=$False)]
    [string]$file,
    [parameter(Position=1,Mandatory=$False)]
    [string]$text 
)

$hookurl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXX"
$Body = @{
  'username' = $env:username
  'content' = $text
}

if (-not ([string]::IsNullOrEmpty($text))){
Invoke-RestMethod -ContentType 'Application/Json' -Uri $hookurl  -Method Post -Body ($Body | ConvertTo-Json)};

if (-not ([string]::IsNullOrEmpty($file))){curl.exe -F "file1=@$file" $hookurl}
}


Upload-Discord -file "C:\Users\admin\Desktop\Bar.gif" -text "Text"
@Tarkiin
Copy link
Author

Tarkiin commented Jan 31, 2023

Problem solved, AV block ports curl maybe

imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant