import { AllowedMentions , Attachment , Channel , Component , Embed , Guild , Internal , Message , snowflake , User } from '.' ; /** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */ export interface Webhook { /** the id of the webhook */ id : snowflake ; /** the type of the webhook */ type : Webhook . Type ; /** the guild id this webhook is for, if any */ guild_id ? : snowflake ; /** the channel id this webhook is for, if any */ channel_id ? : snowflake ; /** the user this webhook was created by (not returned when getting a webhook with its token) */ user ? : User ; /** the default name of the webhook */ name ? : string ; /** the default user avatar hash of the webhook */ avatar ? : string ; /** the secure token of the webhook (returned for Incoming Webhooks) */ token ? : string ; /** the bot/OAuth2 application that created this webhook */ application_id ? : snowflake ; /** the guild of the channel that this webhook is following (returned for Channel Follower Webhooks) */ source_guild ? : Partial < Guild > ; /** the channel that this webhook is following (returned for Channel Follower Webhooks) */ source_channel ? : Partial < Channel > ; /** the url used for executing the webhook (returned by the webhooks OAuth2 flow) */ url ? : string ; } export namespace Webhook { /** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types */ export enum Type { /** Incoming Webhooks can post messages to channels with a generated token */ INCOMING = 1 , /** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */ CHANNEL_FOLLOWER = 2 , /** Application webhooks are webhooks used with Interactions */ APPLICATION = 3 } /** https://discord.com/developers/docs/resources/webhook#create-webhook-json-params */ export interface CreateParams { /** name of the webhook (1-80 characters) */ name : string ; /** image for the default webhook avatar */ avatar ? : string ; } /** https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params */ export interface ModifyParams { /** the default name of the webhook */ name : string ; /** image for the default webhook avatar */ avatar ? : string ; /** the new channel id this webhook should be moved to */ channel_id : snowflake ; } /** https://discord.com/developers/docs/resources/webhook#execute-webhook-query-string-params */ export interface ExecuteParams { /** waits for server confirmation of message send before response, and returns the created message body (defaults to false; when false a message that is not saved does not return an error) */ wait : boolean ; /** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */ thread_id : snowflake ; } /** https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params */ export interface ExecuteBody { /** the message contents (up to 2000 characters) */ content : string ; /** override the default username of the webhook */ username : string ; /** override the default avatar of the webhook */ avatar_url : string ; /** true if this is a TTS message */ tts : boolean ; /** embedded rich content */ embeds : Embed [ ] ; /** allowed mentions for the message */ allowed_mentions : AllowedMentions ; /** the components to include with the message */ components : Component [ ] ; /** the contents of the file being sent */ files : any ; /** JSON encoded body of non-file params */ payload_json : string ; /** attachment objects with filename and description */ attachments : Partial < Attachment > [ ] ; } /** https://discord.com/developers/docs/resources/webhook#get-webhook-message-query-string-params */ export interface MessageParams { /** id of the thread the message is in */ thread_id : snowflake ; } /** https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params */ export interface MessageBody { /** the message contents (up to 2000 characters) */ content : string ; /** embedded rich content */ embeds : Embed [ ] ; /** allowed mentions for the message */ allowed_mentions : AllowedMentions ; /** the components to include with the message */ components : Component [ ] ; /** the contents of the file being sent/edited */ files : any ; /** JSON encoded body of non-file params (multipart/form-data only) */ payload_json : string ; /** attached files to keep and possible descriptions for new files */ attachments : Partial < Attachment > [ ] ; } } /** https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields */ export interface WebhooksUpdateEvent { /** id of the guild */ guild_id : snowflake ; /** id of the channel */ channel_id : snowflake ; } declare module './gateway' { interface GatewayEvents { /** guild channel webhook was created, update, or deleted */ WEBHOOKS_UPDATE : WebhooksUpdateEvent ; } } declare module './internal' { interface Internal { see https createWebhook ( channel_id , params ) : Promise < Webhook > ; see https getChannelWebhooks ( channel_id ) : Promise < Webhook [ ] > ; see https getGuildWebhooks ( guild_id ) : Promise < Webhook [ ] > ; see https getWebhook ( webhook_id ) : Promise < Webhook > ; see https getWebhookWithToken ( webhook_id , token ) : Promise < Webhook > ; see https modifyWebhook ( webhook_id , params ) : Promise < Webhook > ; see https modifyWebhookWithToken ( webhook_id , token , params ) : Promise < Webhook > ; see https deleteWebhook ( webhook_id ) : Promise < void > ; see https deleteWebhookwithToken ( webhook_id , token ) : Promise < void > ; see https executeWebhook ( webhook_id , token , body , query ) : Promise < void > ; see https executeSlackCompatibleWebhook ( webhook_id , token , body , query ) : Promise < void > ; see https executeGitHubCompatibleWebhook ( webhook_id , token , body , query ) : Promise < void > ; see https getWebhookMessage ( webhook_id , token , message_id , params ) : Promise < Message > ; see https editWebhookMessage ( webhook_id , token , message_id , body , query ) : Promise < void > ; see https deleteWebhookMessage ( webhook_id , token , message_id , params ) : Promise < void > ; } } Internal . define ( { '/channels/{channel.id}/webhooks' : { POST : 'createWebhook' , GET : 'getChannelWebhooks' , } , '/guilds/{guild.id}/webhooks' : { GET : 'getGuildWebhooks' , } , '/webhooks/{webhook.id}' : { GET : 'getWebhook' , PATCH : 'modifyWebhook' , DELETE : 'deleteWebhook' , } , '/webhooks/{webhook.id}/{webhook.token}' : { GET : 'getWebhookwithToken' , PATCH : 'modifyWebhookwithToken' , DELETE : 'deleteWebhookwithToken' , POST : 'executeWebhook' , } , '/webhooks/{webhook.id}/{webhook.token}/slack' : { POST : 'executeSlackCompatibleWebhook' , } , '/webhooks/{webhook.id}/{webhook.token}/github' : { POST : 'executeGitHubCompatibleWebhook' , } , '/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}' : { GET : 'getWebhookMessage' , PATCH : 'editWebhookMessage' , DELETE : 'deleteWebhookMessage' , } , } ) ;