snowtransfer
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -1,2 +0,2 @@ | ||
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function __init(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function __require(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var require_Constants=__commonJS({"src/Constants.ts"(exports,module2){var import_buffer=require("buffer");var import_stream=require("stream");var import_web=require("stream/web");var import_undici2=require("undici");var Constants3={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(data){const form=new import_undici2.FormData;if(data.files&&Array.isArray(data.files)&&data.files.every(f=>!!f.name&&!!f.file)){let index=0;for(const file of data.files){Constants3.standardAddToFormHandler(form,`files[${index}]`,file.file,file.name);delete file.file;index++}}if(data.data)delete data.files;form.append("payload_json",JSON.stringify(data));return form},standardAddToFormHandler(form,name,value,filename){if(value instanceof Buffer)form.append(name,new import_buffer.Blob([value]),filename);else if(value instanceof import_buffer.Blob||value instanceof import_undici2.File)form.append(name,value,filename);else{form.set(name,{[Symbol.toStringTag]:"File",name,stream:()=>value instanceof import_web.ReadableStream?import_stream.Readable.fromWeb(value):value},filename)}}};module2.exports=Constants3}});var require_Endpoints=__commonJS({"src/Endpoints.ts"(exports,module2){"use strict";var Constants3=require_Constants();var Endpoints3={BASE_URL:"/api/v"+Constants3.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(appID,cmdID)=>`${Endpoints3.APPLICATION_COMMANDS(appID)}/${cmdID}`,APPLICATION_COMMANDS:appID=>`/applications/${appID}/commands`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(appID,guildID)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appID,guildID)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(appID,guildID,cmdID)=>`${Endpoints3.APPLICATION_GUILD_COMMAND(appID,guildID,cmdID)}/permissions`,APPLICATION_GUILD_COMMAND:(appID,guildID,cmdID)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appID,guildID)}/${cmdID}`,APPLICATION_GUILD_COMMANDS:(appID,guildID)=>`/applications/${appID}/guilds/${guildID}/commands`,CHANNEL:chanID=>`${Endpoints3.CHANNELS}/${chanID}`,CHANNEL_BULK_DELETE:chanID=>`${Endpoints3.CHANNEL_MESSAGES(chanID)}/bulk-delete`,CHANNEL_FOLLOWERS:chanID=>`${Endpoints3.CHANNEL(chanID)}/followers`,CHANNEL_INVITES:chanID=>`${Endpoints3.CHANNEL(chanID)}/invites`,CHANNEL_MESSAGE:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGES(chanID)}/${msgID}`,CHANNEL_MESSAGE_CROSSPOST:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/crosspost`,CHANNEL_MESSAGE_REACTION:(chanID,msgID,reaction)=>`${Endpoints3.CHANNEL_MESSAGE_REACTIONS(chanID,msgID)}/${reaction}`,CHANNEL_MESSAGE_REACTION_USER:(chanID,msgID,reaction,userID)=>`${Endpoints3.CHANNEL_MESSAGE_REACTION(chanID,msgID,reaction)}/${userID}`,CHANNEL_MESSAGE_REACTIONS:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/reactions`,CHANNEL_MESSAGE_THREADS:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/threads`,CHANNEL_MESSAGES:chanID=>`${Endpoints3.CHANNEL(chanID)}/messages`,CHANNEL_PERMISSION:(chanID,permID)=>`${Endpoints3.CHANNEL_PERMISSIONS(chanID)}/${permID}`,CHANNEL_PERMISSIONS:chanID=>`${Endpoints3.CHANNEL(chanID)}/permissions`,CHANNEL_PIN:(chanID,msgID)=>`${Endpoints3.CHANNEL_PINS(chanID)}/${msgID}`,CHANNEL_PINS:chanID=>`${Endpoints3.CHANNEL(chanID)}/pins`,CHANNEL_RECIPIENT:(chanID,userID)=>`${Endpoints3.CHANNEL(chanID)}/recipients/${userID}`,CHANNEL_THREADS:chanID=>`${Endpoints3.CHANNEL(chanID)}/threads`,CHANNEL_THREAD_MEMBER:(chanID,memberID)=>`${Endpoints3.CHANNEL_THREAD_MEMBERS(chanID)}/${memberID}`,CHANNEL_THREAD_MEMBERS:chanID=>`${Endpoints3.CHANNEL(chanID)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:chanID=>`${Endpoints3.CHANNEL_THREADS(chanID)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:chanID=>`${Endpoints3.CHANNEL(chanID)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:chanID=>`${Endpoints3.CHANNEL_THREADS(chanID)}/archived/public`,CHANNEL_TYPING:chanID=>`${Endpoints3.CHANNEL(chanID)}/typing`,CHANNEL_WEBHOOKS:chanID=>`${Endpoints3.CHANNEL(chanID)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:guildID=>`${Endpoints3.GUILDS}/${guildID}`,GUILD_AUDIT_LOGS:guildID=>`${Endpoints3.GUILD(guildID)}/audit-logs`,GUILD_AUTO_MOD_RULE:(guildID,ruleID)=>`${Endpoints3.GUILD_AUTO_MOD_RULES(guildID)}/${ruleID}`,GUILD_AUTO_MOD_RULES:guildID=>`${Endpoints3.GUILD(guildID)}/auto-moderation/rules`,GUILD_BAN:(guildID,memberID)=>`${Endpoints3.GUILD_BANS(guildID)}/${memberID}`,GUILD_BANS:guildID=>`${Endpoints3.GUILD(guildID)}/bans`,GUILD_CHANNELS:guildID=>`${Endpoints3.GUILD(guildID)}/channels`,GUILD_EMOJI:(guildID,emojiID)=>`${Endpoints3.GUILD_EMOJIS(guildID)}/${emojiID}`,GUILD_EMOJIS:guildID=>`${Endpoints3.GUILD(guildID)}/emojis`,GUILD_INVITES:guildID=>`${Endpoints3.GUILD(guildID)}/invites`,GUILD_INTEGRATION:(guildID,integrationID)=>`${Endpoints3.GUILD_INTEGRATIONS(guildID)}/${integrationID}`,GUILD_INTEGRATIONS:guildID=>`${Endpoints3.GUILD(guildID)}/integrations`,GUILD_MEMBER:(guildID,memberID)=>`${Endpoints3.GUILD_MEMBERS(guildID)}/${memberID}`,GUILD_MEMBER_ROLE:(guildID,memberID,roleID)=>`${Endpoints3.GUILD_MEMBER(guildID,memberID)}/roles/${roleID}`,GUILD_MEMBERS:guildID=>`${Endpoints3.GUILD(guildID)}/members`,GUILD_MEMBERS_SEARCH:guildID=>`${Endpoints3.GUILD_MEMBERS(guildID)}/search`,GUILD_PREVIEW:guildID=>`${Endpoints3.GUILD(guildID)}/preview`,GUILD_PRUNE:guildID=>`${Endpoints3.GUILD(guildID)}/prune`,GUILD_ROLE:(guildID,roleID)=>`${Endpoints3.GUILD_ROLES(guildID)}/${roleID}`,GUILD_ROLES:guildID=>`${Endpoints3.GUILD(guildID)}/roles`,GUILD_SCHEDULED_EVENTS:guildID=>`${Endpoints3.GUILD(guildID)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(guildID,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENTS(guildID)}/${eventId}`,GUILD_SCHEDULED_EVENT_USERS:(guildID,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENT(guildID,eventId)}/users`,GUILD_STICKER:(guildID,stickerID)=>`${Endpoints3.GUILD_STICKERS(guildID)}/${stickerID}`,GUILD_STICKERS:guildID=>`${Endpoints3.GUILD(guildID)}/stickers`,GUILD_TEMPLATE:(guildID,code)=>`${Endpoints3.GUILD_TEMPLATES(guildID)}/${code}`,GUILD_THREADS_ACTIVE:guildID=>`${Endpoints3.GUILD(guildID)}/threads/active`,GUILD_TEMPLATES:guildID=>`${Endpoints3.GUILD(guildID)}/templates`,GUILD_VANITY:guildID=>`${Endpoints3.GUILD(guildID)}/vanity-url`,GUILD_VOICE_REGIONS:guildID=>`${Endpoints3.GUILD(guildID)}/regions`,GUILD_VOICE_STATE_USER:(guildID,memberID)=>`${Endpoints3.GUILD(guildID)}/voice-states/${memberID}`,GUILD_WEBHOOKS:guildID=>`${Endpoints3.GUILD(guildID)}/webhooks`,GUILD_WELCOME_SCREEN:guildID=>`${Endpoints3.GUILD(guildID)}/welcome-screen`,GUILD_WIDGET:guildID=>`${Endpoints3.GUILD(guildID)}/widget.json`,GUILD_WIDGET_SETTINGS:guildID=>`${Endpoints3.GUILD(guildID)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(interactionID,token)=>`/interactions/${interactionID}/${token}/callback`,INVITES:inviteID=>`/invites/${inviteID}`,OAUTH2_APPLICATION:appID=>`/oauth2/applications/${appID}`,STAGE_INSTANCE_CHANNEL:chanID=>`${Endpoints3.STAGE_INSTANCES}/${chanID}`,STAGE_INSTANCES:"/stage-instances",STICKER:stickerID=>`/stickers/${stickerID}`,TEMPLATE:code=>`/guilds/templates/${code}`,USER:userID=>`${Endpoints3.USERS}/${userID}`,USER_APPLICATION_ROLE_CONNECTION:(userID,appID)=>`${Endpoints3.USER(userID)}/applications/${appID}/role-connection`,USER_CHANNELS:userID=>`${Endpoints3.USER(userID)}/channels`,USER_CONNECTIONS:userID=>`${Endpoints3.USER(userID)}/connections`,USER_GUILD:(userID,guildID)=>`${Endpoints3.USER_GUILDS(userID)}/${guildID}`,USER_GUILDS:userID=>`${Endpoints3.USER(userID)}/guilds`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:hookID=>`/webhooks/${hookID}`,WEBHOOK_TOKEN:(hookID,token)=>`${Endpoints3.WEBHOOK(hookID)}/${token}`,WEBHOOK_TOKEN_GITHUB:(hookID,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookID,token)}/github`,WEBHOOK_TOKEN_MESSAGE:(hookID,token,msgID)=>`/webhooks/${hookID}/${token}/messages/${msgID}`,WEBHOOK_TOKEN_SLACK:(hookID,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookID,token)}/slack`};module2.exports=Endpoints3}});var require_AuditLog=__commonJS({"src/methods/AuditLog.ts"(exports,module2){var Endpoints3=require_Endpoints();var AuditLogMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getAuditLog(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_AUDIT_LOGS(guildId),data,"get","json")}};module2.exports=AuditLogMethods2}});var require_AutoModeration=__commonJS({"src/methods/AutoModeration.ts"(exports,module2){var Endpoints3=require_Endpoints();var AutoModerationMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getAutoModerationRules(guildId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"get","json")}async getAutoModerationRule(guildId,ruleId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"get","json")}async createAutoModerationRule(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"post","json",data)}async editAutoModerationRule(guildId,ruleId,data){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"patch","json",data)}async deleteAutoModerationRule(guildId,ruleId,reason){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"delete","json",{reason})}};module2.exports=AutoModerationMethods2}});var require_Bots=__commonJS({"src/methods/Bots.ts"(exports,module2){var Endpoints3=require_Endpoints();var BotMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}getGateway(){return this.requestHandler.request(Endpoints3.GATEWAY,{},"get","json")}getGatewayBot(){return this.requestHandler.request(Endpoints3.GATEWAY_BOT,{},"get","json")}};module2.exports=BotMethods2}});var require_Channels=__commonJS({"src/methods/Channels.ts"(exports,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var mentionRegex=/@([^<>@ ]*)/gsmu;var ChannelMethods2=class{constructor(requestHandler,disableEveryone){this.requestHandler=requestHandler;this.disableEveryone=disableEveryone}async getChannel(channelId){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"get","json")}async updateChannel(channelId,data){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"patch","json",data)}async deleteChannel(channelId,reason){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"delete","json",{reason})}async getChannelMessages(channelId,options={limit:50}){if(options.around){delete options.before;delete options.after}else if(options.before){delete options.around;delete options.after}else if(options.after){delete options.before;delete options.around}if(options.limit!==void 0&&(options.limit<Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS||options.limit>Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS))throw new RangeError(`Amount of messages that may be requested has to be between ${Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS} and ${Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),options,"get","json")}async getChannelMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"get","json")}async createMessage(channelId,data,options={disableEveryone:this.disableEveryone}){if(typeof data!=="string"&&!data.content&&!data.embeds&&!data.sticker_ids&&!data.components&&!data.files)throw new Error("Missing content, embeds, sticker_ids, components, or files");if(typeof data==="string")data={content:data};if(data.content&&(options.disableEveryone??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(data.files)return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","json",data)}async crosspostMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_CROSSPOST(channelId,messageId),{},"post","json")}async createReaction(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"put","json")}async deleteReactionSelf(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"delete","json")}async deleteReaction(channelId,messageId,emoji,userId){if(!userId)return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),{},"delete","json");return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,userId),{},"delete","json")}async getReactions(channelId,messageId,emoji,query){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),query,"get","json")}async deleteAllReactions(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTIONS(channelId,messageId),{},"delete","json")}async editMessage(channelId,messageId,data,options={disableEveryone:this.disableEveryone}){if(typeof data==="string")data={content:data};if(data.content&&(options.disableEveryone??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(data.files)return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","json",data)}async deleteMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"delete","json",{reason})}async bulkDeleteMessages(channelId,messages,reason){if(messages.length<Constants3.BULK_DELETE_MESSAGES_MIN||messages.length>Constants3.BULK_DELETE_MESSAGES_MAX)throw new RangeError(`Amount of messages to be deleted has to be between ${Constants3.BULK_DELETE_MESSAGES_MIN} and ${Constants3.BULK_DELETE_MESSAGES_MAX}`);const oldestSnowflake=BigInt(Date.now()-142128e7)*BigInt(2)**BigInt(22);const forbiddenMessage=messages.find(m=>BigInt(m)<oldestSnowflake);if(forbiddenMessage)throw new Error(`The message ${forbiddenMessage} is older than 2 weeks and may not be deleted using the bulk delete endpoint`);const data={messages};if(reason)Object.assign(data,{reason});return this.requestHandler.request(Endpoints3.CHANNEL_BULK_DELETE(channelId),{},"post","json",data)}async editChannelPermission(channelId,permissionId,data){return this.requestHandler.request(Endpoints3.CHANNEL_PERMISSION(channelId,permissionId),{},"put","json",data)}async getChannelInvites(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_INVITES(channelId),{},"get","json")}async createChannelInvite(channelId,data={max_age:86400,max_uses:0,temporary:false,unique:false}){return this.requestHandler.request(Endpoints3.CHANNEL_INVITES(channelId),{},"post","json",data)}async deleteChannelPermission(channelId,permissionId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PERMISSION(channelId,permissionId),{},"delete","json",{reason})}async followAnnouncementChannel(channelId,webhookChannelId){return this.requestHandler.request(Endpoints3.CHANNEL_FOLLOWERS(channelId),{},"post","json",{webhook_channel_id:webhookChannelId})}async startChannelTyping(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_TYPING(channelId),{},"post","json")}async getChannelPinnedMessages(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_PINS(channelId),{},"get","json")}async addChannelPinnedMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PIN(channelId,messageId),{},"put","json",{reason})}async removeChannelPinnedMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PIN(channelId,messageId),{},"delete","json",{reason})}async createThreadWithMessage(channelId,messageId,options){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_THREADS(channelId,messageId),{},"post","json",options)}async createThreadWithoutMessage(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS(channelId),{},"post","json",options)}async joinThread(threadId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,"@me"),{},"put","json")}async addThreadMember(threadId,userId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{},"put","json")}async leaveThread(threadId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,"@me"),{},"delete","json")}removeThreadMember(threadId,userId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{},"delete","json")}async getThreadMember(threadId,userId,withMember){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{with_member:withMember},"get","json")}async getThreadMembers(channelId,query){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBERS(channelId),query,"get","json")}async getChannelArchivedPublicThreads(channelId,query){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PUBLIC(channelId),query,"get","json")}async getChannelArchivedPrivateThreads(channelId,query){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PRIVATE(channelId),query,"get","json")}async getChannelArchivedPrivateThreadsUser(channelId,query){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PRIVATE_USER(channelId),query,"get","json")}};var isValidUserMentionRegex=/^[&!]?\d+$/;function replaceEveryone(_match,target){if(isValidUserMentionRegex.test(target))return`@${target}`;else return`@\u200B${target}`}module2.exports=ChannelMethods2}});var require_GuildAssets=__commonJS({"src/methods/GuildAssets.ts"(exports,module2){var import_undici2=require("undici");var Constants3=require_Constants();var Endpoints3=require_Endpoints();var GuildAssetsMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getEmojis(guildId){return this.requestHandler.request(Endpoints3.GUILD_EMOJIS(guildId),{},"get","json")}async getEmoji(guildId,emojiId){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"get","json")}async createEmoji(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_EMOJIS(guildId),{},"post","json",data)}async updateEmoji(guildId,emojiId,data){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"patch","json",data)}async deleteEmoji(guildId,emojiId,reason){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"delete","json",{reason})}async getSticker(stickerId){return this.requestHandler.request(Endpoints3.STICKER(stickerId),{},"get","json")}async getGuildStickers(guildId){return this.requestHandler.request(Endpoints3.GUILD_STICKERS(guildId),{},"get","json")}async getGuildSticker(guildId,stickerId){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"get","json")}createGuildSticker(guildId,data){const form=new import_undici2.FormData;const reason=data.reason;if(data.reason)delete data.reason;for(const key of Object.keys(data)){Constants3.standardAddToFormHandler(form,key,data[key])}return this.requestHandler.request(Endpoints3.GUILD_STICKERS(guildId),{},"post","multipart",form,reason?{"X-Audit-Log-Reason":reason}:void 0)}updateGuildSticker(guildId,stickerId,data){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"patch","json",data)}deleteGuildSticker(guildId,stickerId,reason){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"delete","json",{reason})}};module2.exports=GuildAssetsMethods2}});var require_Guilds=__commonJS({"src/methods/Guilds.ts"(exports,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var GuildMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async createGuild(data){return this.requestHandler.request(Endpoints3.GUILDS,{},"post","json",data)}async getGuild(guildId,withCounts){return this.requestHandler.request(Endpoints3.GUILD(guildId),{with_counts:withCounts},"get","json")}async getGuildPreview(guildId){return this.requestHandler.request(Endpoints3.GUILD_PREVIEW(guildId),{},"get","json")}async updateGuild(guildId,data){return this.requestHandler.request(Endpoints3.GUILD(guildId),{},"patch","json",data)}async deleteGuild(guildId){return this.requestHandler.request(Endpoints3.GUILD(guildId),{},"delete","json")}async getGuildChannels(guildId){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"get","json")}async createGuildChannel(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"post","json",data)}async updateChannelPositions(guildId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"patch","json",data,reason?{"X-Audit-Log-Reason":reason}:void 0)}async listActiveThreads(guildId){return this.requestHandler.request(Endpoints3.GUILD_THREADS_ACTIVE(guildId),{},"get","json")}async getGuildMember(guildId,memberId){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"get","json")}async getGuildMembers(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBERS(guildId),data,"get","json")}async searchGuildMembers(guildId,options){if(options.limit!==void 0&&(options.limit<Constants3.SEARCH_MEMBERS_MIN_RESULTS||options.limit>Constants3.SEARCH_MEMBERS_MAX_RESULTS))throw new RangeError(`Limit for searching guild members has to be between ${Constants3.SEARCH_MEMBERS_MIN_RESULTS} and ${Constants3.SEARCH_MEMBERS_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.GUILD_MEMBERS_SEARCH(guildId),options,"get","json")}async addGuildMember(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"put","json",data)}async updateGuildMember(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"patch","json",data)}async updateSelf(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,"@me"),{},"patch","json",data)}async addGuildMemberRole(guildId,memberId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER_ROLE(guildId,memberId,roleId),{},"put","json",{reason})}async removeGuildMemberRole(guildId,memberId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER_ROLE(guildId,memberId,roleId),{},"delete","json",{reason})}async removeGuildMember(guildId,memberId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"delete","json",{reason})}async getGuildBans(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_BANS(guildId),options,"get","json")}async getGuildBan(guildId,memberId){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"get","json")}async createGuildBan(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"put","json",data)}async removeGuildBan(guildId,memberId,reason){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"delete","json",{reason})}async getGuildRoles(guildId){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"get","json")}async createGuildRole(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"post","json",data)}async updateGuildRolePositions(guildId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"patch","json",data,reason?{"X-Audit-Log-Reason":reason}:void 0)}async updateGuildRole(guildId,roleId,data){return this.requestHandler.request(Endpoints3.GUILD_ROLE(guildId,roleId),{},"patch","json",data)}async removeGuildRole(guildId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_ROLE(guildId,roleId),{},"delete","json",{reason})}async getGuildPruneCount(guildId,query){return this.requestHandler.request(Endpoints3.GUILD_PRUNE(guildId),query,"get","json")}async startGuildPrune(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_PRUNE(guildId),{},"post","json",data)}async getGuildVoiceRegions(guildId){return this.requestHandler.request(Endpoints3.GUILD_VOICE_REGIONS(guildId),{},"get","json")}async getGuildInvites(guildId){return this.requestHandler.request(Endpoints3.GUILD_INVITES(guildId),{},"get","json")}async getGuildIntegrations(guildId){return this.requestHandler.request(Endpoints3.GUILD_INTEGRATIONS(guildId),{},"get","json")}async removeGuildIntegration(guildId,integrationId,reason){return this.requestHandler.request(Endpoints3.GUILD_INTEGRATION(guildId,integrationId),{},"delete","json",{reason})}async getGuildWidgetSettings(guildId){return this.requestHandler.request(Endpoints3.GUILD_WIDGET_SETTINGS(guildId),{},"get","json")}async updateGuildWidgetSettings(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_WIDGET_SETTINGS(guildId),{},"patch","json",data)}async getGuildWidget(guildId){return this.requestHandler.request(Endpoints3.GUILD_WIDGET(guildId),{},"get","json")}async getGuildVanityURL(guildId){return this.requestHandler.request(Endpoints3.GUILD_VANITY(guildId),{},"get","json")}async getGuildWelcomeScreen(guildId){return this.requestHandler.request(Endpoints3.GUILD_WELCOME_SCREEN(guildId),{},"get","json")}async editGuildWelcomeScreen(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_WELCOME_SCREEN(guildId),{},"patch","json",data)}updateCurrentUserVoiceState(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_VOICE_STATE_USER(guildId,"@me"),{},"patch","json",data)}updateUserVoiceState(guildId,userId,data){return this.requestHandler.request(Endpoints3.GUILD_VOICE_STATE_USER(guildId,userId),{},"patch","json",data)}};module2.exports=GuildMethods2}});var require_GuildScheduledEvent=__commonJS({"src/methods/GuildScheduledEvent.ts"(exports,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var GuildScheduledEventMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async listGuildScheduledEvents(guildId,withCounts){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENTS(guildId),{with_user_count:withCounts},"get","json")}async createGuildScheduledEvent(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENTS(guildId),{},"post","json",data)}async getGuildScheduledEvent(guildId,eventId,withCounts){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"get","json",{with_user_count:withCounts})}async editGuildScheduledEvent(guildId,eventId,data){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"patch","json",data)}async deleteGuildScheduledEvent(guildId,eventId){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"delete","json")}async getGuildScheduledEventUsers(guildId,eventId,query){if((query==null?void 0:query.limit)!==void 0&&(query.limit<Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS||query.limit>Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS))throw new RangeError(`The maximum amount of users that may be requested has to be between ${Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS} and ${Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT_USERS(guildId,eventId),query,"get","json")}};module2.exports=GuildScheduledEventMethods2}});var require_GuildTemplate=__commonJS({"src/methods/GuildTemplate.ts"(exports,module2){var Endpoints3=require_Endpoints();var GuildTemplateMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}getGuildTemplate(code){return this.requestHandler.request(Endpoints3.TEMPLATE(code),{},"get","json")}createGuildFromGuildTemplate(code,options){return this.requestHandler.request(Endpoints3.TEMPLATE(code),{},"post","json",options)}getGuildTemplates(guildId){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATES(guildId),{},"get","json")}createGuildTemplate(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATES(guildId),{},"post","json",data)}syncGuildTemplate(guildId,code){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"put","json")}modifyGuildTemplate(guildId,code,data){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"patch","json",data)}deleteGuildTemplate(guildId,code){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"delete","json")}};module2.exports=GuildTemplateMethods2}});var require_Interactions=__commonJS({"src/methods/Interactions.ts"(exports,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var InteractionMethods2=class{constructor(requestHandler,webhooks){this.requestHandler=requestHandler;this.webhooks=webhooks}getApplicationCommands(appId,withLocalizations){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{with_localizations:withLocalizations},"get","json")}createApplicationCommand(appId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{},"post","json",data)}getApplicationCommand(appId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"get","json")}editApplicationCommand(appId,cmdId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"patch","json",data)}deleteApplicationCommand(appId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"delete","json")}bulkOverwriteApplicationCommands(appId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{},"put","json",data)}getGuildApplicationCommands(appId,guildId,withLocalizations){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{with_localizations:withLocalizations},"get","json")}createGuildApplicationCommand(appId,guildId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{},"post","json",data)}getGuildApplicationCommand(appId,guildId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"get","json")}editGuildApplicationCommand(appId,guildId,cmdId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"patch","json",data)}deleteGuildApplicationCommand(appId,guildId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"delete","json")}bulkOverwriteGuildApplicationCommands(appId,guildId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{},"put","json",data)}getGuildApplicationCommandPermissions(appId,guildId,cmdId){if(cmdId)return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND_PERMISSIONS(appId,guildId,cmdId),{},"get","json");return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS_PERMISSIONS(appId,guildId),{},"get","json")}editGuildApplicationCommandPermissions(appId,guildId,cmdId,permissions){const payload={permissions};return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND_PERMISSIONS(appId,guildId,cmdId),{},"put","json",payload)}createInteractionResponse(interactionId,token,data){if(data.files)return this.requestHandler.request(Endpoints3.INTERACTION_CALLBACK(interactionId,token),{},"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.INTERACTION_CALLBACK(interactionId,token),{},"post","json",data)}getOriginalInteractionResponse(appId,token){return this.webhooks.getWebhookMessage(appId,token,"@original")}editOriginalInteractionResponse(appId,token,data){return this.webhooks.editWebhookMessage(appId,token,"@original",data)}deleteOriginalInteractionResponse(appId,token){return this.webhooks.deleteWebhookMessage(appId,token,"@original")}createFollowupMessage(appId,token,data){return this.webhooks.executeWebhook(appId,token,data)}getFollowupMessage(appId,token,messageId){return this.webhooks.getWebhookMessage(appId,token,messageId)}editFollowupMessage(appId,token,messageId,data){return this.webhooks.editWebhookMessage(appId,token,messageId,data)}deleteFollowupMessage(appId,token,messageId){return this.webhooks.deleteWebhookMessage(appId,token,messageId)}};module2.exports=InteractionMethods2}});var require_Invites=__commonJS({"src/methods/Invites.ts"(exports,module2){var Endpoints3=require_Endpoints();var InviteMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getInvite(inviteId,query){return this.requestHandler.request(Endpoints3.INVITES(inviteId),query,"get","json")}async deleteInvite(inviteId){return this.requestHandler.request(Endpoints3.INVITES(inviteId),{},"delete","json")}};module2.exports=InviteMethods2}});var require_StageInstance=__commonJS({"src/methods/StageInstance.ts"(exports,module2){var Endpoints3=require_Endpoints();var StageInstanceMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async createStageInstance(data){return this.requestHandler.request(Endpoints3.STAGE_INSTANCES,{},"post","json",data)}async getStageInstance(channelId){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"get","json")}async editStageInstance(channelId,data){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"patch","json",data)}async deleteStageInstance(channelId,reason){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"delete","json",{reason})}};module2.exports=StageInstanceMethods2}});var require_Users=__commonJS({"src/methods/Users.ts"(exports,module2){var Endpoints3=require_Endpoints();var UserMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getSelf(){return this.requestHandler.request(Endpoints3.USER("@me"),{},"get","json")}async getUser(userId){return this.requestHandler.request(Endpoints3.USER(userId),{},"get","json")}async updateSelf(data){return this.requestHandler.request(Endpoints3.USER("@me"),{},"patch","json",data)}async getGuilds(query){return this.requestHandler.request(Endpoints3.USER_GUILDS("@me"),{},"get","json",query)}async leaveGuild(guildId){return this.requestHandler.request(Endpoints3.USER_GUILD("@me",guildId),{},"delete","json")}async createDirectMessageChannel(userId){return this.requestHandler.request(Endpoints3.USER_CHANNELS("@me"),{},"post","json",{recipient_id:userId})}async createGroupDirectMessageChannel(data){return this.requestHandler.request(Endpoints3.USER_CHANNELS("@me"),{},"post","json",data)}async getConnections(){return this.requestHandler.request(Endpoints3.USER_CONNECTIONS("@me"),{},"get","json")}async getApplicationRoleConnection(appId){return this.requestHandler.request(Endpoints3.USER_APPLICATION_ROLE_CONNECTION("@me",appId),{},"get","json")}async updateApplicationRoleConnection(appId,data){return this.requestHandler.request(Endpoints3.USER_APPLICATION_ROLE_CONNECTION("@me",appId),{},"put","json",data)}};module2.exports=UserMethods2}});var require_Voice=__commonJS({"src/methods/Voice.ts"(exports,module2){var Endpoints3=require_Endpoints();var VoiceMethods2=class{constructor(requestHandler){this.requestHandler=requestHandler}async getVoiceRegions(){return this.requestHandler.request(Endpoints3.VOICE_REGIONS,{},"get","json")}};module2.exports=VoiceMethods2}});var require_Webhooks=__commonJS({"src/methods/Webhooks.ts"(exports,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var mentionRegex=/@([^<>@ ]*)/gsmu;var WebhookMethods2=class{constructor(requestHandler,disableEveryone){this.requestHandler=requestHandler;this.disableEveryone=disableEveryone}async createWebhook(channelId,data){return this.requestHandler.request(Endpoints3.CHANNEL_WEBHOOKS(channelId),{},"post","json",data)}async getChannelWebhooks(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_WEBHOOKS(channelId),{},"get","json")}async getGuildWebhooks(guildId){return this.requestHandler.request(Endpoints3.GUILD_WEBHOOKS(guildId),{},"get","json")}async getWebhook(webhookId,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"get","json");return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"get","json")}async updateWebhook(webhookId,data,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"patch","json",data);return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"patch","json",data)}async deleteWebhook(webhookId,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"delete","json");return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"delete","json")}async executeWebhook(webhookId,token,data,options){if(typeof data!=="string"&&!(data==null?void 0:data.content)&&!(data==null?void 0:data.embeds)&&!(data==null?void 0:data.components)&&!(data==null?void 0:data.files))throw new Error("Missing content or embeds or components or files");if(typeof data==="string")data={content:data};if(data.content&&((options==null?void 0:options.disableEveryone)??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(options)delete options.disableEveryone;if(data.files)return this.requestHandler.request(`${Endpoints3.WEBHOOK_TOKEN(webhookId,token)}`,options,"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),options,"post","json",data)}async executeWebhookSlack(webhookId,token,data,options){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_SLACK(webhookId,token),options,"post","json",data)}async executeWebhookGitHub(webhookId,token,data,options={}){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_GITHUB(webhookId,token),options,"post","json",data)}async getWebhookMessage(webhookId,token,messageId,threadId){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadId},"get","json")}async editWebhookMessage(webhookId,token,messageId,data){let threadID=void 0;if(data.thread_id)threadID=data.thread_id;delete data.thread_id;if(data.files)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadID},"patch","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadID},"patch","json",data)}async deleteWebhookMessage(webhookId,token,messageId,threadID){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadID},"delete","json")}};var isValidUserMentionRegex=/^[&!]?\d+$/;function replaceEveryone(_match,target){if(isValidUserMentionRegex.test(target))return`@${target}`;else return`@\u200B${target}`}module2.exports=WebhookMethods2}});var require_package=__commonJS({"package.json"(exports,module2){module2.exports={name:"snowtransfer",version:"0.9.0",description:"Minimalistic Rest client for the Discord Api",main:"./dist/index.js",types:"./dist/index.d.ts",engines:{node:">=14.18.0"},keywords:["discord","api","rest","http","microservice","discord bot","discord bot microservice","microservice bot"],scripts:{"build:src":"tsup src/index.ts --clean --dts --sourcemap --format cjs --target node14 --minify-whitespace","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:{"discord-api-types":"^0.37.60",undici:"^5.26.3"},devDependencies:{"@types/node":"^20.8.5","@typescript-eslint/eslint-plugin":"^6.7.5","@typescript-eslint/parser":"^6.7.5",eslint:"^8.51.0",tsup:"^7.2.0",typedoc:"^0.25.2","typedoc-plugin-mdn-links":"^3.1.0",typescript:"^5.2.2"},files:["dist","README.md","LICENSE.md"]}}});function appendQuery(query){let count=0;for(const[key,value]of Object.entries(query)){if(value==void 0)delete query[key];else count++}return count>0?`?${new URLSearchParams(query).toString()}`:""}var import_events,import_undici,crypto,Endpoints,version,Constants,routeRegex,reactionsRegex,reactionsUserRegex,webhooksRegex,isMessageEndpointRegex,isGuildChannelsRegex,DiscordAPIError,Ratelimiter,LocalBucket,RequestHandler;var init_RequestHandler=__esm({"src/RequestHandler.ts"(){import_events=require("events");import_undici=require("undici");crypto=require("crypto");Endpoints=require_Endpoints();({version}=require_package());Constants=require_Constants();routeRegex=/\/([a-z-]+)\/(?:\d{17,19})/g;reactionsRegex=/\/reactions\/[^/]+/g;reactionsUserRegex=/\/reactions\/:id\/[^/]+/g;webhooksRegex=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/;isMessageEndpointRegex=/\/messages\/:id$/;isGuildChannelsRegex=/\/guilds\/\d+\/channels$/;DiscordAPIError=class extends Error{constructor(path,error,method,status){super();this.path=path;this.method=method;this.name="DiscordAPIError";this.message=error.message??String(error);this.code=error.code??4e3;this.httpStatus=status}};Ratelimiter=class{constructor(){this.buckets={};this._global=false;this.globalReset=0;this.globalResetTimeout=null}get global(){return this._global}set global(value){if(value&&this.globalReset!==0){if(this.globalResetTimeout)clearTimeout(this.globalResetTimeout);const instance=this;this.globalResetTimeout=setTimeout(()=>{instance.global=false},this.globalReset).unref()}else{if(this.globalResetTimeout)clearTimeout(this.globalResetTimeout);this.globalResetTimeout=null;this.globalReset=0;for(const bkt of Object.values(this.buckets)){bkt.checkQueue()}}this._global=value}routify(url,method){let route=url.replace(routeRegex,function(match,p){return p==="channels"||p==="guilds"||p==="webhooks"?match:`/${p}/:id`}).replace(reactionsRegex,"/reactions/:id").replace(reactionsUserRegex,"/reactions/:id/:userID").replace(webhooksRegex,"/webhooks/$1/:token");if(method.toUpperCase()==="DELETE"&&isMessageEndpointRegex.test(route))route=method+route;else if(method.toUpperCase()==="GET"&&isGuildChannelsRegex.test(route))route="/guilds/:id/channels";if(method==="PUT"||method==="DELETE"){const index=route.indexOf("/reactions");if(index!==-1)route="MODIFY"+route.slice(0,index+10)}return route}queue(fn,url,method){const routeKey=this.routify(url,method);if(!this.buckets[routeKey])this.buckets[routeKey]=new LocalBucket(this,routeKey);this.buckets[routeKey].queue(fn)}};LocalBucket=class{constructor(ratelimiter,routeKey){this.ratelimiter=ratelimiter;this.routeKey=routeKey;this.fnQueue=[];this.limit=5;this.remaining=1;this.reset=5e3;this.resetTimeout=null}queue(fn){return new Promise(res=>{const wrapFn=()=>{this.remaining--;if(!this.resetTimeout)this.makeResetTimeout(5e3);if(this.remaining!==0)this.checkQueue();return res(fn(this))};this.fnQueue.push({fn,callback:wrapFn});this.checkQueue()})}makeResetTimeout(durationMS){if(this.resetTimeout)clearTimeout(this.resetTimeout);this.resetTimeout=setTimeout(()=>this.resetRemaining(),durationMS)}checkQueue(){if(this.ratelimiter.global)return;if(this.fnQueue.length&&this.remaining!==0){const queuedFunc=this.fnQueue.splice(0,1)[0];queuedFunc.callback()}}resetRemaining(){this.remaining=this.limit;if(this.resetTimeout){clearTimeout(this.resetTimeout);this.resetTimeout=null}if(this.fnQueue.length)this.checkQueue();else delete this.ratelimiter.buckets[this.routeKey]}dropQueue(){this.fnQueue.length=0}};RequestHandler=class extends import_events.EventEmitter{constructor(ratelimiter,options){super();this.ratelimiter=ratelimiter;this.options={baseHost:Endpoints.BASE_HOST,baseURL:Endpoints.BASE_URL,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${version}) Node.js/${process.version}`}};if(options.token)this.options.headers.Authorization=options.token;this.options.baseHost=options.baseHost;this.apiURL=this.options.baseHost+Endpoints.BASE_URL;this.latency=500}request(endpoint,params={},method,dataType="json",data,extraHeaders){return new Promise(async(res,rej)=>{this.ratelimiter.queue(async bkt=>{const reqID=crypto.randomBytes(20).toString("hex");try{this.emit("request",reqID,{endpoint,method,dataType,data:data??{}});const before=Date.now();let request;if(dataType=="json")request=await this._request(endpoint,params,method,data,extraHeaders);else if(dataType=="multipart"&&data)request=await this._multiPartRequest(endpoint,params,method,data);else throw new Error("Forbidden dataType. Use json or multipart or ensure multipart has FormData");this.latency=Date.now()-before;this._applyRatelimitHeaders(bkt,request.headers);if(request.status&&!Constants.OK_STATUS_CODES.includes(request.status)&&request.status!==429){throw new DiscordAPIError(endpoint,{message:await request.text()},method,request.status)}if(request.status===429){if(!this.ratelimiter.global){const b=await request.json();if(b.reset_after!==void 0)this.ratelimiter.globalReset=b.reset_after*1e3;else this.ratelimiter.globalReset=1e3;if(b.global!==void 0)this.ratelimiter.global=b.global}this.emit("rateLimit",{timeout:bkt.reset,remaining:bkt.remaining,limit:bkt.limit,method,path:endpoint,route:this.ratelimiter.routify(endpoint,method)});throw new DiscordAPIError(endpoint,{message:"You're being ratelimited",code:429},method,request.status)}this.emit("done",reqID,request);if(request.body){let b;try{b=await request.json()}catch{return res(void 0)}return res(b)}else return res(void 0)}catch(error){this.emit("requestError",reqID,error);return rej(error)}},endpoint,method)})}_applyRatelimitHeaders(bkt,headers){const remaining=headers.get("x-ratelimit-remaining");const limit=headers.get("x-ratelimit-limit");const resetAfter=headers.get("x-ratelimit-reset-after");if(remaining)bkt.remaining=parseInt(remaining);if(limit)bkt.limit=parseInt(limit);if(resetAfter){bkt.reset=parseFloat(resetAfter)*1e3;bkt.makeResetTimeout(bkt.reset)}}async _request(endpoint,params={},method,data,extraHeaders){const headers={...this.options.headers};if(extraHeaders)Object.assign(headers,extraHeaders);if(typeof data!=="string"&&(data==null?void 0:data.reason)){headers["X-Audit-Log-Reason"]=encodeURIComponent(data.reason);delete data.reason}let body=void 0;if(!["head","get"].includes(method)){if(typeof data==="object")body=JSON.stringify(data);else body=String(data)}headers["Content-Type"]="application/json";return(0,import_undici.fetch)(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body})}async _multiPartRequest(endpoint,params={},method,data,extraHeaders){const headers={...this.options.headers};if(extraHeaders)Object.assign(headers,extraHeaders);return(0,import_undici.fetch)(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body:data})}}}});var require_SnowTransfer=__commonJS({"src/SnowTransfer.ts"(exports,module2){init_RequestHandler();var AuditLogMethods2=require_AuditLog();var AutoModerationMethods2=require_AutoModeration();var BotMethods2=require_Bots();var ChannelMethods2=require_Channels();var GuildAssetsMethods2=require_GuildAssets();var GuildMethods2=require_Guilds();var GuildScheduledEventMethods2=require_GuildScheduledEvent();var GuildTemplateMethods2=require_GuildTemplate();var InteractionMethods2=require_Interactions();var InviteMethods2=require_Invites();var StageInstanceMethods2=require_StageInstance();var UserMethods2=require_Users();var VoiceMethods2=require_Voice();var WebhookMethods2=require_Webhooks();var Endpoints3=require_Endpoints();var SnowTransfer2=class{constructor(token,options){if(typeof token==="string"&&token==="")throw new Error("Missing token");if(token&&(!token.startsWith("Bot")&&!token.startsWith("Bearer")))token=`Bot ${token}`;this.options={baseHost:Endpoints3.BASE_HOST,disableEveryone:false};this.token=token;Object.assign(this.options,options);this.ratelimiter=new Ratelimiter;this.requestHandler=new RequestHandler(this.ratelimiter,{token:this.token,baseHost:this.options.baseHost||Endpoints3.BASE_HOST});this.channel=new ChannelMethods2(this.requestHandler,this.options.disableEveryone);this.user=new UserMethods2(this.requestHandler);this.guildAssets=new GuildAssetsMethods2(this.requestHandler);this.webhook=new WebhookMethods2(this.requestHandler,this.options.disableEveryone);this.guild=new GuildMethods2(this.requestHandler);this.guildScheduledEvent=new GuildScheduledEventMethods2(this.requestHandler);this.guildTemplate=new GuildTemplateMethods2(this.requestHandler);this.interaction=new InteractionMethods2(this.requestHandler,this.webhook);this.invite=new InviteMethods2(this.requestHandler);this.voice=new VoiceMethods2(this.requestHandler);this.bot=new BotMethods2(this.requestHandler);this.auditLog=new AuditLogMethods2(this.requestHandler);this.stageInstance=new StageInstanceMethods2(this.requestHandler);this.autoMod=new AutoModerationMethods2(this.requestHandler)}};module2.exports=SnowTransfer2}});var src_exports={};__export(src_exports,{AuditLogMethods:()=>AuditLogMethods,AutoModerationMethods:()=>AutoModerationMethods,BotMethods:()=>BotMethods,ChannelMethods:()=>ChannelMethods,Constants:()=>Constants2,Endpoints:()=>Endpoints2,GuildAssetsMethods:()=>GuildAssetsMethods,GuildMethods:()=>GuildMethods,GuildScheduledEventMethods:()=>GuildScheduledEventMethods,GuildTemplateMethods:()=>GuildTemplateMethods,InteractionMethods:()=>InteractionMethods,InviteMethods:()=>InviteMethods,SnowTransfer:()=>SnowTransfer,StageInstanceMethods:()=>StageInstanceMethods,UserMethods:()=>UserMethods,VoiceMethods:()=>VoiceMethods,WebhookMethods:()=>WebhookMethods});module.exports=__toCommonJS(src_exports);var AuditLogMethods=require_AuditLog();var AutoModerationMethods=require_AutoModeration();var BotMethods=require_Bots();var ChannelMethods=require_Channels();var GuildAssetsMethods=require_GuildAssets();var GuildMethods=require_Guilds();var GuildScheduledEventMethods=require_GuildScheduledEvent();var GuildTemplateMethods=require_GuildTemplate();var InteractionMethods=require_Interactions();var InviteMethods=require_Invites();var StageInstanceMethods=require_StageInstance();var UserMethods=require_Users();var VoiceMethods=require_Voice();var WebhookMethods=require_Webhooks();var Constants2=require_Constants();var Endpoints2=require_Endpoints();var SnowTransfer=require_SnowTransfer();0&&(module.exports={AuditLogMethods,AutoModerationMethods,BotMethods,ChannelMethods,Constants,Endpoints,GuildAssetsMethods,GuildMethods,GuildScheduledEventMethods,GuildTemplateMethods,InteractionMethods,InviteMethods,SnowTransfer,StageInstanceMethods,UserMethods,VoiceMethods,WebhookMethods}); | ||
var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function __init(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function __require(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var require_Constants=__commonJS({"src/Constants.ts"(exports2,module2){var import_buffer=require("buffer");var import_stream=require("stream");var import_web=require("stream/web");var import_undici2=require("undici");var Constants3={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:new Set([200,201,204,304]),standardMultipartHandler(data){const form=new import_undici2.FormData;if(data.files&&Array.isArray(data.files)&&data.files.every(f=>!!f.name&&!!f.file)){let index=0;for(const file of data.files){Constants3.standardAddToFormHandler(form,`files[${index}]`,file.file,file.name);delete file.file;index++}}if(data.data)delete data.files;form.append("payload_json",JSON.stringify(data));return form},standardAddToFormHandler(form,name,value,filename){if(value instanceof Buffer)form.append(name,new import_buffer.Blob([value]),filename);else if(value instanceof import_buffer.Blob||value instanceof import_undici2.File)form.append(name,value,filename);else{form.set(name,{[Symbol.toStringTag]:"File",name,stream:()=>value instanceof import_web.ReadableStream?import_stream.Readable.fromWeb(value):value},filename)}}};module2.exports=Constants3}});var require_Endpoints=__commonJS({"src/Endpoints.ts"(exports2,module2){"use strict";var Constants3=require_Constants();var Endpoints3={BASE_URL:"/api/v"+Constants3.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(appID,cmdID)=>`${Endpoints3.APPLICATION_COMMANDS(appID)}/${cmdID}`,APPLICATION_COMMANDS:appID=>`/applications/${appID}/commands`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(appID,guildID)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appID,guildID)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(appID,guildID,cmdID)=>`${Endpoints3.APPLICATION_GUILD_COMMAND(appID,guildID,cmdID)}/permissions`,APPLICATION_GUILD_COMMAND:(appID,guildID,cmdID)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appID,guildID)}/${cmdID}`,APPLICATION_GUILD_COMMANDS:(appID,guildID)=>`/applications/${appID}/guilds/${guildID}/commands`,CHANNEL:chanID=>`${Endpoints3.CHANNELS}/${chanID}`,CHANNEL_ATTACHMENTS:chanID=>`${Endpoints3.CHANNEL(chanID)}/attachments`,CHANNEL_BULK_DELETE:chanID=>`${Endpoints3.CHANNEL_MESSAGES(chanID)}/bulk-delete`,CHANNEL_FOLLOWERS:chanID=>`${Endpoints3.CHANNEL(chanID)}/followers`,CHANNEL_INVITES:chanID=>`${Endpoints3.CHANNEL(chanID)}/invites`,CHANNEL_MESSAGE:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGES(chanID)}/${msgID}`,CHANNEL_MESSAGE_CROSSPOST:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/crosspost`,CHANNEL_MESSAGE_REACTION:(chanID,msgID,reaction)=>`${Endpoints3.CHANNEL_MESSAGE_REACTIONS(chanID,msgID)}/${reaction}`,CHANNEL_MESSAGE_REACTION_USER:(chanID,msgID,reaction,userID)=>`${Endpoints3.CHANNEL_MESSAGE_REACTION(chanID,msgID,reaction)}/${userID}`,CHANNEL_MESSAGE_REACTIONS:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/reactions`,CHANNEL_MESSAGE_THREADS:(chanID,msgID)=>`${Endpoints3.CHANNEL_MESSAGE(chanID,msgID)}/threads`,CHANNEL_MESSAGES:chanID=>`${Endpoints3.CHANNEL(chanID)}/messages`,CHANNEL_PERMISSION:(chanID,permID)=>`${Endpoints3.CHANNEL_PERMISSIONS(chanID)}/${permID}`,CHANNEL_PERMISSIONS:chanID=>`${Endpoints3.CHANNEL(chanID)}/permissions`,CHANNEL_PIN:(chanID,msgID)=>`${Endpoints3.CHANNEL_PINS(chanID)}/${msgID}`,CHANNEL_PINS:chanID=>`${Endpoints3.CHANNEL(chanID)}/pins`,CHANNEL_RECIPIENT:(chanID,userID)=>`${Endpoints3.CHANNEL(chanID)}/recipients/${userID}`,CHANNEL_THREADS:chanID=>`${Endpoints3.CHANNEL(chanID)}/threads`,CHANNEL_THREAD_MEMBER:(chanID,memberID)=>`${Endpoints3.CHANNEL_THREAD_MEMBERS(chanID)}/${memberID}`,CHANNEL_THREAD_MEMBERS:chanID=>`${Endpoints3.CHANNEL(chanID)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:chanID=>`${Endpoints3.CHANNEL_THREADS(chanID)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:chanID=>`${Endpoints3.CHANNEL(chanID)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:chanID=>`${Endpoints3.CHANNEL_THREADS(chanID)}/archived/public`,CHANNEL_TYPING:chanID=>`${Endpoints3.CHANNEL(chanID)}/typing`,CHANNEL_WEBHOOKS:chanID=>`${Endpoints3.CHANNEL(chanID)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:guildID=>`${Endpoints3.GUILDS}/${guildID}`,GUILD_AUDIT_LOGS:guildID=>`${Endpoints3.GUILD(guildID)}/audit-logs`,GUILD_AUTO_MOD_RULE:(guildID,ruleID)=>`${Endpoints3.GUILD_AUTO_MOD_RULES(guildID)}/${ruleID}`,GUILD_AUTO_MOD_RULES:guildID=>`${Endpoints3.GUILD(guildID)}/auto-moderation/rules`,GUILD_BAN:(guildID,memberID)=>`${Endpoints3.GUILD_BANS(guildID)}/${memberID}`,GUILD_BANS:guildID=>`${Endpoints3.GUILD(guildID)}/bans`,GUILD_CHANNELS:guildID=>`${Endpoints3.GUILD(guildID)}/channels`,GUILD_EMOJI:(guildID,emojiID)=>`${Endpoints3.GUILD_EMOJIS(guildID)}/${emojiID}`,GUILD_EMOJIS:guildID=>`${Endpoints3.GUILD(guildID)}/emojis`,GUILD_INVITES:guildID=>`${Endpoints3.GUILD(guildID)}/invites`,GUILD_INTEGRATION:(guildID,integrationID)=>`${Endpoints3.GUILD_INTEGRATIONS(guildID)}/${integrationID}`,GUILD_INTEGRATIONS:guildID=>`${Endpoints3.GUILD(guildID)}/integrations`,GUILD_MEMBER:(guildID,memberID)=>`${Endpoints3.GUILD_MEMBERS(guildID)}/${memberID}`,GUILD_MEMBER_ROLE:(guildID,memberID,roleID)=>`${Endpoints3.GUILD_MEMBER(guildID,memberID)}/roles/${roleID}`,GUILD_MEMBERS:guildID=>`${Endpoints3.GUILD(guildID)}/members`,GUILD_MEMBERS_SEARCH:guildID=>`${Endpoints3.GUILD_MEMBERS(guildID)}/search`,GUILD_PREVIEW:guildID=>`${Endpoints3.GUILD(guildID)}/preview`,GUILD_PRUNE:guildID=>`${Endpoints3.GUILD(guildID)}/prune`,GUILD_ROLE:(guildID,roleID)=>`${Endpoints3.GUILD_ROLES(guildID)}/${roleID}`,GUILD_ROLES:guildID=>`${Endpoints3.GUILD(guildID)}/roles`,GUILD_SCHEDULED_EVENTS:guildID=>`${Endpoints3.GUILD(guildID)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(guildID,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENTS(guildID)}/${eventId}`,GUILD_SCHEDULED_EVENT_USERS:(guildID,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENT(guildID,eventId)}/users`,GUILD_STICKER:(guildID,stickerID)=>`${Endpoints3.GUILD_STICKERS(guildID)}/${stickerID}`,GUILD_STICKERS:guildID=>`${Endpoints3.GUILD(guildID)}/stickers`,GUILD_TEMPLATE:(guildID,code)=>`${Endpoints3.GUILD_TEMPLATES(guildID)}/${code}`,GUILD_THREADS_ACTIVE:guildID=>`${Endpoints3.GUILD(guildID)}/threads/active`,GUILD_TEMPLATES:guildID=>`${Endpoints3.GUILD(guildID)}/templates`,GUILD_VANITY:guildID=>`${Endpoints3.GUILD(guildID)}/vanity-url`,GUILD_VOICE_REGIONS:guildID=>`${Endpoints3.GUILD(guildID)}/regions`,GUILD_VOICE_STATE_USER:(guildID,memberID)=>`${Endpoints3.GUILD(guildID)}/voice-states/${memberID}`,GUILD_WEBHOOKS:guildID=>`${Endpoints3.GUILD(guildID)}/webhooks`,GUILD_WELCOME_SCREEN:guildID=>`${Endpoints3.GUILD(guildID)}/welcome-screen`,GUILD_WIDGET:guildID=>`${Endpoints3.GUILD(guildID)}/widget.json`,GUILD_WIDGET_SETTINGS:guildID=>`${Endpoints3.GUILD(guildID)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(interactionID,token)=>`/interactions/${interactionID}/${token}/callback`,INVITES:inviteID=>`/invites/${inviteID}`,OAUTH2_APPLICATION:appID=>`/oauth2/applications/${appID}`,STAGE_INSTANCE_CHANNEL:chanID=>`${Endpoints3.STAGE_INSTANCES}/${chanID}`,STAGE_INSTANCES:"/stage-instances",STICKER:stickerID=>`/stickers/${stickerID}`,TEMPLATE:code=>`/guilds/templates/${code}`,USER:userID=>`${Endpoints3.USERS}/${userID}`,USER_APPLICATION_ROLE_CONNECTION:(userID,appID)=>`${Endpoints3.USER(userID)}/applications/${appID}/role-connection`,USER_CHANNELS:userID=>`${Endpoints3.USER(userID)}/channels`,USER_CONNECTIONS:userID=>`${Endpoints3.USER(userID)}/connections`,USER_GUILD:(userID,guildID)=>`${Endpoints3.USER_GUILDS(userID)}/${guildID}`,USER_GUILDS:userID=>`${Endpoints3.USER(userID)}/guilds`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:hookID=>`/webhooks/${hookID}`,WEBHOOK_TOKEN:(hookID,token)=>`${Endpoints3.WEBHOOK(hookID)}/${token}`,WEBHOOK_TOKEN_GITHUB:(hookID,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookID,token)}/github`,WEBHOOK_TOKEN_MESSAGE:(hookID,token,msgID)=>`/webhooks/${hookID}/${token}/messages/${msgID}`,WEBHOOK_TOKEN_SLACK:(hookID,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookID,token)}/slack`};module2.exports=Endpoints3}});var require_package=__commonJS({"package.json"(exports2,module2){module2.exports={name:"snowtransfer",version:"0.10.0",description:"Minimalistic Rest client for the Discord Api",main:"./dist/index.js",types:"./dist/index.d.ts",engines:{node:">=14.18.0"},keywords:["discord","api","rest","http","microservice","discord bot","discord bot microservice","microservice bot"],scripts:{"build:src":"tsup src/index.ts --clean --dts --sourcemap --format cjs --target node14 --minify-whitespace","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:{"discord-api-types":"^0.37.67",undici:"^6.4.0"},devDependencies:{"@types/node":"^20.11.6","@typescript-eslint/eslint-plugin":"^6.19.1","@typescript-eslint/parser":"^6.19.1",eslint:"^8.56.0",tsup:"^8.0.1",typedoc:"^0.25.7","typedoc-plugin-mdn-links":"^3.1.13",typescript:"^5.3.3"},files:["dist","README.md","LICENSE.md"]}}});function appendQuery(query){let count=0;for(const[key,value]of Object.entries(query)){if(value==void 0)delete query[key];else count++}return count>0?`?${new URLSearchParams(query).toString()}`:""}var import_events,import_undici,crypto,Endpoints,version,Constants,routeRegex,reactionsRegex,reactionsUserRegex,webhooksRegex,isMessageEndpointRegex,isGuildChannelsRegex,disallowedBodyMethods,DiscordAPIError,Ratelimiter,LocalBucket,GlobalBucket,RequestHandler;var init_RequestHandler=__esm({"src/RequestHandler.ts"(){import_events=require("events");import_undici=require("undici");crypto=require("crypto");Endpoints=require_Endpoints();({version}=require_package());Constants=require_Constants();routeRegex=/\/([a-z-]+)\/(?:\d{17,19})/g;reactionsRegex=/\/reactions\/[^/]+/g;reactionsUserRegex=/\/reactions\/:id\/[^/]+/g;webhooksRegex=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/;isMessageEndpointRegex=/\/messages\/:id$/;isGuildChannelsRegex=/\/guilds\/\d+\/channels$/;disallowedBodyMethods=new Set(["head","get"]);DiscordAPIError=class extends Error{constructor(path,error,method,status){super();this.path=path;this.method=method;this.name="DiscordAPIError";this.message=error.message??String(error);this.code=error.code??4e3;this.httpStatus=status}};Ratelimiter=class{constructor(){this.buckets={};this._global=false;this.globalReset=0;this.globalResetTimeout=null;this.BucketConstructor=GlobalBucket}get global(){return this._global}set global(value){if(value&&this.globalReset!==0){if(this.globalResetTimeout)clearTimeout(this.globalResetTimeout);const instance=this;this.globalResetTimeout=setTimeout(()=>{instance.global=false},this.globalReset).unref()}else{if(this.globalResetTimeout)clearTimeout(this.globalResetTimeout);this.globalResetTimeout=null;this.globalReset=0;for(const bkt of Object.values(this.buckets)){bkt.checkQueue()}}this._global=value}routify(url,method){let route=url.replace(routeRegex,function(match,p){return p==="channels"||p==="guilds"||p==="webhooks"?match:`/${p}/:id`}).replace(reactionsRegex,"/reactions/:id").replace(reactionsUserRegex,"/reactions/:id/:userID").replace(webhooksRegex,"/webhooks/$1/:token");if(method.toUpperCase()==="DELETE"&&isMessageEndpointRegex.test(route))route=method+route;else if(method.toUpperCase()==="GET"&&isGuildChannelsRegex.test(route))route="/guilds/:id/channels";if(method==="PUT"||method==="DELETE"){const index=route.indexOf("/reactions");if(index!==-1)route="MODIFY"+route.slice(0,index+10)}return route}queue(fn,url,method){var _a;const routeKey=this.routify(url,method);(_a=this.buckets)[routeKey]??(_a[routeKey]=new this.BucketConstructor(this,routeKey));this.buckets[routeKey].queue(fn)}};LocalBucket=class{constructor(limit=5,reset=5e3,remaining){this.limit=limit;this.reset=reset;this.fnQueue=[];this.resetTimeout=null;this.remaining=remaining??limit}queue(fn){return new Promise(res=>{const wrapFn=()=>{this.remaining--;const result=fn(this);if(!this.resetTimeout)this.makeResetTimeout(this.reset);if(this.remaining!==0)setImmediate(this.checkQueue);return res(result)};this.fnQueue.push(wrapFn);this.checkQueue()})}makeResetTimeout(durationMS){if(this.resetTimeout)clearTimeout(this.resetTimeout);this.resetTimeout=setTimeout(()=>this.resetRemaining(),durationMS)}checkQueue(){if(this.fnQueue.length&&this.remaining!==0){const queuedFunc=this.fnQueue.splice(0,1)[0];queuedFunc()}}resetRemaining(){this.remaining=this.limit;if(this.resetTimeout){clearTimeout(this.resetTimeout);this.resetTimeout=null}if(this.fnQueue.length)this.checkQueue()}dropQueue(){this.fnQueue.length=0}};GlobalBucket=class extends LocalBucket{constructor(ratelimiter,routeKey){super(5,5e3,1);this.ratelimiter=ratelimiter;this.routeKey=routeKey}checkQueue(){if(this.ratelimiter.global)return;super.checkQueue()}resetRemaining(){if(!this.fnQueue.length)delete this.ratelimiter.buckets[this.routeKey];super.resetRemaining()}};RequestHandler=class extends import_events.EventEmitter{constructor(ratelimiter,options){super();this.ratelimiter=ratelimiter;this.options={baseHost:Endpoints.BASE_HOST,baseURL:Endpoints.BASE_URL,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${version}) Node.js/${process.version}`}};if(options.token)this.options.headers.Authorization=options.token;this.options.baseHost=options.baseHost;this.apiURL=this.options.baseHost+Endpoints.BASE_URL;this.latency=500}request(endpoint,params={},method,dataType="json",data,extraHeaders){return new Promise(async(res,rej)=>{this.ratelimiter.queue(async bkt=>{const reqID=crypto.randomBytes(20).toString("hex");try{this.emit("request",reqID,{endpoint,method,dataType,data:data??{}});const before=Date.now();let request;switch(dataType){case"json":request=await this._request(endpoint,params,method,data,extraHeaders);break;case"multipart":if(!data)throw new Error("No multipart data");request=await this._multiPartRequest(endpoint,params,method,data,extraHeaders);break;default:throw new Error("Forbidden dataType. Use json or multipart or ensure multipart has FormData")}this.latency=Date.now()-before;this._applyRatelimitHeaders(bkt,request.headers);if(request.status&&!Constants.OK_STATUS_CODES.has(request.status)&&request.status!==429){throw new DiscordAPIError(endpoint,{message:await request.text()},method,request.status)}if(request.status===429){if(!this.ratelimiter.global){const b=await request.json();if(b.reset_after!==void 0)this.ratelimiter.globalReset=b.reset_after*1e3;else this.ratelimiter.globalReset=1e3;if(b.global!==void 0)this.ratelimiter.global=b.global}this.emit("rateLimit",{timeout:bkt.reset,remaining:bkt.remaining,limit:bkt.limit,method,path:endpoint,route:this.ratelimiter.routify(endpoint,method)});throw new DiscordAPIError(endpoint,{message:"You're being ratelimited",code:429},method,request.status)}this.emit("done",reqID,request);if(request.body){let b;try{b=await request.json()}catch{return res(void 0)}return res(b)}else return res(void 0)}catch(error){this.emit("requestError",reqID,error);return rej(error)}},endpoint,method)})}_applyRatelimitHeaders(bkt,headers){const remaining=headers.get("x-ratelimit-remaining");const limit=headers.get("x-ratelimit-limit");const resetAfter=headers.get("x-ratelimit-reset-after");if(remaining)bkt.remaining=parseInt(remaining);if(limit)bkt.limit=parseInt(limit);if(resetAfter){bkt.reset=parseFloat(resetAfter)*1e3;bkt.makeResetTimeout(bkt.reset)}}async _request(endpoint,params={},method,data,extraHeaders){const headers={...this.options.headers};if(extraHeaders)Object.assign(headers,extraHeaders);if(typeof data!=="string"&&(data==null?void 0:data.reason)){headers["X-Audit-Log-Reason"]=encodeURIComponent(data.reason);delete data.reason}let body=void 0;if(!disallowedBodyMethods.has(method)){if(typeof data==="object")body=JSON.stringify(data);else body=String(data)}headers["Content-Type"]="application/json";return(0,import_undici.fetch)(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body})}async _multiPartRequest(endpoint,params={},method,data,extraHeaders){const headers={...this.options.headers};if(extraHeaders)Object.assign(headers,extraHeaders);return(0,import_undici.fetch)(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body:data})}}}});var require_AuditLog=__commonJS({"src/methods/AuditLog.ts"(exports2,module2){var Endpoints3=require_Endpoints();var AuditLogMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getAuditLog(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_AUDIT_LOGS(guildId),options,"get","json")}};module2.exports=AuditLogMethods}});var require_AutoModeration=__commonJS({"src/methods/AutoModeration.ts"(exports2,module2){var Endpoints3=require_Endpoints();var AutoModerationMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getAutoModerationRules(guildId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"get","json")}async getAutoModerationRule(guildId,ruleId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"get","json")}async createAutoModerationRule(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"post","json",data)}async editAutoModerationRule(guildId,ruleId,data){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"patch","json",data)}async deleteAutoModerationRule(guildId,ruleId,reason){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"delete","json",{reason})}};module2.exports=AutoModerationMethods}});var require_Bots=__commonJS({"src/methods/Bots.ts"(exports2,module2){var Endpoints3=require_Endpoints();var BotMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}getGateway(){return this.requestHandler.request(Endpoints3.GATEWAY,{},"get","json")}getGatewayBot(){return this.requestHandler.request(Endpoints3.GATEWAY_BOT,{},"get","json")}};module2.exports=BotMethods}});var require_Channels=__commonJS({"src/methods/Channels.ts"(exports2,module2){var import_undici2=require("undici");var Endpoints3=require_Endpoints();var Constants3=require_Constants();var mentionRegex=/@([^<>@ ]*)/gsmu;var ChannelMethods=class{constructor(requestHandler,disableEveryone){this.requestHandler=requestHandler;this.disableEveryone=disableEveryone}async getChannel(channelId){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"get","json")}async updateChannel(channelId,data){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"patch","json",data)}async deleteChannel(channelId,reason){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"delete","json",{reason})}async getChannelMessages(channelId,options={limit:50}){if(options.around){delete options.before;delete options.after}else if(options.before){delete options.around;delete options.after}else if(options.after){delete options.before;delete options.around}if(options.limit!==void 0&&(options.limit<Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS||options.limit>Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS))throw new RangeError(`Amount of messages that may be requested has to be between ${Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS} and ${Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),options,"get","json")}async getChannelMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"get","json")}async createMessage(channelId,data,options={disableEveryone:this.disableEveryone}){if(typeof data!=="string"&&!data.content&&!data.embeds&&!data.sticker_ids&&!data.components&&!data.files)throw new Error("Missing content, embeds, sticker_ids, components, or files");if(typeof data==="string")data={content:data};if(data.content&&(options.disableEveryone??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(data.files)return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","json",data)}async createVoiceMessage(channelId,data,audioDurationSeconds,waveform=""){const{upload_url,upload_filename}=await this.requestHandler.request(Endpoints3.CHANNEL_ATTACHMENTS(channelId),{},"post","json",{files:[{id:"69420",filename:"voice-message.ogg",file_size:data.byteLength}]});await(0,import_undici2.fetch)(upload_url,{method:"PUT",body:data});return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","json",{attachments:[{id:"42069",uploaded_filename:upload_filename,filename:"voice-message.ogg",duration_secs:audioDurationSeconds,waveform}],flags:1<<13})}async crosspostMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_CROSSPOST(channelId,messageId),{},"post","json")}async createReaction(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"put","json")}async deleteReactionSelf(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"delete","json")}async deleteReaction(channelId,messageId,emoji,userId){return this.requestHandler.request(userId?Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,userId):Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),{},"delete","json")}async getReactions(channelId,messageId,emoji,options){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),options,"get","json")}async deleteAllReactions(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTIONS(channelId,messageId),{},"delete","json")}async editMessage(channelId,messageId,data,options={disableEveryone:this.disableEveryone}){if(typeof data==="string")data={content:data};if(data.content&&(options.disableEveryone??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(data.files)return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","json",data)}async deleteMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"delete","json",{reason})}async bulkDeleteMessages(channelId,messages,reason){if(messages.length<Constants3.BULK_DELETE_MESSAGES_MIN||messages.length>Constants3.BULK_DELETE_MESSAGES_MAX)throw new RangeError(`Amount of messages to be deleted has to be between ${Constants3.BULK_DELETE_MESSAGES_MIN} and ${Constants3.BULK_DELETE_MESSAGES_MAX}`);const oldestSnowflake=BigInt(Date.now()-142128e7)*BigInt(2)**BigInt(22);const forbiddenMessage=messages.find(m=>BigInt(m)<oldestSnowflake);if(forbiddenMessage)throw new Error(`The message ${forbiddenMessage} is older than 2 weeks and may not be deleted using the bulk delete endpoint`);const data={messages};if(reason)Object.assign(data,{reason});return this.requestHandler.request(Endpoints3.CHANNEL_BULK_DELETE(channelId),{},"post","json",data)}async editChannelPermission(channelId,permissionId,data){return this.requestHandler.request(Endpoints3.CHANNEL_PERMISSION(channelId,permissionId),{},"put","json",data)}async getChannelInvites(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_INVITES(channelId),{},"get","json")}async createChannelInvite(channelId,data={max_age:86400,max_uses:0,temporary:false,unique:false}){return this.requestHandler.request(Endpoints3.CHANNEL_INVITES(channelId),{},"post","json",data)}async deleteChannelPermission(channelId,permissionId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PERMISSION(channelId,permissionId),{},"delete","json",{reason})}async followAnnouncementChannel(channelId,webhookChannelId){return this.requestHandler.request(Endpoints3.CHANNEL_FOLLOWERS(channelId),{},"post","json",{webhook_channel_id:webhookChannelId})}async startChannelTyping(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_TYPING(channelId),{},"post","json")}async getChannelPinnedMessages(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_PINS(channelId),{},"get","json")}async addChannelPinnedMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PIN(channelId,messageId),{},"put","json",{reason})}async removeChannelPinnedMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PIN(channelId,messageId),{},"delete","json",{reason})}async createThreadWithMessage(channelId,messageId,options){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_THREADS(channelId,messageId),{},"post","json",options)}async createThreadWithoutMessage(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS(channelId),{},"post","json",options)}async joinThread(threadId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,"@me"),{},"put","json")}async addThreadMember(threadId,userId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{},"put","json")}async leaveThread(threadId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,"@me"),{},"delete","json")}removeThreadMember(threadId,userId){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{},"delete","json")}async getThreadMember(threadId,userId,withMember){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBER(threadId,userId),{with_member:withMember},"get","json")}async getThreadMembers(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREAD_MEMBERS(channelId),options,"get","json")}async getChannelArchivedPublicThreads(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PUBLIC(channelId),options,"get","json")}async getChannelArchivedPrivateThreads(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PRIVATE(channelId),options,"get","json")}async getChannelArchivedPrivateThreadsUser(channelId,options){return this.requestHandler.request(Endpoints3.CHANNEL_THREADS_ARCHIVED_PRIVATE_USER(channelId),options,"get","json")}};var isValidUserMentionRegex=/^[&!]?\d+$/;function replaceEveryone(_match,target){if(isValidUserMentionRegex.test(target))return`@${target}`;else return`@\u200B${target}`}module2.exports=ChannelMethods}});var require_GuildAssets=__commonJS({"src/methods/GuildAssets.ts"(exports2,module2){var import_undici2=require("undici");var Constants3=require_Constants();var Endpoints3=require_Endpoints();var GuildAssetsMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getEmojis(guildId){return this.requestHandler.request(Endpoints3.GUILD_EMOJIS(guildId),{},"get","json")}async getEmoji(guildId,emojiId){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"get","json")}async createEmoji(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_EMOJIS(guildId),{},"post","json",data)}async updateEmoji(guildId,emojiId,data){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"patch","json",data)}async deleteEmoji(guildId,emojiId,reason){return this.requestHandler.request(Endpoints3.GUILD_EMOJI(guildId,emojiId),{},"delete","json",{reason})}async getSticker(stickerId){return this.requestHandler.request(Endpoints3.STICKER(stickerId),{},"get","json")}async getGuildStickers(guildId){return this.requestHandler.request(Endpoints3.GUILD_STICKERS(guildId),{},"get","json")}async getGuildSticker(guildId,stickerId){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"get","json")}createGuildSticker(guildId,data){const form=new import_undici2.FormData;const reason=data.reason;if(data.reason)delete data.reason;for(const key of Object.keys(data)){Constants3.standardAddToFormHandler(form,key,data[key])}return this.requestHandler.request(Endpoints3.GUILD_STICKERS(guildId),{},"post","multipart",form,reason?{"X-Audit-Log-Reason":reason}:void 0)}updateGuildSticker(guildId,stickerId,data){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"patch","json",data)}deleteGuildSticker(guildId,stickerId,reason){return this.requestHandler.request(Endpoints3.GUILD_STICKER(guildId,stickerId),{},"delete","json",{reason})}};module2.exports=GuildAssetsMethods}});var require_Guilds=__commonJS({"src/methods/Guilds.ts"(exports2,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var GuildMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async createGuild(data){return this.requestHandler.request(Endpoints3.GUILDS,{},"post","json",data)}async getGuild(guildId,withCounts){return this.requestHandler.request(Endpoints3.GUILD(guildId),{with_counts:withCounts},"get","json")}async getGuildPreview(guildId){return this.requestHandler.request(Endpoints3.GUILD_PREVIEW(guildId),{},"get","json")}async updateGuild(guildId,data){return this.requestHandler.request(Endpoints3.GUILD(guildId),{},"patch","json",data)}async deleteGuild(guildId){return this.requestHandler.request(Endpoints3.GUILD(guildId),{},"delete","json")}async getGuildChannels(guildId){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"get","json")}async createGuildChannel(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"post","json",data)}async updateChannelPositions(guildId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_CHANNELS(guildId),{},"patch","json",data,reason?{"X-Audit-Log-Reason":reason}:void 0)}async listActiveThreads(guildId){return this.requestHandler.request(Endpoints3.GUILD_THREADS_ACTIVE(guildId),{},"get","json")}async getGuildMember(guildId,memberId){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"get","json")}async getGuildMembers(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_MEMBERS(guildId),options,"get","json")}async searchGuildMembers(guildId,options){if(options.limit!==void 0&&(options.limit<Constants3.SEARCH_MEMBERS_MIN_RESULTS||options.limit>Constants3.SEARCH_MEMBERS_MAX_RESULTS))throw new RangeError(`Limit for searching guild members has to be between ${Constants3.SEARCH_MEMBERS_MIN_RESULTS} and ${Constants3.SEARCH_MEMBERS_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.GUILD_MEMBERS_SEARCH(guildId),options,"get","json")}async addGuildMember(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"put","json",data)}async updateGuildMember(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"patch","json",data)}async updateSelf(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,"@me"),{},"patch","json",data)}async addGuildMemberRole(guildId,memberId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER_ROLE(guildId,memberId,roleId),{},"put","json",{reason})}async removeGuildMemberRole(guildId,memberId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER_ROLE(guildId,memberId,roleId),{},"delete","json",{reason})}async removeGuildMember(guildId,memberId,reason){return this.requestHandler.request(Endpoints3.GUILD_MEMBER(guildId,memberId),{},"delete","json",{reason})}async getGuildBans(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_BANS(guildId),options,"get","json")}async getGuildBan(guildId,memberId){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"get","json")}async createGuildBan(guildId,memberId,data){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"put","json",data)}async removeGuildBan(guildId,memberId,reason){return this.requestHandler.request(Endpoints3.GUILD_BAN(guildId,memberId),{},"delete","json",{reason})}async getGuildRoles(guildId){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"get","json")}async createGuildRole(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"post","json",data)}async updateGuildRolePositions(guildId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_ROLES(guildId),{},"patch","json",data,reason?{"X-Audit-Log-Reason":reason}:void 0)}async updateGuildRole(guildId,roleId,data){return this.requestHandler.request(Endpoints3.GUILD_ROLE(guildId,roleId),{},"patch","json",data)}async removeGuildRole(guildId,roleId,reason){return this.requestHandler.request(Endpoints3.GUILD_ROLE(guildId,roleId),{},"delete","json",{reason})}async getGuildPruneCount(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_PRUNE(guildId),options,"get","json")}async startGuildPrune(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_PRUNE(guildId),{},"post","json",data)}async getGuildVoiceRegions(guildId){return this.requestHandler.request(Endpoints3.GUILD_VOICE_REGIONS(guildId),{},"get","json")}async getGuildInvites(guildId){return this.requestHandler.request(Endpoints3.GUILD_INVITES(guildId),{},"get","json")}async getGuildIntegrations(guildId){return this.requestHandler.request(Endpoints3.GUILD_INTEGRATIONS(guildId),{},"get","json")}async removeGuildIntegration(guildId,integrationId,reason){return this.requestHandler.request(Endpoints3.GUILD_INTEGRATION(guildId,integrationId),{},"delete","json",{reason})}async getGuildWidgetSettings(guildId){return this.requestHandler.request(Endpoints3.GUILD_WIDGET_SETTINGS(guildId),{},"get","json")}async updateGuildWidgetSettings(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_WIDGET_SETTINGS(guildId),{},"patch","json",data)}async getGuildWidget(guildId){return this.requestHandler.request(Endpoints3.GUILD_WIDGET(guildId),{},"get","json")}async getGuildVanityURL(guildId){return this.requestHandler.request(Endpoints3.GUILD_VANITY(guildId),{},"get","json")}async getGuildWelcomeScreen(guildId){return this.requestHandler.request(Endpoints3.GUILD_WELCOME_SCREEN(guildId),{},"get","json")}async editGuildWelcomeScreen(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_WELCOME_SCREEN(guildId),{},"patch","json",data)}updateCurrentUserVoiceState(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_VOICE_STATE_USER(guildId,"@me"),{},"patch","json",data)}updateUserVoiceState(guildId,userId,data){return this.requestHandler.request(Endpoints3.GUILD_VOICE_STATE_USER(guildId,userId),{},"patch","json",data)}};module2.exports=GuildMethods}});var require_GuildScheduledEvent=__commonJS({"src/methods/GuildScheduledEvent.ts"(exports2,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var GuildScheduledEventMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async listGuildScheduledEvents(guildId,withCounts){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENTS(guildId),{with_user_count:withCounts},"get","json")}async createGuildScheduledEvent(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENTS(guildId),{},"post","json",data)}async getGuildScheduledEvent(guildId,eventId,withCounts){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"get","json",{with_user_count:withCounts})}async editGuildScheduledEvent(guildId,eventId,data){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"patch","json",data)}async deleteGuildScheduledEvent(guildId,eventId){return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId),{},"delete","json")}async getGuildScheduledEventUsers(guildId,eventId,options){if((options==null?void 0:options.limit)!==void 0&&(options.limit<Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS||options.limit>Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS))throw new RangeError(`The maximum amount of users that may be requested has to be between ${Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS} and ${Constants3.GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.GUILD_SCHEDULED_EVENT_USERS(guildId,eventId),options,"get","json")}};module2.exports=GuildScheduledEventMethods}});var require_GuildTemplate=__commonJS({"src/methods/GuildTemplate.ts"(exports2,module2){var Endpoints3=require_Endpoints();var GuildTemplateMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}getGuildTemplate(code){return this.requestHandler.request(Endpoints3.TEMPLATE(code),{},"get","json")}createGuildFromGuildTemplate(code,options){return this.requestHandler.request(Endpoints3.TEMPLATE(code),{},"post","json",options)}getGuildTemplates(guildId){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATES(guildId),{},"get","json")}createGuildTemplate(guildId,data){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATES(guildId),{},"post","json",data)}syncGuildTemplate(guildId,code){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"put","json")}modifyGuildTemplate(guildId,code,data){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"patch","json",data)}deleteGuildTemplate(guildId,code){return this.requestHandler.request(Endpoints3.GUILD_TEMPLATE(guildId,code),{},"delete","json")}};module2.exports=GuildTemplateMethods}});var require_Interactions=__commonJS({"src/methods/Interactions.ts"(exports2,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var InteractionMethods=class{constructor(requestHandler,webhooks){this.requestHandler=requestHandler;this.webhooks=webhooks}getApplicationCommands(appId,withLocalizations){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{with_localizations:withLocalizations},"get","json")}createApplicationCommand(appId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{},"post","json",data)}getApplicationCommand(appId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"get","json")}editApplicationCommand(appId,cmdId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"patch","json",data)}deleteApplicationCommand(appId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_COMMAND(appId,cmdId),{},"delete","json")}bulkOverwriteApplicationCommands(appId,data){return this.requestHandler.request(Endpoints3.APPLICATION_COMMANDS(appId),{},"put","json",data)}getGuildApplicationCommands(appId,guildId,withLocalizations){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{with_localizations:withLocalizations},"get","json")}createGuildApplicationCommand(appId,guildId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{},"post","json",data)}getGuildApplicationCommand(appId,guildId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"get","json")}editGuildApplicationCommand(appId,guildId,cmdId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"patch","json",data)}deleteGuildApplicationCommand(appId,guildId,cmdId){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId),{},"delete","json")}bulkOverwriteGuildApplicationCommands(appId,guildId,data){return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId),{},"put","json",data)}getGuildApplicationCommandPermissions(appId,guildId,cmdId){if(cmdId)return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND_PERMISSIONS(appId,guildId,cmdId),{},"get","json");return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMANDS_PERMISSIONS(appId,guildId),{},"get","json")}editGuildApplicationCommandPermissions(appId,guildId,cmdId,permissions){const payload={permissions};return this.requestHandler.request(Endpoints3.APPLICATION_GUILD_COMMAND_PERMISSIONS(appId,guildId,cmdId),{},"put","json",payload)}createInteractionResponse(interactionId,token,data){if(data.files)return this.requestHandler.request(Endpoints3.INTERACTION_CALLBACK(interactionId,token),{},"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.INTERACTION_CALLBACK(interactionId,token),{},"post","json",data)}getOriginalInteractionResponse(appId,token){return this.webhooks.getWebhookMessage(appId,token,"@original")}editOriginalInteractionResponse(appId,token,data){return this.webhooks.editWebhookMessage(appId,token,"@original",data)}deleteOriginalInteractionResponse(appId,token){return this.webhooks.deleteWebhookMessage(appId,token,"@original")}createFollowupMessage(appId,token,data){return this.webhooks.executeWebhook(appId,token,data)}getFollowupMessage(appId,token,messageId){return this.webhooks.getWebhookMessage(appId,token,messageId)}editFollowupMessage(appId,token,messageId,data){return this.webhooks.editWebhookMessage(appId,token,messageId,data)}deleteFollowupMessage(appId,token,messageId){return this.webhooks.deleteWebhookMessage(appId,token,messageId)}};module2.exports=InteractionMethods}});var require_Invites=__commonJS({"src/methods/Invites.ts"(exports2,module2){var Endpoints3=require_Endpoints();var InviteMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getInvite(inviteId,options){return this.requestHandler.request(Endpoints3.INVITES(inviteId),options,"get","json")}async deleteInvite(inviteId){return this.requestHandler.request(Endpoints3.INVITES(inviteId),{},"delete","json")}};module2.exports=InviteMethods}});var require_StageInstance=__commonJS({"src/methods/StageInstance.ts"(exports2,module2){var Endpoints3=require_Endpoints();var StageInstanceMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async createStageInstance(data){return this.requestHandler.request(Endpoints3.STAGE_INSTANCES,{},"post","json",data)}async getStageInstance(channelId){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"get","json")}async editStageInstance(channelId,data){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"patch","json",data)}async deleteStageInstance(channelId,reason){return this.requestHandler.request(Endpoints3.STAGE_INSTANCE_CHANNEL(channelId),{},"delete","json",{reason})}};module2.exports=StageInstanceMethods}});var require_Users=__commonJS({"src/methods/Users.ts"(exports2,module2){var Endpoints3=require_Endpoints();var UserMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getSelf(){return this.requestHandler.request(Endpoints3.USER("@me"),{},"get","json")}async getUser(userId){return this.requestHandler.request(Endpoints3.USER(userId),{},"get","json")}async updateSelf(data){return this.requestHandler.request(Endpoints3.USER("@me"),{},"patch","json",data)}async getGuilds(options){return this.requestHandler.request(Endpoints3.USER_GUILDS("@me"),{},"get","json",options)}async leaveGuild(guildId){return this.requestHandler.request(Endpoints3.USER_GUILD("@me",guildId),{},"delete","json")}async createDirectMessageChannel(userId){return this.requestHandler.request(Endpoints3.USER_CHANNELS("@me"),{},"post","json",{recipient_id:userId})}async createGroupDirectMessageChannel(data){return this.requestHandler.request(Endpoints3.USER_CHANNELS("@me"),{},"post","json",data)}async getConnections(){return this.requestHandler.request(Endpoints3.USER_CONNECTIONS("@me"),{},"get","json")}async getApplicationRoleConnection(appId){return this.requestHandler.request(Endpoints3.USER_APPLICATION_ROLE_CONNECTION("@me",appId),{},"get","json")}async updateApplicationRoleConnection(appId,data){return this.requestHandler.request(Endpoints3.USER_APPLICATION_ROLE_CONNECTION("@me",appId),{},"put","json",data)}};module2.exports=UserMethods}});var require_Voice=__commonJS({"src/methods/Voice.ts"(exports2,module2){var Endpoints3=require_Endpoints();var VoiceMethods=class{constructor(requestHandler){this.requestHandler=requestHandler}async getVoiceRegions(){return this.requestHandler.request(Endpoints3.VOICE_REGIONS,{},"get","json")}};module2.exports=VoiceMethods}});var require_Webhooks=__commonJS({"src/methods/Webhooks.ts"(exports2,module2){var Endpoints3=require_Endpoints();var Constants3=require_Constants();var mentionRegex=/@([^<>@ ]*)/gsmu;var WebhookMethods=class{constructor(requestHandler,disableEveryone){this.requestHandler=requestHandler;this.disableEveryone=disableEveryone}async createWebhook(channelId,data){return this.requestHandler.request(Endpoints3.CHANNEL_WEBHOOKS(channelId),{},"post","json",data)}async getChannelWebhooks(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_WEBHOOKS(channelId),{},"get","json")}async getGuildWebhooks(guildId){return this.requestHandler.request(Endpoints3.GUILD_WEBHOOKS(guildId),{},"get","json")}async getWebhook(webhookId,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"get","json");return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"get","json")}async updateWebhook(webhookId,data,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"patch","json",data);return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"patch","json",data)}async deleteWebhook(webhookId,token){if(token)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),{},"delete","json");return this.requestHandler.request(Endpoints3.WEBHOOK(webhookId),{},"delete","json")}async executeWebhook(webhookId,token,data,options){if(typeof data!=="string"&&!(data==null?void 0:data.content)&&!(data==null?void 0:data.embeds)&&!(data==null?void 0:data.components)&&!(data==null?void 0:data.files))throw new Error("Missing content or embeds or components or files");if(typeof data==="string")data={content:data};if(data.content&&((options==null?void 0:options.disableEveryone)??this.disableEveryone))data.content=data.content.replace(mentionRegex,replaceEveryone);if(options)delete options.disableEveryone;if(data.files)return this.requestHandler.request(`${Endpoints3.WEBHOOK_TOKEN(webhookId,token)}`,options,"post","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN(webhookId,token),options,"post","json",data)}async executeWebhookSlack(webhookId,token,data,options){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_SLACK(webhookId,token),options,"post","json",data)}async executeWebhookGitHub(webhookId,token,data,options={}){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_GITHUB(webhookId,token),options,"post","json",data)}async getWebhookMessage(webhookId,token,messageId,threadId){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadId},"get","json")}async editWebhookMessage(webhookId,token,messageId,data){let threadID=void 0;if(data.thread_id)threadID=data.thread_id;delete data.thread_id;if(data.files)return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadID},"patch","multipart",Constants3.standardMultipartHandler(data));else return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadID},"patch","json",data)}async deleteWebhookMessage(webhookId,token,messageId,threadId){return this.requestHandler.request(Endpoints3.WEBHOOK_TOKEN_MESSAGE(webhookId,token,messageId),{thread_id:threadId},"delete","json")}};var isValidUserMentionRegex=/^[&!]?\d+$/;function replaceEveryone(_match,target){if(isValidUserMentionRegex.test(target))return`@${target}`;else return`@\u200B${target}`}module2.exports=WebhookMethods}});var require_SnowTransfer=__commonJS({"src/SnowTransfer.ts"(exports2,module2){init_RequestHandler();var AuditLogMethods=require_AuditLog();var AutoModerationMethods=require_AutoModeration();var BotMethods=require_Bots();var ChannelMethods=require_Channels();var GuildAssetsMethods=require_GuildAssets();var GuildMethods=require_Guilds();var GuildScheduledEventMethods=require_GuildScheduledEvent();var GuildTemplateMethods=require_GuildTemplate();var InteractionMethods=require_Interactions();var InviteMethods=require_Invites();var StageInstanceMethods=require_StageInstance();var UserMethods=require_Users();var VoiceMethods=require_Voice();var WebhookMethods=require_Webhooks();var Endpoints3=require_Endpoints();var SnowTransfer=class{constructor(token,options){if(typeof token==="string"&&token==="")throw new Error("Missing token");if(token&&(!token.startsWith("Bot")&&!token.startsWith("Bearer")))token=`Bot ${token}`;this.options={baseHost:Endpoints3.BASE_HOST,disableEveryone:false};this.token=token;Object.assign(this.options,options);this.ratelimiter=new Ratelimiter;this.requestHandler=new RequestHandler(this.ratelimiter,{token:this.token,baseHost:this.options.baseHost||Endpoints3.BASE_HOST});this.channel=new ChannelMethods(this.requestHandler,this.options.disableEveryone);this.user=new UserMethods(this.requestHandler);this.guildAssets=new GuildAssetsMethods(this.requestHandler);this.webhook=new WebhookMethods(this.requestHandler,this.options.disableEveryone);this.guild=new GuildMethods(this.requestHandler);this.guildScheduledEvent=new GuildScheduledEventMethods(this.requestHandler);this.guildTemplate=new GuildTemplateMethods(this.requestHandler);this.interaction=new InteractionMethods(this.requestHandler,this.webhook);this.invite=new InviteMethods(this.requestHandler);this.voice=new VoiceMethods(this.requestHandler);this.bot=new BotMethods(this.requestHandler);this.auditLog=new AuditLogMethods(this.requestHandler);this.stageInstance=new StageInstanceMethods(this.requestHandler);this.autoMod=new AutoModerationMethods(this.requestHandler)}};module2.exports=SnowTransfer}});var src_exports={};__export(src_exports,{AuditLogMethods:()=>AuditLogMethods2,AutoModerationMethods:()=>AutoModerationMethods2,BotMethods:()=>BotMethods2,ChannelMethods:()=>ChannelMethods2,Constants:()=>Constants2,DiscordAPIError:()=>DiscordAPIError,Endpoints:()=>Endpoints2,GlobalBucket:()=>GlobalBucket,GuildAssetsMethods:()=>GuildAssetsMethods2,GuildMethods:()=>GuildMethods2,GuildScheduledEventMethods:()=>GuildScheduledEventMethods2,GuildTemplateMethods:()=>GuildTemplateMethods2,InteractionMethods:()=>InteractionMethods2,InviteMethods:()=>InviteMethods2,LocalBucket:()=>LocalBucket,Ratelimiter:()=>Ratelimiter,RequestHandler:()=>RequestHandler,SnowTransfer:()=>SnowTransfer2,StageInstanceMethods:()=>StageInstanceMethods2,UserMethods:()=>UserMethods2,VoiceMethods:()=>VoiceMethods2,WebhookMethods:()=>WebhookMethods2});module.exports=__toCommonJS(src_exports);init_RequestHandler();var AuditLogMethods2=require_AuditLog();var AutoModerationMethods2=require_AutoModeration();var BotMethods2=require_Bots();var ChannelMethods2=require_Channels();var GuildAssetsMethods2=require_GuildAssets();var GuildMethods2=require_Guilds();var GuildScheduledEventMethods2=require_GuildScheduledEvent();var GuildTemplateMethods2=require_GuildTemplate();var InteractionMethods2=require_Interactions();var InviteMethods2=require_Invites();var StageInstanceMethods2=require_StageInstance();var UserMethods2=require_Users();var VoiceMethods2=require_Voice();var WebhookMethods2=require_Webhooks();var Constants2=require_Constants();var Endpoints2=require_Endpoints();var SnowTransfer2=require_SnowTransfer();0&&(module.exports={AuditLogMethods,AutoModerationMethods,BotMethods,ChannelMethods,Constants,DiscordAPIError,Endpoints,GlobalBucket,GuildAssetsMethods,GuildMethods,GuildScheduledEventMethods,GuildTemplateMethods,InteractionMethods,InviteMethods,LocalBucket,Ratelimiter,RequestHandler,SnowTransfer,StageInstanceMethods,UserMethods,VoiceMethods,WebhookMethods}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "snowtransfer", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Minimalistic Rest client for the Discord Api", | ||
@@ -32,14 +32,14 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"discord-api-types": "^0.37.60", | ||
"undici": "^5.26.3" | ||
"discord-api-types": "^0.37.67", | ||
"undici": "^6.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.8.5", | ||
"@typescript-eslint/eslint-plugin": "^6.7.5", | ||
"@typescript-eslint/parser": "^6.7.5", | ||
"eslint": "^8.51.0", | ||
"tsup": "^7.2.0", | ||
"typedoc": "^0.25.2", | ||
"typedoc-plugin-mdn-links": "^3.1.0", | ||
"typescript": "^5.2.2" | ||
"@types/node": "^20.11.6", | ||
"@typescript-eslint/eslint-plugin": "^6.19.1", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
"eslint": "^8.56.0", | ||
"tsup": "^8.0.1", | ||
"typedoc": "^0.25.7", | ||
"typedoc-plugin-mdn-links": "^3.1.13", | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -46,0 +46,0 @@ "files": [ |
# A minimalistic rest client for the discord api | ||
--- | ||
[![GitHub stars](https://img.shields.io/github/stars/DasWolke/SnowTransfer.svg)](https://github.com/DasWolke/SnowTransfer/stargazers) [![Travis](https://img.shields.io/travis/DasWolke/SnowTransfer.svg)](https://github.com/DasWolke/SnowTransfer) [![npm](https://img.shields.io/npm/dm/snowtransfer.svg)](https://www.npmjs.com/package/snowtransfer) [![npm](https://img.shields.io/npm/v/snowtransfer.svg)](https://www.npmjs.com/package/snowtransfer) | ||
[![GitHub stars](https://img.shields.io/github/stars/DasWolke/SnowTransfer.svg)](https://github.com/DasWolke/SnowTransfer/stargazers) [![npm](https://img.shields.io/npm/dm/snowtransfer.svg)](https://www.npmjs.com/package/snowtransfer) [![npm](https://img.shields.io/npm/v/snowtransfer.svg)](https://www.npmjs.com/package/snowtransfer) | ||
@@ -6,0 +6,0 @@ Part of the WeatherStack |
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
491965
3536
+ Addedundici@6.21.0(transitive)
- Removed@fastify/busboy@2.1.1(transitive)
- Removedundici@5.28.4(transitive)
Updateddiscord-api-types@^0.37.67
Updatedundici@^6.4.0