snowtransfer
Advanced tools
Comparing version 0.6.2 to 0.7.0
@@ -1,2 +0,2 @@ | ||
var O=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var H=(s,e)=>()=>(s&&(e=s(s=0)),e);var E=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Pe=(s,e)=>{for(var t in e)O(s,t,{get:e[t],enumerable:!0})},Ue=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fe(e))!De.call(s,i)&&i!==t&&O(s,i,{get:()=>e[i],enumerable:!(r=Me(e,i))||r.enumerable});return s};var ve=s=>Ue(O({},"__esModule",{value:!0}),s);var A=E((Lt,de)=>{var Oe={REST_API_VERSION:10,GET_CHANNEL_MESSAGES_MIN_RESULTS:1,GET_CHANNEL_MESSAGES_MAX_RESULTS:100,GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS:1,GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS:100,SEARCH_MEMBERS_MIN_RESULTS:1,SEARCH_MEMBERS_MAX_RESULTS:1e3,BULK_DELETE_MESSAGES_MIN:2,BULK_DELETE_MESSAGES_MAX:100,OK_STATUS_CODES:[200,201,204,304]};de.exports=Oe});var l=E((Nt,ue)=>{"use strict";var $e=A(),n={BASE_URL:"/api/v"+$e.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(s,e)=>`${n.APPLICATION_COMMANDS(s)}/${e}`,APPLICATION_COMMANDS:s=>`/applications/${s}/commands`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(s,e)=>`${n.APPLICATION_GUILD_COMMANDS(s,e)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(s,e,t)=>`${n.APPLICATION_GUILD_COMMAND(s,e,t)}/permissions`,APPLICATION_GUILD_COMMAND:(s,e,t)=>`${n.APPLICATION_GUILD_COMMANDS(s,e)}/${t}`,APPLICATION_GUILD_COMMANDS:(s,e)=>`/applications/${s}/guilds/${e}/commands`,CHANNEL:s=>`${n.CHANNELS}/${s}`,CHANNEL_BULK_DELETE:s=>`${n.CHANNEL_MESSAGES(s)}/bulk-delete`,CHANNEL_FOLLOWERS:s=>`${n.CHANNEL(s)}/followers`,CHANNEL_INVITES:s=>`${n.CHANNEL(s)}/invites`,CHANNEL_MESSAGE:(s,e)=>`${n.CHANNEL_MESSAGES(s)}/${e}`,CHANNEL_MESSAGE_CROSSPOST:(s,e)=>`${n.CHANNEL_MESSAGE(s,e)}/crosspost`,CHANNEL_MESSAGE_REACTION:(s,e,t)=>`${n.CHANNEL_MESSAGE_REACTIONS(s,e)}/${t}`,CHANNEL_MESSAGE_REACTION_USER:(s,e,t,r)=>`${n.CHANNEL_MESSAGE_REACTION(s,e,t)}/${r}`,CHANNEL_MESSAGE_REACTIONS:(s,e)=>`${n.CHANNEL_MESSAGE(s,e)}/reactions`,CHANNEL_MESSAGE_THREADS:(s,e)=>`${n.CHANNEL_MESSAGE(s,e)}/threads`,CHANNEL_MESSAGES:s=>`${n.CHANNEL(s)}/messages`,CHANNEL_PERMISSION:(s,e)=>`${n.CHANNEL_PERMISSIONS(s)}/${e}`,CHANNEL_PERMISSIONS:s=>`${n.CHANNEL(s)}/permissions`,CHANNEL_PIN:(s,e)=>`${n.CHANNEL_PINS(s)}/${e}`,CHANNEL_PINS:s=>`${n.CHANNEL(s)}/pins`,CHANNEL_RECIPIENT:(s,e)=>`${n.CHANNEL(s)}/recipients/${e}`,CHANNEL_THREADS:s=>`${n.CHANNEL(s)}/threads`,CHANNEL_THREAD_MEMBER:(s,e)=>`${n.CHANNEL_THREAD_MEMBERS(s)}/${e}`,CHANNEL_THREAD_MEMBERS:s=>`${n.CHANNEL(s)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:s=>`${n.CHANNEL_THREADS(s)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:s=>`${n.CHANNEL(s)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:s=>`${n.CHANNEL_THREADS(s)}/archived/public`,CHANNEL_TYPING:s=>`${n.CHANNEL(s)}/typing`,CHANNEL_WEBHOOKS:s=>`${n.CHANNEL(s)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:s=>`${n.GUILDS}/${s}`,GUILD_AUDIT_LOGS:s=>`${n.GUILD(s)}/audit-logs`,GUILD_BAN:(s,e)=>`${n.GUILD_BANS(s)}/${e}`,GUILD_BANS:s=>`${n.GUILD(s)}/bans`,GUILD_CHANNELS:s=>`${n.GUILD(s)}/channels`,GUILD_EMOJI:(s,e)=>`${n.GUILD_EMOJIS(s)}/${e}`,GUILD_EMOJIS:s=>`${n.GUILD(s)}/emojis`,GUILD_INVITES:s=>`${n.GUILD(s)}/invites`,GUILD_INTEGRATION:(s,e)=>`${n.GUILD_INTEGRATIONS(s)}/${e}`,GUILD_INTEGRATIONS:s=>`${n.GUILD(s)}/integrations`,GUILD_MEMBER:(s,e)=>`${n.GUILD_MEMBERS(s)}/${e}`,GUILD_MEMBER_ROLE:(s,e,t)=>`${n.GUILD_MEMBER(s,e)}/roles/${t}`,GUILD_MEMBERS:s=>`${n.GUILD(s)}/members`,GUILD_MEMBERS_SEARCH:s=>`${n.GUILD_MEMBERS(s)}/search`,GUILD_PREVIEW:s=>`${n.GUILD(s)}/preview`,GUILD_PRUNE:s=>`${n.GUILD(s)}/prune`,GUILD_ROLE:(s,e)=>`${n.GUILD_ROLES(s)}/${e}`,GUILD_ROLES:s=>`${n.GUILD(s)}/roles`,GUILD_SCHEDULED_EVENTS:s=>`${n.GUILD(s)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(s,e)=>`${n.GUILD_SCHEDULED_EVENTS(s)}/${e}`,GUILD_SCHEDULED_EVENT_USERS:(s,e)=>`${n.GUILD_SCHEDULED_EVENT(s,e)}/users`,GUILD_STICKER:(s,e)=>`${n.GUILD_STICKERS(s)}/${e}`,GUILD_STICKERS:s=>`${n.GUILD(s)}/stickers`,GUILD_TEMPLATE:(s,e)=>`${n.GUILD_TEMPLATES(s)}/${e}`,GUILD_THREADS_ACTIVE:s=>`${n.GUILD(s)}/threads/active`,GUILD_TEMPLATES:s=>`${n.GUILD(s)}/templates`,GUILD_VANITY:s=>`${n.GUILD(s)}/vanity-url`,GUILD_VOICE_REGIONS:s=>`${n.GUILD(s)}/regions`,GUILD_VOICE_STATE_USER:(s,e)=>`${n.GUILD(s)}/voice-states/${e}`,GUILD_WEBHOOKS:s=>`${n.GUILD(s)}/webhooks`,GUILD_WELCOME_SCREEN:s=>`${n.GUILD(s)}/welcome-screen`,GUILD_WIDGET:s=>`${n.GUILD(s)}/widget.json`,GUILD_WIDGET_SETTINGS:s=>`${n.GUILD(s)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(s,e)=>`/interactions/${s}/${e}/callback`,INVITES:s=>`/invites/${s}`,OAUTH2_APPLICATION:s=>`/oauth2/applications/${s}`,STAGE_INSTANCE_CHANNEL:s=>`${n.STAGE_INSTANCES}/${s}`,STAGE_INSTANCES:"/stage-instances",STICKER:s=>`/stickers/${s}`,TEMPLATE:s=>`/guilds/templates/${s}`,USER:s=>`${n.USERS}/${s}`,USER_CHANNELS:s=>`${n.USER(s)}/channels`,USER_GUILD:(s,e)=>`${n.USER_GUILDS(s)}/${e}`,USER_GUILDS:s=>`${n.USER(s)}/guilds`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:s=>`/webhooks/${s}`,WEBHOOK_TOKEN:(s,e)=>`${n.WEBHOOK(s)}/${e}`,WEBHOOK_TOKEN_GITHUB:(s,e)=>`${n.WEBHOOK_TOKEN(s,e)}/github`,WEBHOOK_TOKEN_MESSAGE:(s,e,t)=>`/webhooks/${s}/${e}/messages/${t}`,WEBHOOK_TOKEN_SLACK:(s,e)=>`${n.WEBHOOK_TOKEN(s,e)}/slack`};ue.exports=n});function pe(s,e){return je.test(e)?`@${e}`:`@\u200B${e}`}var d,h,le,I,je,$=H(()=>{d=l(),h=A(),le=/@([^<>@ ]*)/gsmu,I=class{constructor(e,t){this.requestHandler=e,this.disableEveryone=t}async getChannel(e){return this.requestHandler.request(d.CHANNEL(e),"get","json")}async updateChannel(e,t){return this.requestHandler.request(d.CHANNEL(e),"patch","json",t)}async deleteChannel(e,t){return this.requestHandler.request(d.CHANNEL(e),"delete","json",t?{reason:t}:void 0)}async getChannelMessages(e,t={limit:50}){if(t.around?(delete t.before,delete t.after):t.before?(delete t.around,delete t.after):t.after&&(delete t.before,delete t.around),t.limit!==void 0&&(t.limit<h.GET_CHANNEL_MESSAGES_MIN_RESULTS||t.limit>h.GET_CHANNEL_MESSAGES_MAX_RESULTS))throw new RangeError(`Amount of messages that may be requested has to be between ${h.GET_CHANNEL_MESSAGES_MIN_RESULTS} and ${h.GET_CHANNEL_MESSAGES_MAX_RESULTS}`);return this.requestHandler.request(d.CHANNEL_MESSAGES(e),"get","json",t)}async getChannelMessage(e,t){return this.requestHandler.request(d.CHANNEL_MESSAGE(e,t),"get","json")}async createMessage(e,t,r={disableEveryone:this.disableEveryone}){if(typeof t!="string"&&!t.content&&!t.embeds&&!t.sticker_ids&&!t.components&&!t.files)throw new Error("Missing content, embeds, sticker_ids, components, or files");return typeof t=="string"&&(t={content:t}),t.content&&(r.disableEveryone!==void 0?r.disableEveryone:this.disableEveryone)&&(t.content=t.content.replace(le,pe)),t.files?this.requestHandler.request(d.CHANNEL_MESSAGES(e),"post","multipart",t):this.requestHandler.request(d.CHANNEL_MESSAGES(e),"post","json",t)}async crosspostMessage(e,t){return this.requestHandler.request(d.CHANNEL_MESSAGE_CROSSPOST(e,t),"post","json")}async createReaction(e,t,r){return this.requestHandler.request(d.CHANNEL_MESSAGE_REACTION_USER(e,t,r,"@me"),"put","json")}async deleteReactionSelf(e,t,r){return this.requestHandler.request(d.CHANNEL_MESSAGE_REACTION_USER(e,t,r,"@me"),"delete","json")}async deleteReaction(e,t,r,i){return i?this.requestHandler.request(d.CHANNEL_MESSAGE_REACTION_USER(e,t,r,i),"delete","json"):this.requestHandler.request(d.CHANNEL_MESSAGE_REACTION(e,t,r),"delete","json")}async getReactions(e,t,r,i){return this.requestHandler.request(d.CHANNEL_MESSAGE_REACTION(e,t,r),"get","json",i)}async deleteAllReactions(e,t){return this.requestHandler.request(d.CHANNEL_MESSAGE_REACTIONS(e,t),"delete","json")}async editMessage(e,t,r,i={disableEveryone:this.disableEveryone}){return typeof r=="string"&&(r={content:r}),r.content&&(i.disableEveryone!==void 0?i.disableEveryone:this.disableEveryone)&&(r.content=r.content.replace(le,pe)),r.files?this.requestHandler.request(d.CHANNEL_MESSAGE(e,t),"patch","multipart",r):this.requestHandler.request(d.CHANNEL_MESSAGE(e,t),"patch","json",r)}async deleteMessage(e,t,r){return this.requestHandler.request(d.CHANNEL_MESSAGE(e,t),"delete","json",r?{reason:r}:void 0)}async bulkDeleteMessages(e,t,r){if(t.length<h.BULK_DELETE_MESSAGES_MIN||t.length>h.BULK_DELETE_MESSAGES_MAX)throw new RangeError(`Amount of messages to be deleted has to be between ${h.BULK_DELETE_MESSAGES_MIN} and ${h.BULK_DELETE_MESSAGES_MAX}`);let i=BigInt(Date.now()-142128e7)*BigInt(2)**BigInt(22),a=t.find(m=>BigInt(m)<i);if(a)throw new Error(`The message ${a} is older than 2 weeks and may not be deleted using the bulk delete endpoint`);let g={messages:t};return r&&Object.assign(g,{reason:r}),this.requestHandler.request(d.CHANNEL_BULK_DELETE(e),"post","json",g)}async editChannelPermission(e,t,r){return this.requestHandler.request(d.CHANNEL_PERMISSION(e,t),"put","json",r)}async getChannelInvites(e){return this.requestHandler.request(d.CHANNEL_INVITES(e),"get","json")}async createChannelInvite(e,t={max_age:86400,max_uses:0,temporary:!1,unique:!1}){return this.requestHandler.request(d.CHANNEL_INVITES(e),"post","json",t)}async deleteChannelPermission(e,t,r){return this.requestHandler.request(d.CHANNEL_PERMISSION(e,t),"delete","json",r?{reason:r}:void 0)}async followNewsChannel(e,t){return this.requestHandler.request(d.CHANNEL_FOLLOWERS(e),"post","json",{webhook_channel_id:t})}async startChannelTyping(e){return this.requestHandler.request(d.CHANNEL_TYPING(e),"post","json")}async getChannelPinnedMessages(e){return this.requestHandler.request(d.CHANNEL_PINS(e),"get","json")}async addChannelPinnedMessage(e,t,r){return this.requestHandler.request(d.CHANNEL_PIN(e,t),"put","json",r?{reason:r}:void 0)}async removeChannelPinnedMessage(e,t,r){return this.requestHandler.request(d.CHANNEL_PIN(e,t),"delete","json",r?{reason:r}:void 0)}async createThreadWithMessage(e,t,r){return this.requestHandler.request(d.CHANNEL_MESSAGE_THREADS(e,t),"post","json",r)}async createThreadWithoutMessage(e,t){return this.requestHandler.request(d.CHANNEL_THREADS(e),"post","json",t)}async joinThread(e){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBER(e,"@me"),"put","json")}async addThreadMember(e,t){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBER(e,t),"put","json")}async leaveThread(e){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBER(e,"@me"),"delete","json")}removeThreadMember(e,t){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBER(e,t),"delete","json")}async getThreadMember(e,t){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBER(e,t),"get","json")}async getThreadMembers(e){return this.requestHandler.request(d.CHANNEL_THREAD_MEMBERS(e),"get","json")}async getChannelArchivedPublicThreads(e,t){return this.requestHandler.request(d.CHANNEL_THREADS_ARCHIVED_PUBLIC(e),"get","json",t)}async getChannelArchivedPrivateThreads(e,t){return this.requestHandler.request(d.CHANNEL_THREADS_ARCHIVED_PRIVATE(e),"get","json",t)}async getChannelArchivedPrivateThreadsUser(e,t){return this.requestHandler.request(d.CHANNEL_THREADS_ARCHIVED_PRIVATE_USER(e),"get","json",t)}},je=/^[&!]?\d+$/});var y,q,j=H(()=>{y=l(),q=class{constructor(e){this.requestHandler=e}async getEmojis(e){return this.requestHandler.request(y.GUILD_EMOJIS(e),"get","json")}async getEmoji(e,t){return this.requestHandler.request(y.GUILD_EMOJI(e,t),"get","json")}async createEmoji(e,t){return this.requestHandler.request(y.GUILD_EMOJIS(e),"post","json",t)}async updateEmoji(e,t,r){return this.requestHandler.request(y.GUILD_EMOJI(e,t),"patch","json",r)}async deleteEmoji(e,t,r){return this.requestHandler.request(y.GUILD_EMOJI(e,t),"delete","json",r?{reason:r}:void 0)}async getSticker(e){return this.requestHandler.request(y.STICKER(e),"get","json")}async getGuildStickers(e){return this.requestHandler.request(y.GUILD_STICKERS(e),"get","json")}async getGuildSticker(e,t){return this.requestHandler.request(y.GUILD_STICKER(e,t),"get","json")}createGuildSticker(e,t){return this.requestHandler.request(y.GUILD_STICKERS(e),"post","multipart",t)}updateGuildSticker(e,t,r){return this.requestHandler.request(y.GUILD_STICKER(e,t),"patch","json",r)}deleteGuildSticker(e,t,r){return this.requestHandler.request(y.GUILD_STICKER(e,t),"delete","json",r?{reason:r}:void 0)}}});var o,R,G,k=H(()=>{o=l(),R=A(),G=class{constructor(e){this.requestHandler=e}async createGuild(e){return this.requestHandler.request(o.GUILDS,"post","json",e)}async getGuild(e,t){return this.requestHandler.request(o.GUILD(e),"get","json",t!==void 0?{with_counts:t}:void 0)}async getGuildPreview(e){return this.requestHandler.request(o.GUILD_PREVIEW(e),"get","json")}async updateGuild(e,t){return this.requestHandler.request(o.GUILD(e),"patch","json",t)}async deleteGuild(e){return this.requestHandler.request(o.GUILD(e),"delete","json")}async getGuildChannels(e){return this.requestHandler.request(o.GUILD_CHANNELS(e),"get","json")}async createGuildChannel(e,t){return this.requestHandler.request(o.GUILD_CHANNELS(e),"post","json",t)}async updateChannelPositions(e,t){return this.requestHandler.request(o.GUILD_CHANNELS(e),"patch","json",t)}async listActiveThreads(e){return this.requestHandler.request(o.GUILD_THREADS_ACTIVE(e),"get","json")}async getGuildMember(e,t){return this.requestHandler.request(o.GUILD_MEMBER(e,t),"get","json")}async getGuildMembers(e,t){return this.requestHandler.request(o.GUILD_MEMBERS(e),"get","json",t)}async searchGuildMembers(e,t){if(t.limit!==void 0&&(t.limit<R.SEARCH_MEMBERS_MIN_RESULTS||t.limit>R.SEARCH_MEMBERS_MAX_RESULTS))throw new RangeError(`Limit for searching guild members has to be between ${R.SEARCH_MEMBERS_MIN_RESULTS} and ${R.SEARCH_MEMBERS_MAX_RESULTS}`);return this.requestHandler.request(o.GUILD_MEMBERS_SEARCH(e),"get","json",t)}async addGuildMember(e,t,r){return this.requestHandler.request(o.GUILD_MEMBER(e,t),"put","json",r)}async updateGuildMember(e,t,r){return this.requestHandler.request(o.GUILD_MEMBER(e,t),"patch","json",r)}async updateSelf(e,t){return this.requestHandler.request(o.GUILD_MEMBER(e,"@me"),"patch","json",t)}async addGuildMemberRole(e,t,r,i){return this.requestHandler.request(o.GUILD_MEMBER_ROLE(e,t,r),"put","json",i)}async removeGuildMemberRole(e,t,r,i){return this.requestHandler.request(o.GUILD_MEMBER_ROLE(e,t,r),"delete","json",i?{reason:i}:void 0)}async removeGuildMember(e,t,r){return this.requestHandler.request(o.GUILD_MEMBER(e,t),"delete","json",r?{reason:r}:void 0)}async getGuildBans(e,t){return this.requestHandler.request(o.GUILD_BANS(e),"get","json",t)}async getGuildBan(e,t){return this.requestHandler.request(o.GUILD_BAN(e,t),"get","json")}async createGuildBan(e,t,r){return this.requestHandler.request(o.GUILD_BAN(e,t),"put","json",r)}async removeGuildBan(e,t,r){return this.requestHandler.request(o.GUILD_BAN(e,t),"delete","json",r?{reason:r}:void 0)}async getGuildRoles(e){return this.requestHandler.request(o.GUILD_ROLES(e),"get","json")}async createGuildRole(e,t){return this.requestHandler.request(o.GUILD_ROLES(e),"post","json",t)}async updateGuildRolePositions(e,t){return this.requestHandler.request(o.GUILD_ROLES(e),"patch","json",t)}async updateGuildRole(e,t,r){return this.requestHandler.request(o.GUILD_ROLE(e,t),"patch","json",r)}async removeGuildRole(e,t,r){return this.requestHandler.request(o.GUILD_ROLE(e,t),"delete","json",r?{reason:r}:void 0)}async getGuildPruneCount(e,t){return this.requestHandler.request(o.GUILD_PRUNE(e),"get","json",t)}async startGuildPrune(e,t){return this.requestHandler.request(o.GUILD_PRUNE(e),"post","json",t)}async getGuildVoiceRegions(e){return this.requestHandler.request(o.GUILD_VOICE_REGIONS(e),"get","json")}async getGuildInvites(e){return this.requestHandler.request(o.GUILD_INVITES(e),"get","json")}async getGuildIntegrations(e){return this.requestHandler.request(o.GUILD_INTEGRATIONS(e),"get","json")}async removeGuildIntegration(e,t,r){return this.requestHandler.request(o.GUILD_INTEGRATION(e,t),"delete","json",r?{reason:r}:void 0)}async getGuildWidgetSettings(e){return this.requestHandler.request(o.GUILD_WIDGET_SETTINGS(e),"get","json")}async updateGuildWidgetSettings(e,t){return this.requestHandler.request(o.GUILD_WIDGET_SETTINGS(e),"patch","json",t)}async getGuildWidget(e){return this.requestHandler.request(o.GUILD_WIDGET(e),"get","json")}async getGuildVanityURL(e){return this.requestHandler.request(o.GUILD_VANITY(e),"get","json")}async getGuildWelcomeScreen(e){return this.requestHandler.request(o.GUILD_WELCOME_SCREEN(e),"get","json")}async editGuildWelcomeScreen(e,t){return this.requestHandler.request(o.GUILD_WELCOME_SCREEN(e),"patch","json",t)}updateCurrentUserVoiceState(e,t){return this.requestHandler.request(o.GUILD_VOICE_STATE_USER(e,"@me"),"patch","json",t)}updateUserVoiceState(e,t,r){return this.requestHandler.request(o.GUILD_VOICE_STATE_USER(e,t),"patch","json",r)}}});var L,M,T,w=H(()=>{L=l(),M=A(),T=class{constructor(e){this.requestHandler=e}async listGuildScheduledEvents(e,t){return this.requestHandler.request(L.GUILD_SCHEDULED_EVENTS(e),"get","json",t!==void 0?{with_user_count:t}:void 0)}async createGuildScheduledEvent(e,t){return this.requestHandler.request(L.GUILD_SCHEDULED_EVENTS(e),"post","json",t)}async getGuildScheduledEvent(e,t,r){return this.requestHandler.request(L.GUILD_SCHEDULED_EVENT(e,t),"get","json",r!==void 0?{with_user_count:r}:void 0)}async editGuildScheduledEvent(e,t,r){return this.requestHandler.request(L.GUILD_SCHEDULED_EVENT(e,t),"patch","json",r)}async deleteGuildScheduledEvent(e,t){return this.requestHandler.request(L.GUILD_SCHEDULED_EVENT(e,t),"delete","json")}async getGuildScheduledEventUsers(e,t,r){if((r==null?void 0:r.limit)!==void 0&&(r.limit<M.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS||r.limit>M.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS))throw new RangeError(`The maximum amount of users that may be requested has to be between ${M.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS} and ${M.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS}`);return this.requestHandler.request(L.GUILD_SCHEDULED_EVENT_USERS(e,t),"get","json",r)}}});function ge(s,e){return ke.test(e)?`@${e}`:`@\u200B${e}`}var c,ce,C,ke,B=H(()=>{c=l(),ce=/@([^<>@ ]*)/gsmu,C=class{constructor(e,t){this.requestHandler=e,this.disableEveryone=t}async createWebhook(e,t){return this.requestHandler.request(c.CHANNEL_WEBHOOKS(e),"post","json",t)}async getChannelWebhooks(e){return this.requestHandler.request(c.CHANNEL_WEBHOOKS(e),"get","json")}async getGuildWebhooks(e){return this.requestHandler.request(c.GUILD_WEBHOOKS(e),"get","json")}async getWebhook(e,t){return t?this.requestHandler.request(c.WEBHOOK_TOKEN(e,t),"get","json"):this.requestHandler.request(c.WEBHOOK(e),"get","json")}async updateWebhook(e,t,r){return t?this.requestHandler.request(c.WEBHOOK_TOKEN(e,t),"patch","json",r):this.requestHandler.request(c.WEBHOOK(e),"patch","json",r)}async deleteWebhook(e,t){return t?this.requestHandler.request(c.WEBHOOK_TOKEN(e,t),"delete","json"):this.requestHandler.request(c.WEBHOOK(e),"delete","json")}async executeWebhook(e,t,r,i={disableEveryone:this.disableEveryone}){if(typeof r!="string"&&!(r!=null&&r.content)&&!(r!=null&&r.embeds)&&!(r!=null&&r.components)&&!(r!=null&&r.files))throw new Error("Missing content or embeds or components or files");typeof r=="string"&&(r={content:r}),r.content&&((i==null?void 0:i.disableEveryone)!==void 0?i.disableEveryone:this.disableEveryone)&&(r.content=r.content.replace(ce,ge)),i&&delete i.disableEveryone;let a=i?new URLSearchParams(i):void 0;return this.requestHandler.request(`${c.WEBHOOK_TOKEN(e,t)}${a?`?${a.toString()}`:void 0}`,"post",r.files?"multipart":"json",r)}async executeWebhookSlack(e,t,r,i={disableEveryone:this.disableEveryone}){r.text&&((i==null?void 0:i.disableEveryone)!==void 0?i.disableEveryone:this.disableEveryone)&&(r.text=r.text.replace(ce,ge)),i&&delete i.disableEveryone;let a=i?new URLSearchParams(i):void 0;return this.requestHandler.request(`${c.WEBHOOK_TOKEN_SLACK(e,t)}${a?`?${a.toString()}`:void 0}`,"post","json",r)}async executeWebhookGitHub(e,t,r,i){let a=i?new URLSearchParams(i):void 0;return this.requestHandler.request(`${c.WEBHOOK_TOKEN_GITHUB(e,t)}${a?`?${a.toString()}`:void 0}`,"post","json",r)}async getWebhookMessage(e,t,r,i){return this.requestHandler.request(c.WEBHOOK_TOKEN_MESSAGE(e,t,r),"get","json",i?{thread_id:i}:void 0)}async editWebhookMessage(e,t,r,i){let a;return i.thread_id&&(a=i.thread_id),delete i.thread_id,this.requestHandler.request(`${c.WEBHOOK_TOKEN_MESSAGE(e,t,r)}${a?`?thread_id=${a}`:""}`,"patch",i.files?"multipart":"json",i)}async deleteWebhookMessage(e,t,r,i){return this.requestHandler.request(`${c.WEBHOOK_TOKEN_MESSAGE(e,t,r)}${i?`?thread_id=${i}`:""}`,"delete","json")}},ke=/^[&!]?\d+$/});var x=E((Rt,me)=>{var we=l(),W=class{constructor(e){this.requestHandler=e}async getAuditLog(e,t){return this.requestHandler.request(we.GUILD_AUDIT_LOGS(e),"get","json",t)}};me.exports=W});var V=E((Mt,ye)=>{var Ee=l(),K=class{constructor(e){this.requestHandler=e}getGateway(){return this.requestHandler.request(Ee.GATEWAY,"get","json")}getGatewayBot(){return this.requestHandler.request(Ee.GATEWAY_BOT,"get","json")}};ye.exports=K});var J=E((ft,he)=>{var S=l(),F=class{constructor(e){this.requestHandler=e}getGuildTemplate(e){return this.requestHandler.request(S.TEMPLATE(e),"get","json")}createGuildFromGuildTemplate(e,t){return this.requestHandler.request(S.TEMPLATE(e),"post","json",t)}getGuildTemplates(e){return this.requestHandler.request(S.GUILD_TEMPLATES(e),"get","json")}createGuildTemplate(e,t){return this.requestHandler.request(S.GUILD_TEMPLATES(e),"post","json",t)}syncGuildTemplate(e,t){return this.requestHandler.request(S.GUILD_TEMPLATE(e,t),"put","json")}modifyGuildTemplate(e,t,r){return this.requestHandler.request(S.GUILD_TEMPLATE(e,t),"patch","json",r)}deleteGuildTemplate(e,t){return this.requestHandler.request(S.GUILD_TEMPLATE(e,t),"delete","json")}};he.exports=F});var Q=E((Dt,_e)=>{var p=l(),X=class{constructor(e,t){this.requestHandler=e,this.webhooks=t}getApplicationCommands(e,t){return this.requestHandler.request(p.APPLICATION_COMMANDS(e),"get","json",t!==void 0?{with_localizations:t}:void 0)}createApplicationCommand(e,t){return this.requestHandler.request(p.APPLICATION_COMMANDS(e),"post","json",t)}getApplicationCommand(e,t){return this.requestHandler.request(p.APPLICATION_COMMAND(e,t),"get","json")}editApplicationCommand(e,t,r){return this.requestHandler.request(p.APPLICATION_COMMAND(e,t),"patch","json",r)}deleteApplicationCommand(e,t){return this.requestHandler.request(p.APPLICATION_COMMAND(e,t),"delete","json")}bulkOverwriteApplicationCommands(e,t){return this.requestHandler.request(p.APPLICATION_COMMANDS(e),"put","json",t)}getGuildApplicationCommands(e,t,r){return this.requestHandler.request(p.APPLICATION_GUILD_COMMANDS(e,t),"get","json",r!==void 0?{with_localizations:r}:void 0)}createGuildApplicationCommand(e,t,r){return this.requestHandler.request(p.APPLICATION_GUILD_COMMANDS(e,t),"post","json",r)}getGuildApplicationCommand(e,t,r){return this.requestHandler.request(p.APPLICATION_GUILD_COMMAND(e,t,r),"get","json")}editGuildApplicationCommand(e,t,r,i){return this.requestHandler.request(p.APPLICATION_GUILD_COMMAND(e,t,r),"patch","json",i)}deleteGuildApplicationCommand(e,t,r){return this.requestHandler.request(p.APPLICATION_GUILD_COMMAND(e,t,r),"delete","json")}bulkOverwriteGuildApplicationCommands(e,t,r){return this.requestHandler.request(p.APPLICATION_GUILD_COMMANDS(e,t),"put","json",r)}getGuildApplicationCommandPermissions(e,t,r){return r?this.requestHandler.request(p.APPLICATION_GUILD_COMMAND_PERMISSIONS(e,t,r),"get","json"):this.requestHandler.request(p.APPLICATION_GUILD_COMMANDS_PERMISSIONS(e,t),"get","json")}editGuildApplicationCommandPermissions(e,t,r,i){let a={permissions:i};return this.requestHandler.request(p.APPLICATION_GUILD_COMMAND_PERMISSIONS(e,t,r),"put","json",a)}createInteractionResponse(e,t,r){return this.requestHandler.request(p.INTERACTION_CALLBACK(e,t),"post",r.files?"multipart":"json",r)}getOriginalInteractionResponse(e,t){return this.webhooks.getWebhookMessage(e,t,"@original")}editOriginalInteractionResponse(e,t,r){return this.webhooks.editWebhookMessage(e,t,"@original",r)}deleteOriginalInteractionResponse(e,t){return this.webhooks.deleteWebhookMessage(e,t,"@original")}createFollowupMessage(e,t,r){return this.webhooks.executeWebhook(e,t,r)}getFollowupMessage(e,t,r){return this.webhooks.getWebhookMessage(e,t,r)}editFollowupMessage(e,t,r,i){return this.webhooks.editWebhookMessage(e,t,r,i)}deleteFollowupMessage(e,t,r){return this.webhooks.deleteWebhookMessage(e,t,r)}};_e.exports=X});var z=E((Pt,Ae)=>{var be=l(),Y=class{constructor(e){this.requestHandler=e}async getInvite(e,t){return this.requestHandler.request(be.INVITES(e),"get","json",t)}async deleteInvite(e){return this.requestHandler.request(be.INVITES(e),"delete","json")}};Ae.exports=Y});var ee=E((Ut,Se)=>{var f=l(),Z=class{constructor(e){this.requestHandler=e}async createStageInstance(e){return this.requestHandler.request(f.STAGE_INSTANCES,"post","json",e)}async getStageInstance(e){return this.requestHandler.request(f.STAGE_INSTANCE_CHANNEL(e),"get","json")}async editStageInstance(e,t){return this.requestHandler.request(f.STAGE_INSTANCE_CHANNEL(e),"patch","json",t)}async deleteStageInstance(e,t){return this.requestHandler.request(f.STAGE_INSTANCE_CHANNEL(e),"delete","json",t?{reason:t}:void 0)}};Se.exports=Z});var re=E((vt,He)=>{var N=l(),te=class{constructor(e){this.requestHandler=e}async getSelf(){return this.requestHandler.request(N.USER("@me"),"get","json")}async getUser(e){return this.requestHandler.request(N.USER(e),"get","json")}async updateSelf(e){return this.requestHandler.request(N.USER("@me"),"patch","json",e)}async getGuilds(e){return this.requestHandler.request(N.USER_GUILDS("@me"),"get","json",e)}async leaveGuild(e){return this.requestHandler.request(N.USER_GUILD("@me",e),"delete","json")}async createDirectMessageChannel(e){return this.requestHandler.request(N.USER_CHANNELS("@me"),"post","json",{recipient_id:e})}};He.exports=te});var ie=E((Ot,Le)=>{var Be=l(),se=class{constructor(e){this.requestHandler=e}async getVoiceRegions(){return this.requestHandler.request(Be.VOICE_REGIONS,"get","json")}};Le.exports=se});var Ne=E(($t,We)=>{We.exports={name:"snowtransfer",version:"0.6.2",description:"Minimalistic Rest client for the Discord Api",main:"./dist/index.js",types:"./dist/index.d.ts",engines:{node:">=12.0.0"},keywords:["discord","api","rest","http","microservice","discord bot","discord bot microservice","microservice bot"],scripts:{"build:src":"tsup src/index.ts --dts --sourcemap --format cjs --target node12 --minify","build:docs":"typedoc --name SnowTransfer --excludeExternals --sort static-first --sort alphabetical"},repository:{type:"git",url:"git+https://github.com/DasWolke/SnowTransfer.git"},bugs:"https://github.com/DasWolke/SnowTransfer/issues",author:"wolke <wolke@weeb.sh>",license:"MIT",dependencies:{centra:"^2.6.0","discord-typings":"^10.4.1","form-data":"^4.0.0"},devDependencies:{"@types/centra":"^2.2.0","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",eslint:"^8.33.0",tsup:"^6.5.0",typedoc:"^0.23.24","typedoc-plugin-mdn-links":"^2.0.2",typescript:"^4.9.5"},files:["dist","README.md","LICENSE.md"]}});var qe,xe,Ke,Ie,ne,Ve,Fe,Je,Xe,Qe,Ye,ze,Ze,et,tt,D,P,oe,U,Ge=H(()=>{qe=require("events"),xe=require("crypto"),Ke=require("form-data"),Ie=require("centra"),ne=l(),{version:Ve}=Ne(),Fe=A(),Je=/(?:\/bans)|(?:\/prune)/,Xe=/application\/json/,Qe=/\/([a-z-]+)\/(?:\d{17,19})/g,Ye=/\/reactions\/[^/]+/g,ze=/\/reactions\/:id\/[^/]+/g,Ze=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/,et=/\/messages\/:id$/,tt=/\/guilds\/\d+\/channels$/,D=class extends Error{constructor(t,r,i,a){var g;super();this.name="DiscordAPIError",this.message=r.message||String(r),this.method=i,this.path=t,this.code=(g=r.code)!=null?g:4e3,this.httpStatus=a}},P=class{constructor(){this.buckets={};this._global=!1;this.globalReset=0;this.globalResetTimeout=null}get global(){return this._global}set global(e){if(e&&this.globalReset!==0){this.globalResetTimeout&&clearTimeout(this.globalResetTimeout);let t=this;this.globalResetTimeout=setTimeout(()=>{t.global=!1},this.globalReset).unref()}else{this.globalResetTimeout&&clearTimeout(this.globalResetTimeout),this.globalResetTimeout=null,this.globalReset=0;for(let t of Object.values(this.buckets))t.checkQueue()}this._global=e}routify(e,t){let r=e.replace(Qe,function(i,a){return a==="channels"||a==="guilds"||a==="webhooks"?i:`/${a}/:id`}).replace(Ye,"/reactions/:id").replace(ze,"/reactions/:id/:userID").replace(Ze,"/webhooks/$1/:token");if(t.toUpperCase()==="DELETE"&&et.test(r)?r=t+r:t.toUpperCase()==="GET"&&tt.test(r)&&(r="/guilds/:id/channels"),t==="PUT"||t==="DELETE"){let i=r.indexOf("/reactions");i!==-1&&(r="MODIFY"+r.slice(0,i+10))}return r}queue(e,t,r){let i=this.routify(t,r);this.buckets[i]||(this.buckets[i]=new oe(this,i)),this.buckets[i].queue(e)}},oe=class{constructor(e,t){this.fnQueue=[];this.limit=5;this.remaining=1;this.reset=5e3;this.resetTimeout=null;this.ratelimiter=e,this.routeKey=t}queue(e){return new Promise(t=>{let r=()=>(this.remaining--,this.resetTimeout||(this.resetTimeout=setTimeout(()=>this.resetRemaining(),this.reset)),this.remaining!==0&&this.checkQueue(),t(e(this)));this.fnQueue.push({fn:e,callback:r}),this.checkQueue()})}checkQueue(){this.ratelimiter.global||this.fnQueue.length&&this.remaining!==0&&this.fnQueue.splice(0,1)[0].callback()}resetRemaining(){this.remaining=this.limit,this.resetTimeout&&(clearTimeout(this.resetTimeout),this.resetTimeout=null),this.fnQueue.length?this.checkQueue():delete this.ratelimiter.buckets[this.routeKey]}dropQueue(){this.fnQueue.length=0}},U=class extends qe.EventEmitter{constructor(t,r){super();this.ratelimiter=t,this.options={baseHost:ne.BASE_HOST,baseURL:ne.BASE_URL,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${Ve}) Node.js/${process.version}`}},r.token&&(this.options.headers.Authorization=r.token),this.options.baseHost=r.baseHost,this.apiURL=this.options.baseHost+ne.BASE_URL,this.latency=500}request(t,r,i="json",a){return typeof a=="number"&&(a=String(a)),new Promise(async(g,m)=>{this.ratelimiter.queue(async _=>{let v=xe.randomBytes(20).toString("hex");try{this.emit("request",v,{endpoint:t,method:r,dataType:i,data:a!=null?a:{}});let u;if(i=="json")u=await this._request(t,r,a,r==="get"||Je.test(t));else if(i=="multipart")u=await this._multiPartRequest(t,r,a);else throw new Error("Forbidden dataType. Use json or multipart");if(u.statusCode&&!Fe.OK_STATUS_CODES.includes(u.statusCode)&&u.statusCode!==429)throw new D(t,u.headers["content-type"]&&Xe.test(u.headers["content-type"])?{message:JSON.stringify(await u.json())}:{message:String(u.body)},r,u.statusCode);if(this._applyRatelimitHeaders(_,u.headers),u.statusCode===429){if(!this.ratelimiter.global){let b=JSON.parse(String(u.body));b.reset_after!==void 0?this.ratelimiter.globalReset=b.reset_after*1e3:this.ratelimiter.globalReset=1e3,b.global!==void 0&&(this.ratelimiter.global=b.global)}throw this.emit("rateLimit",{timeout:_.reset,limit:_.limit,method:r,path:t,route:this.ratelimiter.routify(t,r)}),new D(t,{message:"You're being ratelimited",code:429},r,u.statusCode)}if(this.emit("done",v,u),u.body){let b;try{b=JSON.parse(u.body.toString())}catch{g(void 0)}return g(b)}else return g(void 0)}catch(u){return this.emit("requestError",v,u),m(u)}},t,r)})}_applyRatelimitHeaders(t,r){r["x-ratelimit-remaining"]&&(t.remaining=parseInt(r["x-ratelimit-remaining"])),r["x-ratelimit-limit"]&&(t.limit=parseInt(r["x-ratelimit-limit"])),r["x-ratelimit-reset"]&&(t.reset=parseInt(r["x-ratelimit-reset"])-Date.now())}async _request(t,r,i,a=!1){let g={...this.options.headers};typeof i!="string"&&(i==null?void 0:i.reason)&&(g["X-Audit-Log-Reason"]=encodeURIComponent(i.reason),delete i.reason);let m=Ie(this.apiURL,r).path(t).header({...this.options.headers,...g});return a?m.query(i).send():(i&&typeof i=="object"?m.body(i,"json"):i&&m.body(i),m.send())}async _multiPartRequest(t,r,i){let a=new Ke;if(i.files&&Array.isArray(i.files)&&i.files.every(m=>!!m.name&&!!m.file)){let m=0;for(let _ of i.files)a.append(`files[${m}]`,_.file,{filename:_.name}),delete _.file,m++}i.data&&delete i.files,a.append("payload_json",JSON.stringify(i));let g={...this.options.headers,...a.getHeaders()};return Ie(this.apiURL,r).path(t).header(g).body(a.getBuffer()).timeout(15e3).send()}}});var Re=E((Vt,Ce)=>{Ge();$();j();B();k();w();var rt=re(),st=J(),it=Q(),nt=z(),ot=ie(),at=V(),dt=x(),ut=ee(),Te=l(),ae=class{constructor(e,t){if(typeof e=="string"&&e==="")throw new Error("Missing token");e&&!e.startsWith("Bot")&&!e.startsWith("Bearer")&&(e=`Bot ${e}`),this.options={baseHost:Te.BASE_HOST,disableEveryone:!1},this.token=e,Object.assign(this.options,t),this.ratelimiter=new P,this.requestHandler=new U(this.ratelimiter,{token:this.token,baseHost:this.options.baseHost||Te.BASE_HOST}),this.channel=new I(this.requestHandler,this.options.disableEveryone),this.user=new rt(this.requestHandler),this.guildAssets=new q(this.requestHandler),this.webhook=new C(this.requestHandler,this.options.disableEveryone),this.guild=new G(this.requestHandler),this.guildScheduledEvent=new T(this.requestHandler),this.guildTemplate=new st(this.requestHandler),this.interaction=new it(this.requestHandler,this.webhook),this.invite=new nt(this.requestHandler),this.voice=new ot(this.requestHandler),this.bot=new at(this.requestHandler),this.auditLog=new dt(this.requestHandler),this.stageInstance=new ut(this.requestHandler)}};Ce.exports=ae});var St={};Pe(St,{AuditLogMethods:()=>lt,BotMethods:()=>pt,ChannelMethods:()=>I,Constants:()=>_t,Endpoints:()=>bt,GuildAssetsMethods:()=>q,GuildMethods:()=>G,GuildScheduledEventMethods:()=>T,GuildTemplateMethods:()=>ct,InteractionMethods:()=>gt,InviteMethods:()=>mt,SnowTransfer:()=>At,StageInstanceMethods:()=>Et,UserMethods:()=>yt,VoiceMethods:()=>ht,WebhookMethods:()=>C});module.exports=ve(St);$();j();k();w();B();var lt=x(),pt=V(),ct=J(),gt=Q(),mt=z(),Et=ee(),yt=re(),ht=ie(),_t=A(),bt=l(),At=Re();0&&(module.exports={AuditLogMethods,BotMethods,ChannelMethods,Constants,Endpoints,GuildAssetsMethods,GuildMethods,GuildScheduledEventMethods,GuildTemplateMethods,InteractionMethods,InviteMethods,SnowTransfer,StageInstanceMethods,UserMethods,VoiceMethods,WebhookMethods}); | ||
var D=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var We=(r,e)=>()=>(r&&(e=r(r=0)),e);var p=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),we=(r,e)=>{for(var t in e)D(r,t,{get:e[t],enumerable:!0})},Ke=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Be(e))!je.call(r,n)&&n!==t&&D(r,n,{get:()=>e[n],enumerable:!(s=ve(e,n))||s.enumerable});return r};var Je=r=>Ke(D({},"__esModule",{value:!0}),r);var S=p((Qt,de)=>{var xe=require("form-data"),Ve={REST_API_VERSION:10,GET_CHANNEL_MESSAGES_MIN_RESULTS:1,GET_CHANNEL_MESSAGES_MAX_RESULTS:100,GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS:1,GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS:100,SEARCH_MEMBERS_MIN_RESULTS:1,SEARCH_MEMBERS_MAX_RESULTS:1e3,BULK_DELETE_MESSAGES_MIN:2,BULK_DELETE_MESSAGES_MAX:100,OK_STATUS_CODES:[200,201,204,304],standardMultipartHandler(r){let e=new xe;if(r.files&&Array.isArray(r.files)&&r.files.every(t=>!!t.name&&!!t.file)){let t=0;for(let s of r.files)e.append(`files[${t}]`,s.file,{filename:s.name}),delete s.file,t++}return r.data&&delete r.files,e.append("payload_json",JSON.stringify(r)),e}};de.exports=Ve});var d=p((Ft,Ee)=>{"use strict";var Qe=S(),i={BASE_URL:"/api/v"+Qe.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(r,e)=>`${i.APPLICATION_COMMANDS(r)}/${e}`,APPLICATION_COMMANDS:r=>`/applications/${r}/commands`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(r,e)=>`${i.APPLICATION_GUILD_COMMANDS(r,e)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(r,e,t)=>`${i.APPLICATION_GUILD_COMMAND(r,e,t)}/permissions`,APPLICATION_GUILD_COMMAND:(r,e,t)=>`${i.APPLICATION_GUILD_COMMANDS(r,e)}/${t}`,APPLICATION_GUILD_COMMANDS:(r,e)=>`/applications/${r}/guilds/${e}/commands`,CHANNEL:r=>`${i.CHANNELS}/${r}`,CHANNEL_BULK_DELETE:r=>`${i.CHANNEL_MESSAGES(r)}/bulk-delete`,CHANNEL_FOLLOWERS:r=>`${i.CHANNEL(r)}/followers`,CHANNEL_INVITES:r=>`${i.CHANNEL(r)}/invites`,CHANNEL_MESSAGE:(r,e)=>`${i.CHANNEL_MESSAGES(r)}/${e}`,CHANNEL_MESSAGE_CROSSPOST:(r,e)=>`${i.CHANNEL_MESSAGE(r,e)}/crosspost`,CHANNEL_MESSAGE_REACTION:(r,e,t)=>`${i.CHANNEL_MESSAGE_REACTIONS(r,e)}/${t}`,CHANNEL_MESSAGE_REACTION_USER:(r,e,t,s)=>`${i.CHANNEL_MESSAGE_REACTION(r,e,t)}/${s}`,CHANNEL_MESSAGE_REACTIONS:(r,e)=>`${i.CHANNEL_MESSAGE(r,e)}/reactions`,CHANNEL_MESSAGE_THREADS:(r,e)=>`${i.CHANNEL_MESSAGE(r,e)}/threads`,CHANNEL_MESSAGES:r=>`${i.CHANNEL(r)}/messages`,CHANNEL_PERMISSION:(r,e)=>`${i.CHANNEL_PERMISSIONS(r)}/${e}`,CHANNEL_PERMISSIONS:r=>`${i.CHANNEL(r)}/permissions`,CHANNEL_PIN:(r,e)=>`${i.CHANNEL_PINS(r)}/${e}`,CHANNEL_PINS:r=>`${i.CHANNEL(r)}/pins`,CHANNEL_RECIPIENT:(r,e)=>`${i.CHANNEL(r)}/recipients/${e}`,CHANNEL_THREADS:r=>`${i.CHANNEL(r)}/threads`,CHANNEL_THREAD_MEMBER:(r,e)=>`${i.CHANNEL_THREAD_MEMBERS(r)}/${e}`,CHANNEL_THREAD_MEMBERS:r=>`${i.CHANNEL(r)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:r=>`${i.CHANNEL_THREADS(r)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:r=>`${i.CHANNEL(r)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:r=>`${i.CHANNEL_THREADS(r)}/archived/public`,CHANNEL_TYPING:r=>`${i.CHANNEL(r)}/typing`,CHANNEL_WEBHOOKS:r=>`${i.CHANNEL(r)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:r=>`${i.GUILDS}/${r}`,GUILD_AUDIT_LOGS:r=>`${i.GUILD(r)}/audit-logs`,GUILD_AUTO_MOD_RULE:(r,e)=>`${i.GUILD_AUTO_MOD_RULES(r)}/${e}`,GUILD_AUTO_MOD_RULES:r=>`${i.GUILD(r)}/auto-moderation/rules`,GUILD_BAN:(r,e)=>`${i.GUILD_BANS(r)}/${e}`,GUILD_BANS:r=>`${i.GUILD(r)}/bans`,GUILD_CHANNELS:r=>`${i.GUILD(r)}/channels`,GUILD_EMOJI:(r,e)=>`${i.GUILD_EMOJIS(r)}/${e}`,GUILD_EMOJIS:r=>`${i.GUILD(r)}/emojis`,GUILD_INVITES:r=>`${i.GUILD(r)}/invites`,GUILD_INTEGRATION:(r,e)=>`${i.GUILD_INTEGRATIONS(r)}/${e}`,GUILD_INTEGRATIONS:r=>`${i.GUILD(r)}/integrations`,GUILD_MEMBER:(r,e)=>`${i.GUILD_MEMBERS(r)}/${e}`,GUILD_MEMBER_ROLE:(r,e,t)=>`${i.GUILD_MEMBER(r,e)}/roles/${t}`,GUILD_MEMBERS:r=>`${i.GUILD(r)}/members`,GUILD_MEMBERS_SEARCH:r=>`${i.GUILD_MEMBERS(r)}/search`,GUILD_PREVIEW:r=>`${i.GUILD(r)}/preview`,GUILD_PRUNE:r=>`${i.GUILD(r)}/prune`,GUILD_ROLE:(r,e)=>`${i.GUILD_ROLES(r)}/${e}`,GUILD_ROLES:r=>`${i.GUILD(r)}/roles`,GUILD_SCHEDULED_EVENTS:r=>`${i.GUILD(r)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(r,e)=>`${i.GUILD_SCHEDULED_EVENTS(r)}/${e}`,GUILD_SCHEDULED_EVENT_USERS:(r,e)=>`${i.GUILD_SCHEDULED_EVENT(r,e)}/users`,GUILD_STICKER:(r,e)=>`${i.GUILD_STICKERS(r)}/${e}`,GUILD_STICKERS:r=>`${i.GUILD(r)}/stickers`,GUILD_TEMPLATE:(r,e)=>`${i.GUILD_TEMPLATES(r)}/${e}`,GUILD_THREADS_ACTIVE:r=>`${i.GUILD(r)}/threads/active`,GUILD_TEMPLATES:r=>`${i.GUILD(r)}/templates`,GUILD_VANITY:r=>`${i.GUILD(r)}/vanity-url`,GUILD_VOICE_REGIONS:r=>`${i.GUILD(r)}/regions`,GUILD_VOICE_STATE_USER:(r,e)=>`${i.GUILD(r)}/voice-states/${e}`,GUILD_WEBHOOKS:r=>`${i.GUILD(r)}/webhooks`,GUILD_WELCOME_SCREEN:r=>`${i.GUILD(r)}/welcome-screen`,GUILD_WIDGET:r=>`${i.GUILD(r)}/widget.json`,GUILD_WIDGET_SETTINGS:r=>`${i.GUILD(r)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(r,e)=>`/interactions/${r}/${e}/callback`,INVITES:r=>`/invites/${r}`,OAUTH2_APPLICATION:r=>`/oauth2/applications/${r}`,STAGE_INSTANCE_CHANNEL:r=>`${i.STAGE_INSTANCES}/${r}`,STAGE_INSTANCES:"/stage-instances",STICKER:r=>`/stickers/${r}`,TEMPLATE:r=>`/guilds/templates/${r}`,USER:r=>`${i.USERS}/${r}`,USER_APPLICATION_ROLE_CONNECTION:(r,e)=>`${i.USER(r)}/applications/${e}/role-connection`,USER_CHANNELS:r=>`${i.USER(r)}/channels`,USER_CONNECTIONS:r=>`${i.USER(r)}/connections`,USER_GUILD:(r,e)=>`${i.USER_GUILDS(r)}/${e}`,USER_GUILDS:r=>`${i.USER(r)}/guilds`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:r=>`/webhooks/${r}`,WEBHOOK_TOKEN:(r,e)=>`${i.WEBHOOK(r)}/${e}`,WEBHOOK_TOKEN_GITHUB:(r,e)=>`${i.WEBHOOK_TOKEN(r,e)}/github`,WEBHOOK_TOKEN_MESSAGE:(r,e,t)=>`/webhooks/${r}/${e}/messages/${t}`,WEBHOOK_TOKEN_SLACK:(r,e)=>`${i.WEBHOOK_TOKEN(r,e)}/slack`};Ee.exports=i});var f=p((Xt,Ae)=>{var Fe=d(),U=class{constructor(e){this.requestHandler=e}async getAuditLog(e,t){return this.requestHandler.request(Fe.GUILD_AUDIT_LOGS(e),"get","json",t)}};Ae.exports=U});var k=p((Yt,Pe)=>{var _=d(),O=class{constructor(e){this.requestHandler=e}async getAutoModerationRules(e){return this.requestHandler.request(_.GUILD_AUTO_MOD_RULES(e),"get","json")}async getAutoModerationRule(e,t){return this.requestHandler.request(_.GUILD_AUTO_MOD_RULE(e,t),"get","json")}async createAutoModerationRule(e,t){return this.requestHandler.request(_.GUILD_AUTO_MOD_RULES(e),"post","json",t)}async editAutoModerationRule(e,t,s){return this.requestHandler.request(_.GUILD_AUTO_MOD_RULE(e,t),"patch","json",s)}async deleteAutoModerationRule(e,t,s){return this.requestHandler.request(_.GUILD_AUTO_MOD_RULE(e,t),"delete","json",s?{reason:s}:void 0)}};Pe.exports=O});var v=p((zt,Te)=>{var Ie=d(),$=class{constructor(e){this.requestHandler=e}getGateway(){return this.requestHandler.request(Ie.GATEWAY,"get","json")}getGatewayBot(){return this.requestHandler.request(Ie.GATEWAY_BOT,"get","json")}};Te.exports=$});var j=p((Zt,Se)=>{var l=d(),T=S(),ce=/@([^<>@ ]*)/gsmu,B=class{constructor(e,t){this.requestHandler=e,this.disableEveryone=t}async getChannel(e){return this.requestHandler.request(l.CHANNEL(e),"get","json")}async updateChannel(e,t){return this.requestHandler.request(l.CHANNEL(e),"patch","json",t)}async deleteChannel(e,t){return this.requestHandler.request(l.CHANNEL(e),"delete","json",t?{reason:t}:void 0)}async getChannelMessages(e,t={limit:50}){if(t.around?(delete t.before,delete t.after):t.before?(delete t.around,delete t.after):t.after&&(delete t.before,delete t.around),t.limit!==void 0&&(t.limit<T.GET_CHANNEL_MESSAGES_MIN_RESULTS||t.limit>T.GET_CHANNEL_MESSAGES_MAX_RESULTS))throw new RangeError(`Amount of messages that may be requested has to be between ${T.GET_CHANNEL_MESSAGES_MIN_RESULTS} and ${T.GET_CHANNEL_MESSAGES_MAX_RESULTS}`);return this.requestHandler.request(l.CHANNEL_MESSAGES(e),"get","json",t)}async getChannelMessage(e,t){return this.requestHandler.request(l.CHANNEL_MESSAGE(e,t),"get","json")}async createMessage(e,t,s={disableEveryone:this.disableEveryone}){if(typeof t!="string"&&!t.content&&!t.embeds&&!t.sticker_ids&&!t.components&&!t.files)throw new Error("Missing content, embeds, sticker_ids, components, or files");return typeof t=="string"&&(t={content:t}),t.content&&(s.disableEveryone!==void 0?s.disableEveryone:this.disableEveryone)&&(t.content=t.content.replace(ce,Re)),t.files?this.requestHandler.request(l.CHANNEL_MESSAGES(e),"post","multipart",T.standardMultipartHandler(t)):this.requestHandler.request(l.CHANNEL_MESSAGES(e),"post","json",t)}async crosspostMessage(e,t){return this.requestHandler.request(l.CHANNEL_MESSAGE_CROSSPOST(e,t),"post","json")}async createReaction(e,t,s){return this.requestHandler.request(l.CHANNEL_MESSAGE_REACTION_USER(e,t,s,"@me"),"put","json")}async deleteReactionSelf(e,t,s){return this.requestHandler.request(l.CHANNEL_MESSAGE_REACTION_USER(e,t,s,"@me"),"delete","json")}async deleteReaction(e,t,s,n){return n?this.requestHandler.request(l.CHANNEL_MESSAGE_REACTION_USER(e,t,s,n),"delete","json"):this.requestHandler.request(l.CHANNEL_MESSAGE_REACTION(e,t,s),"delete","json")}async getReactions(e,t,s,n){return this.requestHandler.request(l.CHANNEL_MESSAGE_REACTION(e,t,s),"get","json",n)}async deleteAllReactions(e,t){return this.requestHandler.request(l.CHANNEL_MESSAGE_REACTIONS(e,t),"delete","json")}async editMessage(e,t,s,n={disableEveryone:this.disableEveryone}){return typeof s=="string"&&(s={content:s}),s.content&&(n.disableEveryone!==void 0?n.disableEveryone:this.disableEveryone)&&(s.content=s.content.replace(ce,Re)),s.files?this.requestHandler.request(l.CHANNEL_MESSAGE(e,t),"patch","multipart",T.standardMultipartHandler(s)):this.requestHandler.request(l.CHANNEL_MESSAGE(e,t),"patch","json",s)}async deleteMessage(e,t,s){return this.requestHandler.request(l.CHANNEL_MESSAGE(e,t),"delete","json",s?{reason:s}:void 0)}async bulkDeleteMessages(e,t,s){if(t.length<T.BULK_DELETE_MESSAGES_MIN||t.length>T.BULK_DELETE_MESSAGES_MAX)throw new RangeError(`Amount of messages to be deleted has to be between ${T.BULK_DELETE_MESSAGES_MIN} and ${T.BULK_DELETE_MESSAGES_MAX}`);let n=BigInt(Date.now()-142128e7)*BigInt(2)**BigInt(22),o=t.find(R=>BigInt(R)<n);if(o)throw new Error(`The message ${o} is older than 2 weeks and may not be deleted using the bulk delete endpoint`);let P={messages:t};return s&&Object.assign(P,{reason:s}),this.requestHandler.request(l.CHANNEL_BULK_DELETE(e),"post","json",P)}async editChannelPermission(e,t,s){return this.requestHandler.request(l.CHANNEL_PERMISSION(e,t),"put","json",s)}async getChannelInvites(e){return this.requestHandler.request(l.CHANNEL_INVITES(e),"get","json")}async createChannelInvite(e,t={max_age:86400,max_uses:0,temporary:!1,unique:!1}){return this.requestHandler.request(l.CHANNEL_INVITES(e),"post","json",t)}async deleteChannelPermission(e,t,s){return this.requestHandler.request(l.CHANNEL_PERMISSION(e,t),"delete","json",s?{reason:s}:void 0)}async followAnnouncementChannel(e,t){return this.requestHandler.request(l.CHANNEL_FOLLOWERS(e),"post","json",{webhook_channel_id:t})}async startChannelTyping(e){return this.requestHandler.request(l.CHANNEL_TYPING(e),"post","json")}async getChannelPinnedMessages(e){return this.requestHandler.request(l.CHANNEL_PINS(e),"get","json")}async addChannelPinnedMessage(e,t,s){return this.requestHandler.request(l.CHANNEL_PIN(e,t),"put","json",s?{reason:s}:void 0)}async removeChannelPinnedMessage(e,t,s){return this.requestHandler.request(l.CHANNEL_PIN(e,t),"delete","json",s?{reason:s}:void 0)}async createThreadWithMessage(e,t,s){return this.requestHandler.request(l.CHANNEL_MESSAGE_THREADS(e,t),"post","json",s)}async createThreadWithoutMessage(e,t){return this.requestHandler.request(l.CHANNEL_THREADS(e),"post","json",t)}async joinThread(e){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBER(e,"@me"),"put","json")}async addThreadMember(e,t){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBER(e,t),"put","json")}async leaveThread(e){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBER(e,"@me"),"delete","json")}removeThreadMember(e,t){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBER(e,t),"delete","json")}async getThreadMember(e,t,s){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBER(e,t),"get","json",s?{with_member:!0}:void 0)}async getThreadMembers(e,t){return this.requestHandler.request(l.CHANNEL_THREAD_MEMBERS(e),"get","json",t)}async getChannelArchivedPublicThreads(e,t){return this.requestHandler.request(l.CHANNEL_THREADS_ARCHIVED_PUBLIC(e),"get","json",t)}async getChannelArchivedPrivateThreads(e,t){return this.requestHandler.request(l.CHANNEL_THREADS_ARCHIVED_PRIVATE(e),"get","json",t)}async getChannelArchivedPrivateThreadsUser(e,t){return this.requestHandler.request(l.CHANNEL_THREADS_ARCHIVED_PRIVATE_USER(e),"get","json",t)}},Xe=/^[&!]?\d+$/;function Re(r,e){return Xe.test(e)?`@${e}`:`@\u200B${e}`}Se.exports=B});var w=p((es,ye)=>{var Ye=require("form-data"),I=d(),W=class{constructor(e){this.requestHandler=e}async getEmojis(e){return this.requestHandler.request(I.GUILD_EMOJIS(e),"get","json")}async getEmoji(e,t){return this.requestHandler.request(I.GUILD_EMOJI(e,t),"get","json")}async createEmoji(e,t){return this.requestHandler.request(I.GUILD_EMOJIS(e),"post","json",t)}async updateEmoji(e,t,s){return this.requestHandler.request(I.GUILD_EMOJI(e,t),"patch","json",s)}async deleteEmoji(e,t,s){return this.requestHandler.request(I.GUILD_EMOJI(e,t),"delete","json",s?{reason:s}:void 0)}async getSticker(e){return this.requestHandler.request(I.STICKER(e),"get","json")}async getGuildStickers(e){return this.requestHandler.request(I.GUILD_STICKERS(e),"get","json")}async getGuildSticker(e,t){return this.requestHandler.request(I.GUILD_STICKER(e,t),"get","json")}createGuildSticker(e,t){let s=new Ye,n=t.reason;t.reason&&delete t.reason;for(let o of Object.keys(t))s.append(o,t[o]);return this.requestHandler.request(I.GUILD_STICKERS(e),"post","multipart",s,n?{"X-Audit-Log-Reason":n}:void 0)}updateGuildSticker(e,t,s){return this.requestHandler.request(I.GUILD_STICKER(e,t),"patch","json",s)}deleteGuildSticker(e,t,s){return this.requestHandler.request(I.GUILD_STICKER(e,t),"delete","json",s?{reason:s}:void 0)}};ye.exports=W});var J=p((ts,ge)=>{var u=d(),G=S(),K=class{constructor(e){this.requestHandler=e}async createGuild(e){return this.requestHandler.request(u.GUILDS,"post","json",e)}async getGuild(e,t){return this.requestHandler.request(u.GUILD(e),"get","json",t!==void 0?{with_counts:t}:void 0)}async getGuildPreview(e){return this.requestHandler.request(u.GUILD_PREVIEW(e),"get","json")}async updateGuild(e,t){return this.requestHandler.request(u.GUILD(e),"patch","json",t)}async deleteGuild(e){return this.requestHandler.request(u.GUILD(e),"delete","json")}async getGuildChannels(e){return this.requestHandler.request(u.GUILD_CHANNELS(e),"get","json")}async createGuildChannel(e,t){return this.requestHandler.request(u.GUILD_CHANNELS(e),"post","json",t)}async updateChannelPositions(e,t,s){return this.requestHandler.request(u.GUILD_CHANNELS(e),"patch","json",t,s?{"X-Audit-Log-Reason":s}:void 0)}async listActiveThreads(e){return this.requestHandler.request(u.GUILD_THREADS_ACTIVE(e),"get","json")}async getGuildMember(e,t){return this.requestHandler.request(u.GUILD_MEMBER(e,t),"get","json")}async getGuildMembers(e,t){return this.requestHandler.request(u.GUILD_MEMBERS(e),"get","json",t)}async searchGuildMembers(e,t){if(t.limit!==void 0&&(t.limit<G.SEARCH_MEMBERS_MIN_RESULTS||t.limit>G.SEARCH_MEMBERS_MAX_RESULTS))throw new RangeError(`Limit for searching guild members has to be between ${G.SEARCH_MEMBERS_MIN_RESULTS} and ${G.SEARCH_MEMBERS_MAX_RESULTS}`);return this.requestHandler.request(u.GUILD_MEMBERS_SEARCH(e),"get","json",t)}async addGuildMember(e,t,s){return this.requestHandler.request(u.GUILD_MEMBER(e,t),"put","json",s)}async updateGuildMember(e,t,s){return this.requestHandler.request(u.GUILD_MEMBER(e,t),"patch","json",s)}async updateSelf(e,t){return this.requestHandler.request(u.GUILD_MEMBER(e,"@me"),"patch","json",t)}async addGuildMemberRole(e,t,s,n){return this.requestHandler.request(u.GUILD_MEMBER_ROLE(e,t,s),"put","json",n?{reason:n}:void 0)}async removeGuildMemberRole(e,t,s,n){return this.requestHandler.request(u.GUILD_MEMBER_ROLE(e,t,s),"delete","json",n?{reason:n}:void 0)}async removeGuildMember(e,t,s){return this.requestHandler.request(u.GUILD_MEMBER(e,t),"delete","json",s?{reason:s}:void 0)}async getGuildBans(e,t){return this.requestHandler.request(u.GUILD_BANS(e),"get","json",t)}async getGuildBan(e,t){return this.requestHandler.request(u.GUILD_BAN(e,t),"get","json")}async createGuildBan(e,t,s){return this.requestHandler.request(u.GUILD_BAN(e,t),"put","json",s)}async removeGuildBan(e,t,s){return this.requestHandler.request(u.GUILD_BAN(e,t),"delete","json",s?{reason:s}:void 0)}async getGuildRoles(e){return this.requestHandler.request(u.GUILD_ROLES(e),"get","json")}async createGuildRole(e,t){return this.requestHandler.request(u.GUILD_ROLES(e),"post","json",t)}async updateGuildRolePositions(e,t,s){return this.requestHandler.request(u.GUILD_ROLES(e),"patch","json",t,s?{"X-Audit-Log-Reason":s}:void 0)}async updateGuildRole(e,t,s){return this.requestHandler.request(u.GUILD_ROLE(e,t),"patch","json",s)}async removeGuildRole(e,t,s){return this.requestHandler.request(u.GUILD_ROLE(e,t),"delete","json",s?{reason:s}:void 0)}async getGuildPruneCount(e,t){return this.requestHandler.request(u.GUILD_PRUNE(e),"get","json",t)}async startGuildPrune(e,t){return this.requestHandler.request(u.GUILD_PRUNE(e),"post","json",t)}async getGuildVoiceRegions(e){return this.requestHandler.request(u.GUILD_VOICE_REGIONS(e),"get","json")}async getGuildInvites(e){return this.requestHandler.request(u.GUILD_INVITES(e),"get","json")}async getGuildIntegrations(e){return this.requestHandler.request(u.GUILD_INTEGRATIONS(e),"get","json")}async removeGuildIntegration(e,t,s){return this.requestHandler.request(u.GUILD_INTEGRATION(e,t),"delete","json",s?{reason:s}:void 0)}async getGuildWidgetSettings(e){return this.requestHandler.request(u.GUILD_WIDGET_SETTINGS(e),"get","json")}async updateGuildWidgetSettings(e,t){return this.requestHandler.request(u.GUILD_WIDGET_SETTINGS(e),"patch","json",t)}async getGuildWidget(e){return this.requestHandler.request(u.GUILD_WIDGET(e),"get","json")}async getGuildVanityURL(e){return this.requestHandler.request(u.GUILD_VANITY(e),"get","json")}async getGuildWelcomeScreen(e){return this.requestHandler.request(u.GUILD_WELCOME_SCREEN(e),"get","json")}async editGuildWelcomeScreen(e,t){return this.requestHandler.request(u.GUILD_WELCOME_SCREEN(e),"patch","json",t)}updateCurrentUserVoiceState(e,t){return this.requestHandler.request(u.GUILD_VOICE_STATE_USER(e,"@me"),"patch","json",t)}updateUserVoiceState(e,t,s){return this.requestHandler.request(u.GUILD_VOICE_STATE_USER(e,t),"patch","json",s)}};ge.exports=K});var V=p((ss,he)=>{var m=d(),b=S(),x=class{constructor(e){this.requestHandler=e}async listGuildScheduledEvents(e,t){return this.requestHandler.request(m.GUILD_SCHEDULED_EVENTS(e),"get","json",t!==void 0?{with_user_count:t}:void 0)}async createGuildScheduledEvent(e,t){return this.requestHandler.request(m.GUILD_SCHEDULED_EVENTS(e),"post","json",t)}async getGuildScheduledEvent(e,t,s){return this.requestHandler.request(m.GUILD_SCHEDULED_EVENT(e,t),"get","json",s!==void 0?{with_user_count:s}:void 0)}async editGuildScheduledEvent(e,t,s){return this.requestHandler.request(m.GUILD_SCHEDULED_EVENT(e,t),"patch","json",s)}async deleteGuildScheduledEvent(e,t){return this.requestHandler.request(m.GUILD_SCHEDULED_EVENT(e,t),"delete","json")}async getGuildScheduledEventUsers(e,t,s){if((s==null?void 0:s.limit)!==void 0&&(s.limit<b.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS||s.limit>b.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS))throw new RangeError(`The maximum amount of users that may be requested has to be between ${b.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS} and ${b.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS}`);return this.requestHandler.request(m.GUILD_SCHEDULED_EVENT_USERS(e,t),"get","json",s)}};he.exports=x});var F=p((rs,me)=>{var g=d(),Q=class{constructor(e){this.requestHandler=e}getGuildTemplate(e){return this.requestHandler.request(g.TEMPLATE(e),"get","json")}createGuildFromGuildTemplate(e,t){return this.requestHandler.request(g.TEMPLATE(e),"post","json",t)}getGuildTemplates(e){return this.requestHandler.request(g.GUILD_TEMPLATES(e),"get","json")}createGuildTemplate(e,t){return this.requestHandler.request(g.GUILD_TEMPLATES(e),"post","json",t)}syncGuildTemplate(e,t){return this.requestHandler.request(g.GUILD_TEMPLATE(e,t),"put","json")}modifyGuildTemplate(e,t,s){return this.requestHandler.request(g.GUILD_TEMPLATE(e,t),"patch","json",s)}deleteGuildTemplate(e,t){return this.requestHandler.request(g.GUILD_TEMPLATE(e,t),"delete","json")}};me.exports=Q});var Y=p((ns,_e)=>{var E=d(),ze=S(),X=class{constructor(e,t){this.requestHandler=e,this.webhooks=t}getApplicationCommands(e,t){return this.requestHandler.request(E.APPLICATION_COMMANDS(e),"get","json",t?{with_localizations:t}:void 0)}createApplicationCommand(e,t){return this.requestHandler.request(E.APPLICATION_COMMANDS(e),"post","json",t)}getApplicationCommand(e,t){return this.requestHandler.request(E.APPLICATION_COMMAND(e,t),"get","json")}editApplicationCommand(e,t,s){return this.requestHandler.request(E.APPLICATION_COMMAND(e,t),"patch","json",s)}deleteApplicationCommand(e,t){return this.requestHandler.request(E.APPLICATION_COMMAND(e,t),"delete","json")}bulkOverwriteApplicationCommands(e,t){return this.requestHandler.request(E.APPLICATION_COMMANDS(e),"put","json",t)}getGuildApplicationCommands(e,t,s){return this.requestHandler.request(E.APPLICATION_GUILD_COMMANDS(e,t),"get","json",s?{with_localizations:s}:void 0)}createGuildApplicationCommand(e,t,s){return this.requestHandler.request(E.APPLICATION_GUILD_COMMANDS(e,t),"post","json",s)}getGuildApplicationCommand(e,t,s){return this.requestHandler.request(E.APPLICATION_GUILD_COMMAND(e,t,s),"get","json")}editGuildApplicationCommand(e,t,s,n){return this.requestHandler.request(E.APPLICATION_GUILD_COMMAND(e,t,s),"patch","json",n)}deleteGuildApplicationCommand(e,t,s){return this.requestHandler.request(E.APPLICATION_GUILD_COMMAND(e,t,s),"delete","json")}bulkOverwriteGuildApplicationCommands(e,t,s){return this.requestHandler.request(E.APPLICATION_GUILD_COMMANDS(e,t),"put","json",s)}getGuildApplicationCommandPermissions(e,t,s){return s?this.requestHandler.request(E.APPLICATION_GUILD_COMMAND_PERMISSIONS(e,t,s),"get","json"):this.requestHandler.request(E.APPLICATION_GUILD_COMMANDS_PERMISSIONS(e,t),"get","json")}editGuildApplicationCommandPermissions(e,t,s,n){let o={permissions:n};return this.requestHandler.request(E.APPLICATION_GUILD_COMMAND_PERMISSIONS(e,t,s),"put","json",o)}createInteractionResponse(e,t,s){return s.files?this.requestHandler.request(E.INTERACTION_CALLBACK(e,t),"post","multipart",ze.standardMultipartHandler(s)):this.requestHandler.request(E.INTERACTION_CALLBACK(e,t),"post","json",s)}getOriginalInteractionResponse(e,t){return this.webhooks.getWebhookMessage(e,t,"@original")}editOriginalInteractionResponse(e,t,s){return this.webhooks.editWebhookMessage(e,t,"@original",s)}deleteOriginalInteractionResponse(e,t){return this.webhooks.deleteWebhookMessage(e,t,"@original")}createFollowupMessage(e,t,s){return this.webhooks.executeWebhook(e,t,s)}getFollowupMessage(e,t,s){return this.webhooks.getWebhookMessage(e,t,s)}editFollowupMessage(e,t,s,n){return this.webhooks.editWebhookMessage(e,t,s,n)}deleteFollowupMessage(e,t,s){return this.webhooks.deleteWebhookMessage(e,t,s)}};_e.exports=X});var Z=p((is,be)=>{var Ge=d(),z=class{constructor(e){this.requestHandler=e}async getInvite(e,t){return this.requestHandler.request(Ge.INVITES(e),"get","json",t)}async deleteInvite(e){return this.requestHandler.request(Ge.INVITES(e),"delete","json")}};be.exports=z});var te=p((os,Ne)=>{var N=d(),ee=class{constructor(e){this.requestHandler=e}async createStageInstance(e){return this.requestHandler.request(N.STAGE_INSTANCES,"post","json",e)}async getStageInstance(e){return this.requestHandler.request(N.STAGE_INSTANCE_CHANNEL(e),"get","json")}async editStageInstance(e,t){return this.requestHandler.request(N.STAGE_INSTANCE_CHANNEL(e),"patch","json",t)}async deleteStageInstance(e,t){return this.requestHandler.request(N.STAGE_INSTANCE_CHANNEL(e),"delete","json",t?{reason:t}:void 0)}};Ne.exports=ee});var re=p((us,He)=>{var c=d(),se=class{constructor(e){this.requestHandler=e}async getSelf(){return this.requestHandler.request(c.USER("@me"),"get","json")}async getUser(e){return this.requestHandler.request(c.USER(e),"get","json")}async updateSelf(e){return this.requestHandler.request(c.USER("@me"),"patch","json",e)}async getGuilds(e){return this.requestHandler.request(c.USER_GUILDS("@me"),"get","json",e)}async leaveGuild(e){return this.requestHandler.request(c.USER_GUILD("@me",e),"delete","json")}async createDirectMessageChannel(e){return this.requestHandler.request(c.USER_CHANNELS("@me"),"post","json",{recipient_id:e})}async createGroupDirectMessageChannel(e){return this.requestHandler.request(c.USER_CHANNELS("@me"),"post","json",e)}async getConnections(){return this.requestHandler.request(c.USER_CONNECTIONS("@me"),"get","json")}async getApplicationRoleConnection(e){return this.requestHandler.request(c.USER_APPLICATION_ROLE_CONNECTION("@me",e),"get","json")}async updateApplicationRoleConnection(e,t){return this.requestHandler.request(c.USER_APPLICATION_ROLE_CONNECTION("@me",e),"put","json",t)}};He.exports=se});var ie=p((ls,Ce)=>{var Ze=d(),ne=class{constructor(e){this.requestHandler=e}async getVoiceRegions(){return this.requestHandler.request(Ze.VOICE_REGIONS,"get","json")}};Ce.exports=ne});var ue=p((as,qe)=>{var A=d(),Le=S(),et=/@([^<>@ ]*)/gsmu,oe=class{constructor(e,t){this.requestHandler=e,this.disableEveryone=t}async createWebhook(e,t){return this.requestHandler.request(A.CHANNEL_WEBHOOKS(e),"post","json",t)}async getChannelWebhooks(e){return this.requestHandler.request(A.CHANNEL_WEBHOOKS(e),"get","json")}async getGuildWebhooks(e){return this.requestHandler.request(A.GUILD_WEBHOOKS(e),"get","json")}async getWebhook(e,t){return t?this.requestHandler.request(A.WEBHOOK_TOKEN(e,t),"get","json"):this.requestHandler.request(A.WEBHOOK(e),"get","json")}async updateWebhook(e,t,s){return s?this.requestHandler.request(A.WEBHOOK_TOKEN(e,s),"patch","json",t):this.requestHandler.request(A.WEBHOOK(e),"patch","json",t)}async deleteWebhook(e,t){return t?this.requestHandler.request(A.WEBHOOK_TOKEN(e,t),"delete","json"):this.requestHandler.request(A.WEBHOOK(e),"delete","json")}async executeWebhook(e,t,s,n={disableEveryone:this.disableEveryone}){if(typeof s!="string"&&!(s!=null&&s.content)&&!(s!=null&&s.embeds)&&!(s!=null&&s.components)&&!(s!=null&&s.files))throw new Error("Missing content or embeds or components or files");typeof s=="string"&&(s={content:s}),s.content&&((n==null?void 0:n.disableEveryone)!==void 0?n.disableEveryone:this.disableEveryone)&&(s.content=s.content.replace(et,st)),n&&delete n.disableEveryone;let o=n?new URLSearchParams(n):void 0;return s.files?this.requestHandler.request(`${A.WEBHOOK_TOKEN(e,t)}${o?`?${o.toString()}`:void 0}`,"post","multipart",Le.standardMultipartHandler(s)):this.requestHandler.request(`${A.WEBHOOK_TOKEN(e,t)}${o?`?${o.toString()}`:void 0}`,"post","json",s)}async executeWebhookSlack(e,t,s,n){let o=n?new URLSearchParams(n):void 0;return this.requestHandler.request(`${A.WEBHOOK_TOKEN_SLACK(e,t)}${o?`?${o.toString()}`:void 0}`,"post","json",s)}async executeWebhookGitHub(e,t,s,n){let o=n?new URLSearchParams(n):void 0;return this.requestHandler.request(`${A.WEBHOOK_TOKEN_GITHUB(e,t)}${o?`?${o.toString()}`:void 0}`,"post","json",s)}async getWebhookMessage(e,t,s,n){return this.requestHandler.request(A.WEBHOOK_TOKEN_MESSAGE(e,t,s),"get","json",n?{thread_id:n}:void 0)}async editWebhookMessage(e,t,s,n){let o;return n.thread_id&&(o=n.thread_id),delete n.thread_id,n.files?this.requestHandler.request(`${A.WEBHOOK_TOKEN_MESSAGE(e,t,s)}${o?`?thread_id=${o}`:""}`,"patch","multipart",Le.standardMultipartHandler(n)):this.requestHandler.request(`${A.WEBHOOK_TOKEN_MESSAGE(e,t,s)}${o?`?thread_id=${o}`:""}`,"patch","json",n)}async deleteWebhookMessage(e,t,s,n){return this.requestHandler.request(`${A.WEBHOOK_TOKEN_MESSAGE(e,t,s)}${n?`?thread_id=${n}`:""}`,"delete","json")}},tt=/^[&!]?\d+$/;function st(r,e){return tt.test(e)?`@${e}`:`@\u200B${e}`}qe.exports=oe});var Me=p((ps,rt)=>{rt.exports={name:"snowtransfer",version:"0.7.0",description:"Minimalistic Rest client for the Discord Api",main:"./dist/index.js",types:"./dist/index.d.ts",engines:{node:">=12.0.0"},keywords:["discord","api","rest","http","microservice","discord bot","discord bot microservice","microservice bot"],scripts:{"build:src":"tsup src/index.ts --dts --sourcemap --format cjs --target node12 --minify","build:docs":"typedoc --name SnowTransfer --excludeExternals --sort static-first --sort alphabetical"},repository:{type:"git",url:"git+https://github.com/DasWolke/SnowTransfer.git"},bugs:"https://github.com/DasWolke/SnowTransfer/issues",author:"wolke <wolke@weeb.sh>",license:"MIT",dependencies:{centra:"^2.6.0","discord-api-types":"^0.37.31","form-data":"^4.0.0"},devDependencies:{"@types/centra":"^2.2.0","@types/node":"^18.11.19","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",eslint:"^8.33.0",tsup:"^6.5.0",typedoc:"^0.23.24","typedoc-plugin-mdn-links":"^2.0.2",typescript:"^4.9.5"},files:["dist","README.md","LICENSE.md"]}});var Ue,nt,ds,De,le,it,ot,ut,lt,at,pt,dt,Et,At,Pt,H,C,ae,L,fe=We(()=>{Ue=require("events"),nt=require("crypto"),ds=require("form-data"),De=require("centra"),le=d(),{version:it}=Me(),ot=S(),ut=/(?:\/bans)|(?:\/prune)/,lt=/application\/json/,at=/\/([a-z-]+)\/(?:\d{17,19})/g,pt=/\/reactions\/[^/]+/g,dt=/\/reactions\/:id\/[^/]+/g,Et=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/,At=/\/messages\/:id$/,Pt=/\/guilds\/\d+\/channels$/,H=class extends Error{constructor(t,s,n,o){var P;super();this.name="DiscordAPIError",this.message=s.message||String(s),this.method=n,this.path=t,this.code=(P=s.code)!=null?P:4e3,this.httpStatus=o}},C=class{constructor(){this.buckets={};this._global=!1;this.globalReset=0;this.globalResetTimeout=null}get global(){return this._global}set global(e){if(e&&this.globalReset!==0){this.globalResetTimeout&&clearTimeout(this.globalResetTimeout);let t=this;this.globalResetTimeout=setTimeout(()=>{t.global=!1},this.globalReset).unref()}else{this.globalResetTimeout&&clearTimeout(this.globalResetTimeout),this.globalResetTimeout=null,this.globalReset=0;for(let t of Object.values(this.buckets))t.checkQueue()}this._global=e}routify(e,t){let s=e.replace(at,function(n,o){return o==="channels"||o==="guilds"||o==="webhooks"?n:`/${o}/:id`}).replace(pt,"/reactions/:id").replace(dt,"/reactions/:id/:userID").replace(Et,"/webhooks/$1/:token");if(t.toUpperCase()==="DELETE"&&At.test(s)?s=t+s:t.toUpperCase()==="GET"&&Pt.test(s)&&(s="/guilds/:id/channels"),t==="PUT"||t==="DELETE"){let n=s.indexOf("/reactions");n!==-1&&(s="MODIFY"+s.slice(0,n+10))}return s}queue(e,t,s){let n=this.routify(t,s);this.buckets[n]||(this.buckets[n]=new ae(this,n)),this.buckets[n].queue(e)}},ae=class{constructor(e,t){this.fnQueue=[];this.limit=5;this.remaining=1;this.reset=5e3;this.resetTimeout=null;this.ratelimiter=e,this.routeKey=t}queue(e){return new Promise(t=>{let s=()=>(this.remaining--,this.resetTimeout||(this.resetTimeout=setTimeout(()=>this.resetRemaining(),this.reset)),this.remaining!==0&&this.checkQueue(),t(e(this)));this.fnQueue.push({fn:e,callback:s}),this.checkQueue()})}checkQueue(){this.ratelimiter.global||this.fnQueue.length&&this.remaining!==0&&this.fnQueue.splice(0,1)[0].callback()}resetRemaining(){this.remaining=this.limit,this.resetTimeout&&(clearTimeout(this.resetTimeout),this.resetTimeout=null),this.fnQueue.length?this.checkQueue():delete this.ratelimiter.buckets[this.routeKey]}dropQueue(){this.fnQueue.length=0}},L=class extends Ue.EventEmitter{constructor(t,s){super();this.ratelimiter=t,this.options={baseHost:le.BASE_HOST,baseURL:le.BASE_URL,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${it}) Node.js/${process.version}`}},s.token&&(this.options.headers.Authorization=s.token),this.options.baseHost=s.baseHost,this.apiURL=this.options.baseHost+le.BASE_URL,this.latency=500}request(t,s,n="json",o,P){return new Promise(async(R,h)=>{this.ratelimiter.queue(async q=>{let M=nt.randomBytes(20).toString("hex");try{this.emit("request",M,{endpoint:t,method:s,dataType:n,data:o!=null?o:{}});let a;if(n=="json")a=await this._request(t,s,o,s==="get"||ut.test(t),P);else if(n=="multipart"&&o)a=await this._multiPartRequest(t,s,o,P);else throw new Error("Forbidden dataType. Use json or multipart or ensure multipart has FormData");if(a.statusCode&&!ot.OK_STATUS_CODES.includes(a.statusCode)&&a.statusCode!==429)throw new H(t,a.headers["content-type"]&<.test(a.headers["content-type"])?{message:JSON.stringify(await a.json())}:{message:String(a.body)},s,a.statusCode);if(this._applyRatelimitHeaders(q,a.headers),a.statusCode===429){if(!this.ratelimiter.global){let y=JSON.parse(String(a.body));y.reset_after!==void 0?this.ratelimiter.globalReset=y.reset_after*1e3:this.ratelimiter.globalReset=1e3,y.global!==void 0&&(this.ratelimiter.global=y.global)}throw this.emit("rateLimit",{timeout:q.reset,limit:q.limit,method:s,path:t,route:this.ratelimiter.routify(t,s)}),new H(t,{message:"You're being ratelimited",code:429},s,a.statusCode)}if(this.emit("done",M,a),a.body){let y;try{y=JSON.parse(a.body.toString())}catch{R(void 0)}return R(y)}else return R(void 0)}catch(a){return this.emit("requestError",M,a),h(a)}},t,s)})}_applyRatelimitHeaders(t,s){s["x-ratelimit-remaining"]&&(t.remaining=parseInt(s["x-ratelimit-remaining"])),s["x-ratelimit-limit"]&&(t.limit=parseInt(s["x-ratelimit-limit"])),s["x-ratelimit-reset"]&&(t.reset=parseInt(s["x-ratelimit-reset"])-Date.now())}async _request(t,s,n,o=!1,P){let R={...this.options.headers};P&&Object.assign(R,P),typeof n!="string"&&(n==null?void 0:n.reason)&&(R["X-Audit-Log-Reason"]=encodeURIComponent(n.reason),delete n.reason);let h=De(this.apiURL,s).path(t).header({...this.options.headers,...R});return o?h.query(n).send():(n&&typeof n=="object"?h.body(n,"json"):n&&h.body(n),h.send())}async _multiPartRequest(t,s,n,o){let P={...this.options.headers,...n.getHeaders()};return o&&Object.assign(P,o),De(this.apiURL,s).path(t).header(P).body(n.getBuffer()).timeout(15e3).send()}}});var $e=p((Ps,ke)=>{fe();var It=f(),Tt=k(),ct=v(),Rt=j(),St=w(),yt=J(),gt=V(),ht=F(),mt=Y(),_t=Z(),Gt=te(),bt=re(),Nt=ie(),Ht=ue(),Oe=d(),pe=class{constructor(e,t){if(typeof e=="string"&&e==="")throw new Error("Missing token");e&&!e.startsWith("Bot")&&!e.startsWith("Bearer")&&(e=`Bot ${e}`),this.options={baseHost:Oe.BASE_HOST,disableEveryone:!1},this.token=e,Object.assign(this.options,t),this.ratelimiter=new C,this.requestHandler=new L(this.ratelimiter,{token:this.token,baseHost:this.options.baseHost||Oe.BASE_HOST}),this.channel=new Rt(this.requestHandler,this.options.disableEveryone),this.user=new bt(this.requestHandler),this.guildAssets=new St(this.requestHandler),this.webhook=new Ht(this.requestHandler,this.options.disableEveryone),this.guild=new yt(this.requestHandler),this.guildScheduledEvent=new gt(this.requestHandler),this.guildTemplate=new ht(this.requestHandler),this.interaction=new mt(this.requestHandler,this.webhook),this.invite=new _t(this.requestHandler),this.voice=new Nt(this.requestHandler),this.bot=new ct(this.requestHandler),this.auditLog=new It(this.requestHandler),this.stageInstance=new Gt(this.requestHandler),this.autoMod=new Tt(this.requestHandler)}};ke.exports=pe});var xt={};we(xt,{AuditLogMethods:()=>Ct,AutoModerationMethods:()=>Lt,BotMethods:()=>qt,ChannelMethods:()=>Mt,Constants:()=>wt,Endpoints:()=>Kt,GuildAssetsMethods:()=>Dt,GuildMethods:()=>Ut,GuildScheduledEventMethods:()=>ft,GuildTemplateMethods:()=>Ot,InteractionMethods:()=>kt,InviteMethods:()=>$t,SnowTransfer:()=>Jt,StageInstanceMethods:()=>vt,UserMethods:()=>Bt,VoiceMethods:()=>jt,WebhookMethods:()=>Wt});module.exports=Je(xt);var Ct=f(),Lt=k(),qt=v(),Mt=j(),Dt=w(),Ut=J(),ft=V(),Ot=F(),kt=Y(),$t=Z(),vt=te(),Bt=re(),jt=ie(),Wt=ue(),wt=S(),Kt=d(),Jt=$e();0&&(module.exports={AuditLogMethods,AutoModerationMethods,BotMethods,ChannelMethods,Constants,Endpoints,GuildAssetsMethods,GuildMethods,GuildScheduledEventMethods,GuildTemplateMethods,InteractionMethods,InviteMethods,SnowTransfer,StageInstanceMethods,UserMethods,VoiceMethods,WebhookMethods}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "snowtransfer", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "Minimalistic Rest client for the Discord Api", | ||
@@ -33,3 +33,3 @@ "main": "./dist/index.js", | ||
"centra": "^2.6.0", | ||
"discord-typings": "^10.4.1", | ||
"discord-api-types": "^0.37.31", | ||
"form-data": "^4.0.0" | ||
@@ -39,3 +39,3 @@ }, | ||
"@types/centra": "^2.2.0", | ||
"@types/node": "^18.11.18", | ||
"@types/node": "^18.11.19", | ||
"@typescript-eslint/eslint-plugin": "^5.50.0", | ||
@@ -42,0 +42,0 @@ "@typescript-eslint/parser": "^5.50.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
455461
3388
+ Addeddiscord-api-types@^0.37.31
+ Addeddiscord-api-types@0.37.107(transitive)
- Removeddiscord-typings@^10.4.1
- Removeddiscord-typings@10.4.1(transitive)