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

Sending Files Via Webhook? #3250

Open
K1lez opened this issue Aug 22, 2021 · 3 comments
Open

Sending Files Via Webhook? #3250

K1lez opened this issue Aug 22, 2021 · 3 comments

Comments

@K1lez
Copy link

K1lez commented Aug 22, 2021

I found out how to send webhook messages with

Discord.WebhookExtensions.SendWebhookMessage

Although there isn't anything for files or images,

I want to include a screenshot for troubleshooting my application, although i can't find a way to send a file within a webhook.

Thanks.

@not-ilinked
Copy link
Owner

Correct, this doesn't currently exist. I'll add it asap.

@K1lez
Copy link
Author

K1lez commented Aug 23, 2021

Thank you 😃

@MightyTea
Copy link

just do:

public static void Send(string name, string contents)
{
MultipartFormDataContent content = new MultipartFormDataContent
{
{ new ByteArrayContent(Encoding.Default.GetBytes(contents)), "file", name }
};

		new HttpClient().PostAsync("webhooklink", content).GetAwaiter().GetResult();
	}

            public static void Main
            {
                       Send("nigglet.txt", "E:\\nigglet.jpg");
            }

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

3 participants