@skyhelperbot/utils 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -4
- package/dist/{classes → types/classes}/SkytimesUtils.d.ts +4 -5
- package/dist/types/classes/index.d.ts +3 -0
- package/dist/types/classes/shardsUtil.d.ts +77 -0
- package/dist/{classes → types/classes}/utils.d.ts +3 -0
- package/dist/types/constants/eventDatas.d.ts +31 -0
- package/dist/{constants → types/constants}/index.d.ts +1 -0
- package/dist/{constants → types/constants}/shardsInfo.d.ts +12 -16
- package/dist/{constants → types/constants}/shardsTimeline.d.ts +3 -2
- package/dist/{index.d.ts → types/index.d.ts} +1 -0
- package/dist/types/typings.d.ts +29 -0
- package/dist/types/utils/PermissionUtils.d.ts +84 -0
- package/dist/types/utils/getNextTs.d.ts +10 -0
- package/dist/types/utils/index.d.ts +16 -0
- package/dist/{utils → types/utils}/parseDateFormat.d.ts +1 -0
- package/dist/{utils → types/utils}/parsePerms.d.ts +2 -0
- package/dist/{utils → types/utils}/postToBin.d.ts +1 -0
- package/dist/{utils → types/utils}/recursiveReadDir.d.ts +1 -0
- package/dist/{utils → types/utils}/resolveColors.d.ts +1 -0
- package/dist/types/utils/v2-builders.d.ts +14 -0
- package/package.json +17 -11
- package/dist/classes/LeaderBoardCard.d.ts +0 -59
- package/dist/classes/LeaderBoardCard.js +0 -249
- package/dist/classes/SkytimesUtils.js +0 -116
- package/dist/classes/WinnerCard.d.ts +0 -13
- package/dist/classes/WinnerCard.js +0 -117
- package/dist/classes/index.d.ts +0 -5
- package/dist/classes/index.js +0 -5
- package/dist/classes/shardsUtil.d.ts +0 -40
- package/dist/classes/shardsUtil.js +0 -122
- package/dist/classes/utils.js +0 -28
- package/dist/constants/eventDatas.d.ts +0 -31
- package/dist/constants/eventDatas.js +0 -105
- package/dist/constants/index.js +0 -5
- package/dist/constants/shardsInfo.js +0 -424
- package/dist/constants/shardsTimeline.js +0 -46
- package/dist/typings.d.ts +0 -58
- package/dist/typings.js +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -5
- package/dist/utils/parseDateFormat.js +0 -25
- package/dist/utils/parsePerms.js +0 -54
- package/dist/utils/postToBin.js +0 -15
- package/dist/utils/recursiveReadDir.js +0 -37
- package/dist/utils/resolveColors.js +0 -63
- package/shared/assets/Point.png +0 -0
- package/shared/assets/Win.png +0 -0
- package/shared/assets/medal_champion_award_winner_olympic_icon_207790.png +0 -0
- package/shared/assets/server.svg +0 -41
- package/shared/fonts/circularstd-black.otf +0 -0
- package/shared/fonts/notoemoji-bold.ttf +0 -0
- package/shared/fonts/notosans-black.ttf +0 -0
- package/shared/fonts/notosans-jp-black.ttf +0 -0
- package/shared/fonts/notosans-kr-black.ttf +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./classes/index.js";
|
|
3
|
-
|
|
4
|
-
export * from "./constants/index.js";
|
|
1
|
+
import{emojis as f}from"@skyhelperbot/constants";import{request as B}from"undici";var U=async s=>{let e=await B("https://hst.sh/documents/",{method:"POST",body:typeof s=="object"?JSON.stringify(s,null,2):s});if(e.statusCode!==200)throw new Error("Status code did not return 200, something went wrong.");return`https://hst.sh/${(await e.body.json()).key}.javascript`};var v={AddReactions:"Add Reactions",Administrator:"Administrator",AttachFiles:"Attach Files",BanMembers:"Ban Members",ChangeNickname:"Change Nickname",Connect:"Connect",CreateInstantInvite:"Create Instant Invite",CreatePrivateThreads:"Create Private Threads",CreatePublicThreads:"Create Public Threads",DeafenMembers:"Deafen Members",EmbedLinks:"Embed Links",KickMembers:"Kick Members",ManageChannels:"Manage Channels",ManageEmojisAndStickers:"Manage Emojis and Stickers",ManageGuildExpressions:"Manage Expressions",ManageEvents:"Manage Events",ManageGuild:"Manage Server",ManageMessages:"Manage Message",ManageNicknames:"Manage Nicknames",ManageRoles:"Manage Roles",ManageThreads:"Manage Threads",ManageWebhooks:"Manage Webhooks",MentionEveryone:"Mention Everyone",ModerateMembers:"Moderate Members",MoveMembers:"Move Members",MuteMembers:"Mute Members",PrioritySpeaker:"Priority Speaker",ReadMessageHistory:"Read Message History",RequestToSpeak:"Request to Speak",SendMessages:"Send messages",SendMessagesInThreads:"Send Messages In Threads",SendTTSMessages:"Send TTS messages",Speak:"Speak",Stream:"Video",UseApplicationCommands:"Use Application Commands",UseEmbeddedActivities:"Use Embedded Activities",UseExternalEmojis:"Use External Emojis",UseExternalStickers:"Use External Stickers",UseVAD:"Use Voice Activity",ViewAuditLog:"View Audit Log",ViewChannel:"View Channel",ViewGuildInsights:"View Server Insights"},j=s=>Array.isArray(s)?s.map(e=>`\`${v[e]}\` `).join(", "):`\`${v[s]}\``;import{join as y,extname as V}from"path";import{readdirSync as E,lstatSync as G}from"fs";var H=(s,e=[],t=[".js",".ts"])=>{let a=[],n=r=>{E(y(process.cwd(),r)).forEach(m=>{if(G(y(process.cwd(),r,m)).isDirectory()&&!e.includes(m))n(y(r,m));else{let i=V(m);if(!t.includes(i))return;let u=y(process.cwd(),r,m);a.push(u)}})};return n(s),a};var Z=s=>{let e=[{regex:/^\d{2}-\d{2}-\d{4}$/,format:"DD-MM-YYYY"},{regex:/^\d{2}\/\d{2}\/\d{4}$/,format:"DD/MM/YYYY"},{regex:/^\d{4}-\d{2}-\d{2}$/,format:"YYYY-MM-DD"},{regex:/^\d{4}\/\d{2}\/\d{2}$/,format:"YYYY/MM/DD"},{regex:/^\d{1,2}-\d{1,2}-\d{4}$/,format:"D-M-YYYY"},{regex:/^\d{1,2}\/\d{1,2}\/\d{4}$/,format:"D/M/YYYY"},{regex:/^[A-Za-z]+\s\d{1,2},\s\d{4}$/,format:"Month DD, YYYY"}];for(let{regex:t,format:a}of e)if(t.test(s))return a;return null};function Q(s){let e;if(typeof s=="string"){if(s==="Random")return Math.floor(Math.random()*16777216);if(s==="Default")return 0;if(/^#?[\da-f]{6}$/i.test(s))return parseInt(s.replace("#",""),16);e=R[s]}else Array.isArray(s)?e=(s[0]<<16)+(s[1]<<8)+s[2]:e=s;if(!Number.isInteger(e))throw new Error("Not a number");if(e<0||e>16777215)throw new Error("Not in color range");return e}var R={Default:0,White:16777215,Aqua:1752220,Green:5763719,Blue:3447003,Yellow:16705372,Purple:10181046,LuminousVividPink:15277667,Fuchsia:15418782,Gold:15844367,Orange:15105570,Red:15548997,Grey:9807270,Navy:3426654,DarkAqua:1146986,DarkGreen:2067276,DarkBlue:2123412,DarkPurple:7419530,DarkVividPink:11342935,DarkGold:12745742,DarkOrange:11027200,DarkRed:10038562,DarkGrey:9936031,DarkerGrey:8359053,LightGrey:12370112,DarkNavy:2899536,Blurple:5793266,Greyple:10070709,DarkButNotBlack:2895667,NotQuiteBlack:2303786};import{ComponentType as c}from"discord-api-types/v10";function te(s,...e){let t=Array.isArray(s)?s:[s];return t.push(...e),{type:c.Container,components:t}}function O(s,...e){return{type:c.TextDisplay,content:[s,...e].join(`
|
|
2
|
+
`)}}function ae(s,e,t){return{type:c.Thumbnail,media:{url:s},description:e,spoiler:t}}function se(s,e){return{...e,media:{url:s,...e?.media}}}function ne(s,...e){let t=Array.isArray(s)?s:[s];return t.push(...e),{type:c.MediaGallery,items:t}}function re(s=!0,e=2){return{type:c.Separator,divider:s,spacing:e}}function ie(s,e,...t){return{type:c.Section,accessory:s,components:[O(e,...t)]}}function oe(s,e){return{type:c.File,file:{url:s},spoiler:e}}function de(s,...e){let t=Array.isArray(s)?s:[s];return t.push(...e),{type:c.ActionRow,components:t}}function me(s={}){return{type:c.Button,style:2,custom_id:"button",...s}}import{OverwriteType as N,PermissionFlagsBits as b}from"discord-api-types/v10";var T=class s{constructor(e=0n){this.perms=e;this.bitfield=this.resolveBitFields(e)}bitfield;get flags(){return this.resolveBitFlags(this.bitfield)}resolveBitFields=s.resolveBits.bind(s);resolveBitFlags=s.resolveFlags.bind(s);static resolveBits(e){if(typeof e=="bigint"&&e>0n)return e;if(Array.isArray(e))return e.map(this.resolveBits.bind(this)).reduce((t,a)=>t|a,0n);if(typeof e=="string"){if(!Number.isNaN(parseInt(e)))return BigInt(e);if(b[e]!==void 0)return b[e]}return console.warn("Recieved Unknown Permissions: ",e),0n}static resolveFlags(e){let t=[];for(let[a,n]of Object.entries(b))e&n&&t.push(a);return t}has(e){let t=this.resolveBitFields(e);return(this.bitfield&t)===t}remove(e){let t=this.resolveBitFields(e);return this.bitfield&=~t,this}add(e){let t=this.resolveBitFields(e);return this.bitfield|=t,this}missing(e){let a=this.resolveBitFields(e)&~this.bitfield;return this.resolveBitFlags(a)}static overwriteFor(e,t,a){let n="permissions"in e,r=this.permissionsFor(e,a);if(!n&&a.owner_id===e.user.id)return this.all();if(r.has("Administrator"))return this.all();let d=t.permission_overwrites.find(i=>i.id===t.guild_id);if(n){let i=new s(e.permissions),u=t.permission_overwrites.find(_=>_.id===e.id);return d&&i.remove(d.deny).add(d.allow),u&&i.remove(u.deny).add(u.allow),i}let m=t.permission_overwrites.map(i=>i.type===N.Role&&e.roles.includes(i.id)&&i).filter(i=>i!==!1),l=t.permission_overwrites.find(i=>i.id===e.user.id);return d&&r.remove(d.deny).add(d.allow),m.length&&(r.remove(this.resolveBits(m.map(i=>i.deny))),r.add(this.resolveBits(m.map(i=>i.allow)))),l&&r.remove(l.deny).add(l.allow),r}static permissionsFor(e,t){let a="position"in e;if(!a&&t.owner_id===e.user.id)return this.all();let n=new s(a?e.permissions:e.roles.map(r=>{let d=t.roles.find(l=>l.id===r);if(!d)throw new Error("Role not found");let m=t.roles.find(l=>l.id===t.id);return BigInt(d.permissions)|BigInt(m.permissions)}));return n.has("Administrator")?this.all():n}static all(){let e=Object.values(b).reduce((t,a)=>t|a,0n);return new s(e)}toArray(){return this.flags}};import{DateTime as w}from"luxon";import{zone as D}from"@skyhelperbot/constants";function fe(){let s=w.fromISO("2025-11-20",{zone:D}).startOf("day"),e=w.now().setZone(D),t=s.plus({days:3}).endOf("day"),a=t;for(;e>a;)a=a.plus({days:14});let n=a.minus({days:3}).startOf("day");if(e<n){let r=n.diffNow(["days","hours","minutes","seconds"]).toFormat("d'd' h'h' m'm' s's'");if(n>s)return{visiting:!1,nextVisit:n,duration:r};if(n.equals(s))return{visiting:!1,nextVisit:n,duration:r}}if(e>=n&&e<=a){let r=a.diffNow(["days","hours","minutes","seconds"]).toFormat("d'd' h'h' m'm' s's'");if(t<a)return{visiting:!0,nextVisit:n,duration:r};if(s.equals(a))return{visiting:!0,nextVisit:n,duration:r}}}function be(s,e=8){let t=Math.round(s/100*e),a="";for(let n=0;n<e;n++){let r=n<t;n===0?a+=r?`<:_:${f.progress_filled_start}>`:`<:_:${f.progress_empty_start}>`:n===e-1?a+=r?`<:_:${f.progress_filled_end}>`:`<:_:${f.progress_empty_end}>`:a+=r?`<:_:${f.progress_filled_middle}>`:`<:_:${f.progress_empty_middle}>`}return`${a} ${s}%`}import{DateTime as g}from"luxon";var A=s=>{let e=(t,a,n,r,d,m,l,i,u,_,F)=>({earlySky:s.startOf("day").plus({hours:t,minutes:a,seconds:n}),gateShard:s.startOf("day").plus({hours:r,minutes:d}),start:s.startOf("day").plus({hours:m,minutes:l,seconds:i}),end:s.startOf("day").plus({hours:u,minutes:_}),shardMusic:F});return{C:[e(7,7,50,7,40,7,48,40,11,40,"Lights Afar"),e(13,7,50,13,40,13,48,40,17,40,"Lights Afar"),e(19,7,50,19,40,19,48,40,23,40,"Lights Afar")],b:[e(1,37,50,2,10,2,18,40,6,10,"An Abrupt Premonition"),e(9,37,50,10,10,10,18,40,14,10,"An Abrupt Premonition"),e(17,37,50,18,10,18,18,40,22,10,"An Abrupt Premonition")],A:[e(1,47,50,2,20,2,28,40,6,20,"Lights Afar"),e(7,47,50,8,20,8,28,40,12,20,"Lights Afar"),e(13,47,50,14,20,14,28,40,18,20,"Lights Afar")],a:[e(1,17,50,1,50,1,58,40,5,50,"An Abrupt Premonition"),e(9,17,50,9,50,9,58,40,13,50,"An Abrupt Premonition"),e(17,17,50,17,50,17,58,40,21,50,"An Abrupt Premonition")],B:[e(2,57,50,3,30,3,38,40,7,30,"Of The Essence"),e(8,57,50,9,30,9,38,40,13,30,"Of The Essence"),e(14,57,50,15,30,15,38,40,19,30,"Of The Essence")]}};var o={a:{type:"black",colors:"#000000",weekdays:[6,7]},A:{type:"red",colors:"#FF0000",weekdays:[2,3]},b:{type:"black",colors:"#000000",weekdays:[7,1]},B:{type:"red",colors:"#FF0000",weekdays:[3,4]},C:{type:"red",colors:"#FF0000",weekdays:[1,2]}},I={prairie:{a:{area:"Butterfly Fields, <:r5Prairie:1150596314883690607> Daylight Prairie",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226741731119165/ButterflyFields.png",...o.a,location:"https://media.discordapp.net/attachments/575827924343848960/1119162577126178846/01_Daylight_Prairie_-_Butterfly_Field.png",data:"https://media.discordapp.net/attachments/575827924343848960/1053249686422687784/dp-b_Butterfly_Field.png"},A:{area:"Bird's Nest, <:r5Prairie:1150596314883690607> Daylight Prairie",ac:2.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226742024708187/BirdsNest.png",...o.A,location:"https://media.discordapp.net/attachments/575827924343848960/1109738791268257812/01_Daylight_Prairie_-_Birds_Nest.png",data:"https://media.discordapp.net/attachments/575827924343848960/1044197796577824839/dp-r_Bird_Nest.png"},b:{area:"Village Island, <:r5Prairie:1150596314883690607> Daylight Prairie",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226741412343989/VillageIsland.png",...o.b,location:"https://media.discordapp.net/attachments/575827924343848960/1115536957875945604/01_Daylight_Prairie_-_Village_Islands_and_Koi_Pond.png",data:"https://media.discordapp.net/attachments/575827924343848960/1049635543421550652/dp-b_Village-Koi.png"},B:{area:"Sanctuary Island, <:r5Prairie:1150596314883690607> Daylight Prairie",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226740741263510/SanctuaryIsland.png",...o.B,location:"https://media.discordapp.net/attachments/575827924343848960/1117348946390564934/IMG_4458.png",data:"https://media.discordapp.net/attachments/575827924343848960/1051464559065583637/dp-r_Sanctuary_Islands.png"},C:{area:"Prairie Caves, <:r5Prairie:1150596314883690607> Daylight Prairie",ac:2,image:"https://media.discordapp.net/attachments/867638574571323424/1159226741110349925/PrairieCave.png",...o.C,location:"https://media.discordapp.net/attachments/575827924343848960/1124597919178313749/01_Daylight_Prairie_-_Prairie_Caves.png",data:"https://media.discordapp.net/attachments/1123347180988661902/1126113425286766702/dp-r_Caves.jpg"}},forest:{a:{area:"Forest Brook, <:r4Forest:1150596343354630235> Hidden Forest",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226847062671400/ForestBrook.png",...o.a,location:"https://media.discordapp.net/attachments/575827924343848960/1117712849217781871/IMG_3543.png",data:"https://media.discordapp.net/attachments/575827924343848960/1051802895634399242/hf-b_Forest_Brook.png"},A:{area:"Treehouse, <:r4Forest:1150596343354630235> Hidden Forest",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226739713650788/Treehouse.png",...o.A,location:"https://media.discordapp.net/attachments/575827924343848960/1111912764420665394/02_Hidden_Forest_-_Assembly_Treehouse.png",data:"https://media.discordapp.net/attachments/575827924343848960/1046371999586451597/png_20221027_180854_0000.png"},b:{area:"Boneyard, <:r4Forest:1150596343354630235> Hidden Forest",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226740472819793/Boneyard.png",...o.b,location:"https://media.discordapp.net/attachments/575827924343848960/1121336759633059890/02_Hidden_Forest_-_Broken_Bridge.png",data:"https://media.discordapp.net/attachments/575827924343848960/1048189111145603072/hf-b_Boneyard.png"},B:{area:"Sunny Forest, <:r4Forest:1150596343354630235> Hidden Forest",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226659518558298/ElevatedClearing.png",...o.B,location:"https://media.discordapp.net/attachments/575827924343848960/1119522919983349780/02_Hidden_Forest_-_Elevated_Clearing.png",data:"https://media.discordapp.net/attachments/575827924343848960/1053645676870897724/hf-r_Elevated_Clearing.png"},C:{area:"Forest End, <:r4Forest:1150596343354630235> Hidden Forest",ac:2.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226740099534868/ForestEnd.png",...o.C,location:"https://media.discordapp.net/attachments/575827924343848960/1115899669847998526/02_Hidden_Forest_-_Forest_End.png",data:"https://media.discordapp.net/attachments/575827924343848960/1050078656015376496/hf-r_Forest_End.png"}},valley:{a:{area:"Ice Rink, <:r3Valley:1150596376930037850> Valley of Triumph",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226659262693446/IceRink.png",...o.a,location:"https://media.discordapp.net/attachments/575827924343848960/1116263531101306940/03_Valley_of_Triumph_-_Ice_Rink.png",data:"https://media.discordapp.net/attachments/575827924343848960/1050351219383730186/vt-b_Ice_Rink.png"},A:{area:"Village of Dreams, <:r3Valley:1150596376930037850> Valley of Triumph",ac:2.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226658918780948/VillageOfDreams.png",...o.A,location:"https://media.discordapp.net/attachments/575827924343848960/1114449712070799360/03_Valley_of_Triumph_-_Village_of_Dreams.png",data:"https://media.discordapp.net/attachments/575827924343848960/1048546903702384721/vt-r_Village_of_Dreams.png"},b:{area:"Ice Rink, <:r3Valley:1150596376930037850> Valley of Triumph",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226659262693446/IceRink.png",...o.b,location:"https://media.discordapp.net/attachments/575827924343848960/1116263531101306940/03_Valley_of_Triumph_-_Ice_Rink.png",data:"https://media.discordapp.net/attachments/575827924343848960/1050351219383730186/vt-b_Ice_Rink.png"},B:{area:"Hermit's Valley, <:r3Valley:1150596376930037850> Valley of Triumph",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226658629365770/HermitsValley.png",...o.B,location:"https://media.discordapp.net/attachments/575827924343848960/1110464646911115314/03_Valley_of_Triumph_-_Hermit_Valley.png",data:"https://media.discordapp.net/attachments/575827924343848960/1055814361026936952/vt-r_Hermit_Valley.png"},C:{area:"Village of Dreams, <:r3Valley:1150596376930037850> Valley of Triumph",ac:2.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226658918780948/VillageOfDreams.png",...o.C,location:"https://media.discordapp.net/attachments/575827924343848960/1114449712070799360/03_Valley_of_Triumph_-_Village_of_Dreams.png",data:"https://media.discordapp.net/attachments/575827924343848960/1048546903702384721/vt-r_Village_of_Dreams.png"}},wasteland:{a:{area:"Broken Temple, <:r2Wasteland:1150596423822356511> Golden Wasteland",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226658209923202/BrokenTemple.png",...o.a,location:"https://media.discordapp.net/attachments/575827924343848960/1125685677384806531/04_Golden_Wasteland_-_Broken_Temple.png",data:"https://media.discordapp.net/attachments/575827924343848960/1045297714474254396/gw-b_Broken_Temple.png"},A:{area:"Crab Fields, <:r2Wasteland:1150596423822356511> Golden Wasteland",ac:2.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226846794231919/CrabFields.png",...o.A,location:"https://media.discordapp.net/attachments/575827924343848960/1094518173262417990/04_Golden_Wasteland_-_Crab_Fields.png",data:"https://media.discordapp.net/attachments/575827924343848960/1050722076681568256/gw-r_Shipwreck.png"},b:{area:"Battlefield, <:r2Wasteland:1150596423822356511> Golden Wasteland",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657148784680/Battlefield.png",...o.b,location:"https://media.discordapp.net/attachments/575827924343848960/1118435910615302164/04_Golden_Wasteland_-_Battlefield.png",data:"https://media.discordapp.net/attachments/575827924343848960/1052530499668688957/gw-b_Battlefield.png"},B:{area:"Forgotten Ark, <:r2Wasteland:1150596423822356511> Golden Wasteland",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657933119508/ForgottenArk.png",...o.B,location:"https://media.discordapp.net/attachments/575827924343848960/1112639178048548884/IMG_3148.png",data:"https://media.discordapp.net/attachments/575827924343848960/1069221627918827622/Forgotten_Ark_1.png"},C:{area:"Graveyard, <:r2Wasteland:1150596423822356511> Golden Wasteland",ac:2,image:"https://media.discordapp.net/attachments/867638574571323424/1159226742263787623/Graveyard.png",...o.C,location:"https://media.discordapp.net/attachments/575827924343848960/1109015846753419294/04_Golden_Wasteland_-_Graveyard.png",data:"https://media.discordapp.net/attachments/575827924343848960/1043553879289253919/gw-r_Graveyard.png"}},vault:{a:{area:"Starlight Desert, <:r1Vault:1150596447679553636> Vault of Knowledge",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657656287392/StarlightDesert.png",...o.a,location:"https://media.discordapp.net/attachments/575827924343848960/1090896818604347392/IMG_1525.png",data:"https://media.discordapp.net/attachments/575827924343848960/1077178980051984455/vk-b_Starlight_Desert.png"},A:{area:"Jellyfish Cove, Starlight Desert, <:r1Vault:1150596447679553636> Vault of Knowledge",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657404616756/JellyfishCove.png",...o.A,location:"https://media.discordapp.net/attachments/575827924343848960/1089082330305544242/05_Vault_of_Knowledge_-_Jellyfish_Cove.png",data:"https://media.discordapp.net/attachments/575827924343848960/1049290746190106694/vk-r_Starlight_Desert.png"},b:{area:"Starlight Desert, <:r1Vault:1150596447679553636> Vault of Knowledge",wax:200,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657656287392/StarlightDesert.png",...o.b,location:"https://media.discordapp.net/attachments/575827924343848960/1090896818604347392/IMG_1525.png",data:"https://media.discordapp.net/attachments/575827924343848960/1077178980051984455/vk-b_Starlight_Desert.png"},B:{area:"Jellyfish Cove, Starlight Desert, <:r1Vault:1150596447679553636> Vault of Knowledge",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657404616756/JellyfishCove.png",...o.B,location:"https://media.discordapp.net/attachments/575827924343848960/1089082330305544242/05_Vault_of_Knowledge_-_Jellyfish_Cove.png",data:"https://media.discordapp.net/attachments/575827924343848960/1049290746190106694/vk-r_Starlight_Desert.png"},C:{area:"Jellyfish Cove, Starlight Desert, <:r1Vault:1150596447679553636> Vault of Knowledge",ac:3.5,image:"https://media.discordapp.net/attachments/867638574571323424/1159226657404616756/JellyfishCove.png",...o.C,location:"https://media.discordapp.net/attachments/575827924343848960/1089082330305544242/05_Vault_of_Knowledge_-_Jellyfish_Cove.png",data:"https://media.discordapp.net/attachments/575827924343848960/1049290746190106694/vk-r_Starlight_Desert.png"}}};var p=s=>s*60,h={geyser:{name:"Geyser",index:0,duration:15,offset:0,infographic:{by:"Clement",image:"https://media.discordapp.net/attachments/867638574571323424/1252998364941914243/Visit_Geyser_Clement.png?ex=66744129&is=6672efa9&hm=8d76d1767aca362d23547b1e3beb2b610f58e4fbec24b12af56fdc745f7074e8&"},displayAllTimes:!0,interval:p(2)},grandma:{name:"Grandma",index:1,duration:15,offset:30,infographic:{by:"Clement",image:"https://media.discordapp.net/attachments/867638574571323424/1252998366288416849/Visit_Grandma_Clement.png?ex=6674412a&is=6672efaa&hm=7228b695ec7008204fede2f3d6b4864a06a7cfa25a14ab4d7572957ee940044c&"},displayAllTimes:!0,interval:p(2)},turtle:{name:"Turtle",index:2,duration:10,offset:50,infographic:{by:"Velvet",image:"https://media.discordapp.net/attachments/867638574571323424/1252998363205472316/Visit_Turtle_Velvet.jpg?ex=66744129&is=6672efa9&hm=8c189ff8501fc88810606b832addbea8a9a81eb7a7a6b17019ff1ced593e1ae8&"},displayAllTimes:!0,interval:p(2)},"daily-reset":{name:"Daily Reset",index:3,offset:0,interval:p(24)},eden:{name:"Eden/Weekly Reset",index:4,offset:0,interval:p(168),occursOn:{weekDays:[7]}},aurora:{name:"Aurora's concert",index:5,offset:0,duration:50,displayAllTimes:!0,interval:p(2)},"dream-skater":{name:"Dream Skater",index:6,duration:15,displayAllTimes:!0,occursOn:{weekDays:[5,6,7]},offset:p(1),interval:p(2)},"passage-quests":{name:"Passage Quests",index:7,offset:0,displayAllTimes:!0,interval:15},"nest-sunset":{name:"Nest Sunset",index:8,offset:40,displayAllTimes:!0,interval:p(1)},"fireworks-festival":{name:"Fireworks Festival",index:9,offset:0,duration:10,displayAllTimes:!0,interval:p(4),occursOn:{dayOfTheMonth:1}},"fairy-ring":{name:"Fairy Ring",index:11,offset:50,displayAllTimes:!0,interval:60},"brook-rainbow":{name:"Forest Brook Rainbow",index:12,displayAllTimes:!0,offset:p(5),interval:p(12)}};import{CDNRoutes as Oe}from"discord-api-types/v10";function P(s,e){let t=[],a=s.startOf("day"),n=e.startOf("day");for(;a<=n;)t.push(a),a=a.plus({days:1});return t}import{zone as $}from"@skyhelperbot/constants";var C=["C","b","A","a","B","b","C","a","A","b","B","a"],k=["prairie","forest","valley","wasteland","vault"],S=class{static getDate(e){let t="America/Los_Angeles",a;try{if(e){let[n,r,d]=e.split("-").map(Number);a=g.fromObject({year:n,month:r,day:d},{zone:t}).startOf("day")}else a=g.now().setZone(t).startOf("day");return a.isValid?a:"invalid"}catch(n){throw new Error(n)}}static shardsIndex(e){let t=e.day,a=(t-1)%C.length,n=C[a],r=(t-1)%k.length,d=k[r];return{currentShard:n,currentRealm:d}}static getSuffix(e){let t=["th","st","nd","rd"],a=e%10,n=e%100;return t[a===1&&n!==11?1:a===2&&n!==12?2:a===3&&n!==13?3:0]}static getStatus(e){let t="America/Los_Angeles",{currentShard:a}=this.shardsIndex(e),n=A(e)[a],r=g.now().setZone(t);if(o[a].weekdays.includes(e.weekday))return"No Shard";let m=[];for(let l=0;l<n.length;l++){let i=n[l];if(r>=i.start&&r<=i.end){m.push({index:l+1,active:!0,start:i.start,end:i.end,duration:i.end.diff(r,["days","hours","minutes","seconds"]).toFormat("dd'd' hh'h' mm'm' ss's'")});continue}else if(r<i.start){m.push({index:l+1,active:!1,start:i.start,end:i.end,duration:i.start.diff(r,["days","hours","minutes","seconds"]).toFormat("dd'd' hh'h' mm'm' ss's'")});continue}else if(r>i.end){m.push({index:l+1,ended:!0,start:i.start,end:i.end,duration:r.diff(i.end,["days","hours","minutes","seconds"]).toFormat("dd'd' hh'h' mm'm' ss's'")});continue}}return m}static getShard(e){let{currentRealm:t,currentShard:a}=this.shardsIndex(e),n=I[t][a];if(o[a].weekdays.includes(e.weekday))return null;let d=A(e)[a];return{info:n,timings:d}}static getNextShard(e,t){let a=this.getShard(e);if(!a||t&&!t.some(n=>a.info.type.toLowerCase().includes(n)))return null;for(let[n,r]of a.timings.entries())if(e<=r.start)return{index:n+1,start:r.start,end:r.end,duration:r.start.diff(e,["days","hours","minutes","seconds"]).toFormat("dd'd' hh'h' mm'm' ss's'"),info:a.info};return null}static getNextShardFromNow(e){let t=g.now().setZone("America/Los_Angeles"),a=this.getNextShard(t,e);for(;!a;)t=t.plus({days:1}).startOf("day"),a=this.getNextShard(t,e);return a}static getShardsBetween(e=g.now().setZone($),t){let a=P(e,t),n=[];for(let r of a)n.push({date:r,shard:this.getNextShard(r)});return n}};import{DateTime as x}from"luxon";var M=class{static getAllTimes(e,t){let a=e,n=[];for(;e.hasSame(a,"day");)n.push(`<t:${a.toUnixInteger()}:t>`),a=a.plus({minutes:t??0});return n.join(" \u2022 ")}static getOccurrenceDay(e){let t=x.now().setZone("America/Los_Angeles").startOf("day").plus({minutes:e.offset});if(e.occursOn){if(e.occursOn.weekDays)for(;!e.occursOn.weekDays.includes(t.weekday);)t=t.plus({days:1});if(e.occursOn.dayOfTheMonth)for(;t.day!==e.occursOn.dayOfTheMonth;)t=t.plus({days:1})}return t}static getNextEventOccurrence(e){let t=h[e];if(!t)throw new Error("Unknown Event");let a=x.now().setZone("America/Los_Angeles"),n=this.getOccurrenceDay(t);for(;n<a;)n=n.plus({minutes:t.interval??0});return n}static getEventDetails(e){let t=this.getNextEventOccurrence(e);return{event:h[e],nextOccurence:t,allOccurences:this.getAllTimes(this.getOccurrenceDay(h[e]),h[e].interval),status:this.getEventStatus(h[e],t)}}static allEventDetails(){let e=Object.keys(h).sort((a,n)=>h[a].index-h[n].index),t=[];for(let a of e)t.push([a,this.getEventDetails(a)]);return t}static getEventStatus(e,t){let a=x.now().setZone("America/Los_Angeles"),n={active:!1,nextTime:t,duration:t.diff(a).toFormat("d'd' h'h' m'm' s's'")};if(!e.duration)return n;let r=t.minus({minutes:e.interval??0}),d=r.plus({minutes:e.duration});return a>=r&&a<=d?{active:!0,startTime:r,endTime:d,nextTime:t,duration:d.diff(a).toFormat("d'd' h'h' m'm' s's'")}:n}};export{T as PermissionsUtil,S as ShardsUtil,M as SkytimesUtils,me as button,te as container,be as createEmojiProgressBar,h as eventData,oe as file,fe as getNextTs,ne as mediaGallery,se as mediaGalleryItem,Z as parseDateFormat,j as parsePerms,U as postToHaste,H as recursiveReadDir,Q as resolveColor,de as row,ie as section,re as separator,o as shardConfig,I as shardsInfo,A as shardsTimeline,O as textDisplay,ae as thumbnail};
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { eventData } from "../constants/eventDatas.js";
|
|
1
|
+
import { eventData, type EventKey } from "../constants/eventDatas.js";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
|
-
type EventKey = keyof typeof eventData;
|
|
4
3
|
/**
|
|
5
4
|
* Utilities for skytimes
|
|
6
5
|
*/
|
|
@@ -19,7 +18,7 @@ export declare class SkytimesUtils {
|
|
|
19
18
|
* Get the next occurrence of the event relative to now
|
|
20
19
|
* @param eventName The key of the event
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
static getNextEventOccurrence(eventName: EventKey): DateTime;
|
|
23
22
|
/**
|
|
24
23
|
* Get the details about an event, their status, next occurrence, all occurrences for the day
|
|
25
24
|
* @param key The event key
|
|
@@ -29,7 +28,7 @@ export declare class SkytimesUtils {
|
|
|
29
28
|
* Same as {@apilink SkytimesUtils.getEventDetails | getEventDetails} but for all of the events
|
|
30
29
|
* @returns An array of event details
|
|
31
30
|
*/
|
|
32
|
-
static allEventDetails(): [EventKey, EventDetails]
|
|
31
|
+
static allEventDetails(): Array<[EventKey, EventDetails]>;
|
|
33
32
|
/**
|
|
34
33
|
* Returns the event status of a given event
|
|
35
34
|
* @param event The event to get the status for
|
|
@@ -69,4 +68,4 @@ export interface EventDetails {
|
|
|
69
68
|
allOccurences: string;
|
|
70
69
|
status: Times;
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
//# sourceMappingURL=SkytimesUtils.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
import type { ShardsCountdown } from "../typings.js";
|
|
3
|
+
import { type ShardInfo } from "../constants/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sequence of Shards pattern
|
|
6
|
+
*/
|
|
7
|
+
declare const shardSequence: readonly ["C", "b", "A", "a", "B", "b", "C", "a", "A", "b", "B", "a"];
|
|
8
|
+
/**
|
|
9
|
+
* Sequence of realms pattern of shard
|
|
10
|
+
*/
|
|
11
|
+
declare const realmSequence: readonly ["prairie", "forest", "valley", "wasteland", "vault"];
|
|
12
|
+
/**
|
|
13
|
+
* @class shardsUtil
|
|
14
|
+
* @classdesc A class to handle shards and realms indexing.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ShardsUtil {
|
|
17
|
+
/**
|
|
18
|
+
* @method getDate - get provided date in luxon
|
|
19
|
+
* @param date - date to get in moment
|
|
20
|
+
*/
|
|
21
|
+
static getDate(date?: string | null): DateTime | string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns shards index for a given date
|
|
24
|
+
* @param date
|
|
25
|
+
*/
|
|
26
|
+
static shardsIndex(date: DateTime): {
|
|
27
|
+
currentShard: (typeof shardSequence)[number];
|
|
28
|
+
currentRealm: (typeof realmSequence)[number];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns suffix for a given number
|
|
32
|
+
* @param number The number to get the suffix for
|
|
33
|
+
*/
|
|
34
|
+
static getSuffix(number: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get all three shards status for a given date relative to the current time
|
|
37
|
+
* @param date The date for which to get the status for
|
|
38
|
+
*/
|
|
39
|
+
static getStatus(date: DateTime): ShardsCountdown[] | "No Shard";
|
|
40
|
+
static getShard(date: DateTime): {
|
|
41
|
+
info: ShardInfo;
|
|
42
|
+
timings: [import("../constants/shardsTimeline.js").TimelineType, import("../constants/shardsTimeline.js").TimelineType, import("../constants/shardsTimeline.js").TimelineType];
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get the next occuring black/red shard from the given date;
|
|
46
|
+
* @param shardType The type of shard to get the next occuring shard for
|
|
47
|
+
* @returns the shard details or null if no shard is found
|
|
48
|
+
*/
|
|
49
|
+
static getNextShard(date: DateTime, shardType?: Array<"black" | "red">): null | {
|
|
50
|
+
index: number;
|
|
51
|
+
start: DateTime;
|
|
52
|
+
end: DateTime;
|
|
53
|
+
duration: string;
|
|
54
|
+
info: ShardInfo;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get the next occuring shard from the given date
|
|
58
|
+
* @param shardType The type of shard to get the next occuring shard for
|
|
59
|
+
* @returns an upcoming shard relative from now
|
|
60
|
+
*/
|
|
61
|
+
static getNextShardFromNow(shardType?: Array<"black" | "red">): {
|
|
62
|
+
index: number;
|
|
63
|
+
start: DateTime;
|
|
64
|
+
end: DateTime;
|
|
65
|
+
duration: string;
|
|
66
|
+
info: ShardInfo;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Get shards between given range
|
|
70
|
+
*/
|
|
71
|
+
static getShardsBetween(start: DateTime<true> | DateTime<false> | undefined, end: DateTime): {
|
|
72
|
+
date: DateTime;
|
|
73
|
+
shard: ReturnType<typeof ShardsUtil.getNextShard>;
|
|
74
|
+
}[];
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=shardsUtil.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type APIUser } from "discord-api-types/v10";
|
|
2
|
+
import type { DateTime } from "luxon";
|
|
2
3
|
export declare const colors: {
|
|
3
4
|
blue: string;
|
|
4
5
|
white: string;
|
|
@@ -13,3 +14,5 @@ export declare const colors: {
|
|
|
13
14
|
};
|
|
14
15
|
export declare function fancyCount(n: number): string;
|
|
15
16
|
export declare function getUserAvatar(user: APIUser): string;
|
|
17
|
+
export declare function getDatesBetween(start: DateTime, end: DateTime): DateTime[];
|
|
18
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface EventData {
|
|
2
|
+
/** Name of the event */
|
|
3
|
+
name: string;
|
|
4
|
+
/** The index of the event to appear on the embed */
|
|
5
|
+
index: number;
|
|
6
|
+
/** The Offset of the event (in minutes) */
|
|
7
|
+
offset: number;
|
|
8
|
+
/** Approximate duration of the event during which its active after it starts (in minutes) */
|
|
9
|
+
duration?: number;
|
|
10
|
+
/** The interval at which the event occurs (in minutes) */
|
|
11
|
+
interval?: number;
|
|
12
|
+
/** Whether to display all their occurrence times in the embed */
|
|
13
|
+
displayAllTimes?: boolean;
|
|
14
|
+
/** The days on which the event occurs */
|
|
15
|
+
occursOn?: {
|
|
16
|
+
/** Weekdays on which the event occurs */
|
|
17
|
+
weekDays?: number[];
|
|
18
|
+
/** The day on which the event occurs */
|
|
19
|
+
dayOfTheMonth?: number;
|
|
20
|
+
};
|
|
21
|
+
/** Infographic related to the event, if any (Discord link)*/
|
|
22
|
+
infographic?: {
|
|
23
|
+
/** Credit */
|
|
24
|
+
by: string;
|
|
25
|
+
/** The guide */
|
|
26
|
+
image: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type EventKey = "geyser" | "grandma" | "turtle" | "daily-reset" | "eden" | "aurora" | "dream-skater" | "passage-quests" | "nest-sunset" | "fireworks-festival" | "fairy-ring" | "brook-rainbow";
|
|
30
|
+
export declare const eventData: Record<EventKey, EventData>;
|
|
31
|
+
//# sourceMappingURL=eventDatas.d.ts.map
|
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
export declare const shardConfig: {
|
|
2
2
|
a: {
|
|
3
|
-
type:
|
|
3
|
+
type: "black";
|
|
4
4
|
colors: string;
|
|
5
5
|
weekdays: number[];
|
|
6
6
|
};
|
|
7
7
|
A: {
|
|
8
|
-
type:
|
|
8
|
+
type: "red";
|
|
9
9
|
colors: string;
|
|
10
10
|
weekdays: number[];
|
|
11
11
|
};
|
|
12
12
|
b: {
|
|
13
|
-
type:
|
|
13
|
+
type: "black";
|
|
14
14
|
colors: string;
|
|
15
15
|
weekdays: number[];
|
|
16
16
|
};
|
|
17
17
|
B: {
|
|
18
|
-
type:
|
|
18
|
+
type: "red";
|
|
19
19
|
colors: string;
|
|
20
20
|
weekdays: number[];
|
|
21
21
|
};
|
|
22
22
|
C: {
|
|
23
|
-
type:
|
|
23
|
+
type: "red";
|
|
24
24
|
colors: string;
|
|
25
25
|
weekdays: number[];
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
export interface ShardInfo {
|
|
29
29
|
area: string;
|
|
30
|
-
|
|
30
|
+
wax?: number;
|
|
31
|
+
ac?: number;
|
|
31
32
|
image: string;
|
|
32
|
-
type:
|
|
33
|
+
type: "red" | "black";
|
|
33
34
|
colors: string;
|
|
34
35
|
weekdays: number[];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
image: string;
|
|
38
|
-
}[];
|
|
39
|
-
}
|
|
40
|
-
export interface ShardsInfo {
|
|
41
|
-
[key: string]: {
|
|
42
|
-
[key: string]: ShardInfo;
|
|
43
|
-
};
|
|
36
|
+
location: string;
|
|
37
|
+
data: string;
|
|
44
38
|
}
|
|
39
|
+
export type ShardsInfo = Record<string, Record<string, ShardInfo>>;
|
|
45
40
|
/**
|
|
46
41
|
* Returns the shard information for each area
|
|
47
42
|
* @example
|
|
48
43
|
* const info = shardsInfo[currentRealm][currentShard]
|
|
49
44
|
*/
|
|
50
45
|
export declare const shardsInfo: ShardsInfo;
|
|
46
|
+
//# sourceMappingURL=shardsInfo.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DateTime } from "luxon";
|
|
2
2
|
declare const shardSequence: readonly ["C", "b", "A", "a", "B", "b", "C", "a", "A", "b", "B", "a"];
|
|
3
|
-
export
|
|
3
|
+
export interface TimelineType {
|
|
4
4
|
readonly earlySky: DateTime;
|
|
5
5
|
readonly gateShard: DateTime;
|
|
6
6
|
readonly start: DateTime;
|
|
7
7
|
readonly end: DateTime;
|
|
8
8
|
readonly shardMusic: string;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
export type TimelineReturnType = Record<(typeof shardSequence)[number], [TimelineType, TimelineType, TimelineType]>;
|
|
11
11
|
/**
|
|
12
12
|
* Returns shards fall - end times for a given date
|
|
@@ -17,3 +17,4 @@ export type TimelineReturnType = Record<(typeof shardSequence)[number], [Timelin
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const shardsTimeline: (currentDate: DateTime) => TimelineReturnType;
|
|
19
19
|
export {};
|
|
20
|
+
//# sourceMappingURL=shardsTimeline.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DateTime } from "luxon";
|
|
2
|
+
import { Document } from "mongoose";
|
|
3
|
+
export interface SkyEvent {
|
|
4
|
+
eventActive: boolean;
|
|
5
|
+
eventName: string;
|
|
6
|
+
eventStarts: DateTime;
|
|
7
|
+
eventEnds: DateTime;
|
|
8
|
+
eventDuration: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TSData extends Document {
|
|
11
|
+
name: string;
|
|
12
|
+
visitDate: string;
|
|
13
|
+
value: string;
|
|
14
|
+
index: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SpecialEventData extends Document {
|
|
17
|
+
startDate: string;
|
|
18
|
+
endDate: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ShardsCountdown {
|
|
22
|
+
index: number;
|
|
23
|
+
active?: boolean;
|
|
24
|
+
ended?: boolean;
|
|
25
|
+
start: DateTime;
|
|
26
|
+
end: DateTime;
|
|
27
|
+
duration: string;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=typings.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { PermissionFlagsBits, type APIGuild, type APIGuildForumChannel, type APIGuildMember, type APIGuildStageVoiceChannel, type APIGuildVoiceChannel, type APINewsChannel, type APIRole, type APITextChannel } from "discord-api-types/v10";
|
|
2
|
+
type PermissionFlags = keyof typeof PermissionFlagsBits;
|
|
3
|
+
type StringPermissions = `${number}`;
|
|
4
|
+
export type PermissionsResolvable = bigint | PermissionFlags | StringPermissions | StringPermissions[] | bigint[] | PermissionFlags[];
|
|
5
|
+
export declare class PermissionsUtil {
|
|
6
|
+
readonly perms: PermissionsResolvable;
|
|
7
|
+
/**
|
|
8
|
+
* Bitfield of the permissions
|
|
9
|
+
*/
|
|
10
|
+
bitfield: bigint;
|
|
11
|
+
/**
|
|
12
|
+
* Flags of the permissions
|
|
13
|
+
*/
|
|
14
|
+
get flags(): ("Administrator" | "Connect" | "Speak" | "AddReactions" | "AttachFiles" | "BanMembers" | "ChangeNickname" | "CreateInstantInvite" | "CreatePrivateThreads" | "CreatePublicThreads" | "DeafenMembers" | "EmbedLinks" | "KickMembers" | "ManageChannels" | "ManageEmojisAndStickers" | "ManageGuildExpressions" | "ManageEvents" | "ManageGuild" | "ManageMessages" | "ManageNicknames" | "ManageRoles" | "ManageThreads" | "ManageWebhooks" | "MentionEveryone" | "ModerateMembers" | "MoveMembers" | "MuteMembers" | "PrioritySpeaker" | "ReadMessageHistory" | "RequestToSpeak" | "SendMessages" | "SendMessagesInThreads" | "SendTTSMessages" | "Stream" | "UseApplicationCommands" | "UseEmbeddedActivities" | "UseExternalEmojis" | "UseExternalStickers" | "UseVAD" | "ViewAuditLog" | "ViewChannel" | "ViewGuildInsights" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[];
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param perms Permissions to resolve
|
|
18
|
+
*/
|
|
19
|
+
constructor(perms?: PermissionsResolvable);
|
|
20
|
+
/**
|
|
21
|
+
* {@link PermissionsUtil.resolveBits} but as an instance method.
|
|
22
|
+
* This is me just being lazy really
|
|
23
|
+
*/
|
|
24
|
+
resolveBitFields: typeof PermissionsUtil.resolveBits;
|
|
25
|
+
/**
|
|
26
|
+
* {@link PermissionsUtil.resolveFlags} but as an instance method.
|
|
27
|
+
*/
|
|
28
|
+
resolveBitFlags: typeof PermissionsUtil.resolveFlags;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves given permission resolvable to bitfield
|
|
31
|
+
*
|
|
32
|
+
* @returns Returns the resolved bitfield
|
|
33
|
+
*/
|
|
34
|
+
static resolveBits(perms: PermissionsResolvable): bigint;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @returns Returns string representation of the permissions
|
|
38
|
+
*/
|
|
39
|
+
static resolveFlags(bits: bigint): PermissionFlags[];
|
|
40
|
+
/**
|
|
41
|
+
* Check if it contains the given permissions
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
has(perms: PermissionsResolvable): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Remove the permissions bits
|
|
47
|
+
*/
|
|
48
|
+
remove(perms: PermissionsResolvable): this;
|
|
49
|
+
/**
|
|
50
|
+
* Add the permissions bits
|
|
51
|
+
*/
|
|
52
|
+
add(perms: PermissionsResolvable): this;
|
|
53
|
+
/**
|
|
54
|
+
* Permissions that are missing from the passed permission resolvable
|
|
55
|
+
* @param perms
|
|
56
|
+
* @returns The missing permissions
|
|
57
|
+
*/
|
|
58
|
+
missing(perms: PermissionsResolvable): ("Administrator" | "Connect" | "Speak" | "AddReactions" | "AttachFiles" | "BanMembers" | "ChangeNickname" | "CreateInstantInvite" | "CreatePrivateThreads" | "CreatePublicThreads" | "DeafenMembers" | "EmbedLinks" | "KickMembers" | "ManageChannels" | "ManageEmojisAndStickers" | "ManageGuildExpressions" | "ManageEvents" | "ManageGuild" | "ManageMessages" | "ManageNicknames" | "ManageRoles" | "ManageThreads" | "ManageWebhooks" | "MentionEveryone" | "ModerateMembers" | "MoveMembers" | "MuteMembers" | "PrioritySpeaker" | "ReadMessageHistory" | "RequestToSpeak" | "SendMessages" | "SendMessagesInThreads" | "SendTTSMessages" | "Stream" | "UseApplicationCommands" | "UseEmbeddedActivities" | "UseExternalEmojis" | "UseExternalStickers" | "UseVAD" | "ViewAuditLog" | "ViewChannel" | "ViewGuildInsights" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[];
|
|
59
|
+
/**
|
|
60
|
+
* Get opermissions overwrites for a user or role in a channel including guild level and channel overrides
|
|
61
|
+
* @param userOrRole
|
|
62
|
+
* @param channel
|
|
63
|
+
* @param client
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
static overwriteFor(userOrRole: APIRole | APIGuildMember, channel: APITextChannel | APIGuildForumChannel | APIGuildVoiceChannel | APIGuildStageVoiceChannel | APINewsChannel, guild: APIGuild): PermissionsUtil;
|
|
67
|
+
/**
|
|
68
|
+
* Get permissions for a guild member based on their roles
|
|
69
|
+
* @param member
|
|
70
|
+
* @param client
|
|
71
|
+
* @param guild
|
|
72
|
+
*/
|
|
73
|
+
static permissionsFor(memberOrRole: APIGuildMember | APIRole, guild: APIGuild): PermissionsUtil;
|
|
74
|
+
/**
|
|
75
|
+
* Returns util instance having all permissions
|
|
76
|
+
*/
|
|
77
|
+
static all(): PermissionsUtil;
|
|
78
|
+
/**
|
|
79
|
+
* Returns permissions flags of this bitfield
|
|
80
|
+
*/
|
|
81
|
+
toArray(): ("Administrator" | "Connect" | "Speak" | "AddReactions" | "AttachFiles" | "BanMembers" | "ChangeNickname" | "CreateInstantInvite" | "CreatePrivateThreads" | "CreatePublicThreads" | "DeafenMembers" | "EmbedLinks" | "KickMembers" | "ManageChannels" | "ManageEmojisAndStickers" | "ManageGuildExpressions" | "ManageEvents" | "ManageGuild" | "ManageMessages" | "ManageNicknames" | "ManageRoles" | "ManageThreads" | "ManageWebhooks" | "MentionEveryone" | "ModerateMembers" | "MoveMembers" | "MuteMembers" | "PrioritySpeaker" | "ReadMessageHistory" | "RequestToSpeak" | "SendMessages" | "SendMessagesInThreads" | "SendTTSMessages" | "Stream" | "UseApplicationCommands" | "UseEmbeddedActivities" | "UseExternalEmojis" | "UseExternalStickers" | "UseVAD" | "ViewAuditLog" | "ViewChannel" | "ViewGuildInsights" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[];
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=PermissionUtils.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./postToBin.js";
|
|
2
|
+
export * from "./parsePerms.js";
|
|
3
|
+
export * from "./recursiveReadDir.js";
|
|
4
|
+
export * from "./parseDateFormat.js";
|
|
5
|
+
export * from "./resolveColors.js";
|
|
6
|
+
export * from "./v2-builders.js";
|
|
7
|
+
export * from "./PermissionUtils.js";
|
|
8
|
+
export * from "./getNextTs.js";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a progress bar using emoji segments (start, middle, end)
|
|
11
|
+
* @param percentage - Progress percentage (0-100)
|
|
12
|
+
* @param totalSegments Total emoji segments to use for the progress bar (`default: 8`)
|
|
13
|
+
* @returns Formatted progress bar string
|
|
14
|
+
*/
|
|
15
|
+
export declare function createEmojiProgressBar(percentage: number, totalSegments?: number): string;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,6 +13,7 @@ declare const permissions: {
|
|
|
13
13
|
readonly KickMembers: "Kick Members";
|
|
14
14
|
readonly ManageChannels: "Manage Channels";
|
|
15
15
|
readonly ManageEmojisAndStickers: "Manage Emojis and Stickers";
|
|
16
|
+
readonly ManageGuildExpressions: "Manage Expressions";
|
|
16
17
|
readonly ManageEvents: "Manage Events";
|
|
17
18
|
readonly ManageGuild: "Manage Server";
|
|
18
19
|
readonly ManageMessages: "Manage Message";
|
|
@@ -47,3 +48,4 @@ export type Permission = keyof typeof permissions;
|
|
|
47
48
|
*/
|
|
48
49
|
export declare const parsePerms: (perms: Permission | Permission[]) => string;
|
|
49
50
|
export {};
|
|
51
|
+
//# sourceMappingURL=parsePerms.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type APIActionRowComponent, type APIButtonComponent, type APIContainerComponent, type APIComponentInContainer, type APIFileComponent, type APIMediaGalleryComponent, type APIMediaGalleryItem, type APIComponentInMessageActionRow, type APISectionComponent, type APISeparatorComponent, type APITextDisplayComponent, type APIThumbnailComponent, type APIUnfurledMediaItem, type APIButtonComponentWithCustomId } from "discord-api-types/v10";
|
|
2
|
+
export declare function container(component: APIComponentInContainer | APIComponentInContainer[], ...comps: APIComponentInContainer[]): APIContainerComponent;
|
|
3
|
+
export declare function textDisplay(content: string, ...contents: string[]): APITextDisplayComponent;
|
|
4
|
+
export declare function thumbnail(url: string, description?: string, spoiler?: boolean): APIThumbnailComponent;
|
|
5
|
+
export declare function mediaGalleryItem(url: string, extra?: Omit<APIMediaGalleryItem, "media"> & {
|
|
6
|
+
media?: Omit<APIUnfurledMediaItem, "url">;
|
|
7
|
+
}): APIMediaGalleryItem;
|
|
8
|
+
export declare function mediaGallery(item: APIMediaGalleryItem | APIMediaGalleryItem[], ...itms: APIMediaGalleryItem[]): APIMediaGalleryComponent;
|
|
9
|
+
export declare function separator(divider?: boolean, spacing?: number): APISeparatorComponent;
|
|
10
|
+
export declare function section(accessory: APIThumbnailComponent | APIButtonComponent, content: string, ...contents: string[]): APISectionComponent;
|
|
11
|
+
export declare function file(url: string, spoiler?: boolean): APIFileComponent;
|
|
12
|
+
export declare function row(component: APIComponentInMessageActionRow | APIComponentInMessageActionRow[], ...comps: APIComponentInMessageActionRow[]): APIActionRowComponent<APIComponentInMessageActionRow>;
|
|
13
|
+
export declare function button(b?: Partial<Omit<APIButtonComponentWithCustomId, "type">>): APIButtonComponent;
|
|
14
|
+
//# sourceMappingURL=v2-builders.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyhelperbot/utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Utilities for SkyHelper bot",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "
|
|
10
|
+
"url": "https://github.com/imnaiyar/skyhelper.git",
|
|
11
|
+
"directory": "packages/utils"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
13
14
|
"SkyHelperUtils",
|
|
@@ -24,23 +25,28 @@
|
|
|
24
25
|
"bugs": {
|
|
25
26
|
"url": "https://github.com/imnaiyar/skyhelper/issues"
|
|
26
27
|
},
|
|
27
|
-
"homepage": "https://github.com/imnaiyar/skyhelper/packages/utils
|
|
28
|
+
"homepage": "https://github.com/imnaiyar/skyhelper/tree/main/packages/utils",
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"undici": "^7.2.3"
|
|
30
|
+
"discord-api-types": "latest",
|
|
31
|
+
"undici": "^7.18.2",
|
|
32
|
+
"@skyhelperbot/constants": "^1.1.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/luxon": "^3.4.2",
|
|
36
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
36
37
|
"luxon": "^3.5.0",
|
|
37
|
-
"mongoose": "^8.3.2"
|
|
38
|
+
"mongoose": "^8.3.2",
|
|
39
|
+
"tsup": "^8.5.0",
|
|
40
|
+
"typescript": "^5.4.3",
|
|
41
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
42
|
+
"vitest": "^3.2.4"
|
|
38
43
|
},
|
|
39
44
|
"peerDependencies": {
|
|
40
45
|
"luxon": "^3.5.0"
|
|
41
46
|
},
|
|
42
47
|
"scripts": {
|
|
43
|
-
"build": "
|
|
44
|
-
"build:docs": "typedoc"
|
|
48
|
+
"build": "tsup && tsc --emitDeclarationOnly --declaration",
|
|
49
|
+
"build:docs": "typedoc",
|
|
50
|
+
"lint": "eslint --fix src"
|
|
45
51
|
}
|
|
46
52
|
}
|