diff --git a/404.html b/404.html index 60005a881..6072b25bf 100644 --- a/404.html +++ b/404.html @@ -6,13 +6,13 @@ Page Not Found | sern - Handlers. Redefined. - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/3a25b5a8.9eb67c89.js b/assets/js/3a25b5a8.4019033d.js similarity index 80% rename from assets/js/3a25b5a8.9eb67c89.js rename to assets/js/3a25b5a8.4019033d.js index 592f80fa4..32b9288ed 100644 --- a/assets/js/3a25b5a8.9eb67c89.js +++ b/assets/js/3a25b5a8.4019033d.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(t),u=a,g=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=m;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"December 13, 2022",tags:[{label:"release",permalink:"/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"December 13, 2022",tags:[{label:"release",permalink:"/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/67348500.16d397dd.js b/assets/js/67348500.0658172d.js similarity index 80% rename from assets/js/67348500.16d397dd.js rename to assets/js/67348500.0658172d.js index 853509d59..66a631f5e 100644 --- a/assets/js/67348500.16d397dd.js +++ b/assets/js/67348500.0658172d.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(t),u=a,g=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=m;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"December 13, 2022",tags:[{label:"release",permalink:"/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"December 13, 2022",tags:[{label:"release",permalink:"/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b2f554cd.2abb8eda.js b/assets/js/b2f554cd.909caffe.js similarity index 50% rename from assets/js/b2f554cd.2abb8eda.js rename to assets/js/b2f554cd.909caffe.js index 674c84eae..bef69e533 100644 --- a/assets/js/b2f554cd.2abb8eda.js +++ b/assets/js/b2f554cd.909caffe.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[1477],{10:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"January 12, 2023","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"December 13, 2022","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"September 30, 2022","tags":[{"label":"guides","permalink":"/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"September 28, 2022","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[1477],{10:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"January 12, 2023","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"December 13, 2022","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"September 30, 2022","tags":[{"label":"guides","permalink":"/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"September 28, 2022","tags":[{"label":"release","permalink":"/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.9647cb1a.js b/assets/js/runtime~main.9d77b9a7.js similarity index 97% rename from assets/js/runtime~main.9647cb1a.js rename to assets/js/runtime~main.9d77b9a7.js index e04a7df91..feb255a5f 100644 --- a/assets/js/runtime~main.9647cb1a.js +++ b/assets/js/runtime~main.9d77b9a7.js @@ -1 +1 @@ -(()=>{"use strict";var e,c,a,f,d,b={},t={};function r(e){var c=t[e];if(void 0!==c)return c.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(c,a,f,d)=>{if(!a){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[a,f,d]},r.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return r.d(c,{a:c}),c},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};c=c||[null,a({}),a([]),a(a)];for(var t=2&f&&e;"object"==typeof t&&!~c.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((c=>b[c]=()=>e[c]));return b.default=()=>e,r.d(d,b),d},r.d=(e,c)=>{for(var a in c)r.o(c,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((c,a)=>(r.f[a](e,c),c)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",205:"83d480e9",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",496:"6cfc4513",533:"b2b675dd",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1472:"cf183316",1477:"b2f554cd",1505:"7c2ff145",1713:"a7023ddc",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4685:"cfb1619e",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7438:"9c021584",7453:"4b098d2e",7597:"5e8c322a",7749:"462b6925",7750:"3a2d3092",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"1ddd934d",65:"cf23b6e5",205:"eb0254e1",277:"bbd90c09",301:"b793f53e",332:"bdcff2ab",371:"49f8242f",496:"0511b22e",533:"bdaffa1a",681:"e483d8ef",703:"2c047c6d",1003:"2458df00",1036:"7eec0d30",1198:"a21b6830",1472:"cabca74f",1477:"2abb8eda",1505:"ac336ebd",1713:"391f3ab3",2005:"5410b5f0",2072:"16d397dd",2129:"4565dd84",2197:"6ab10a29",2255:"45e2d407",2529:"824aaa15",2535:"002d76df",2640:"adb9b5b6",3012:"9eb67c89",3045:"b736b053",3085:"8c38cce5",3089:"41e3be1f",3173:"bb563f23",3247:"e15f0d38",3255:"8b9ede2a",3462:"bea9bea5",3608:"66639242",3650:"12e99255",3864:"c1442a0b",4e3:"62439e3b",4009:"646068c8",4013:"e1f6e46d",4137:"c68b21db",4195:"e4059570",4252:"4a641105",4332:"8c1af3b3",4429:"263480d0",4461:"7121fe91",4626:"45e2d19f",4685:"afbd870d",4781:"b5a8d196",4803:"5d152ee5",4865:"b7614d2a",4932:"1bf7fefb",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"8eb09160",5502:"6c9f02b6",5853:"fba9524a",6054:"4a71f8ef",6103:"7974c41a",6146:"16600ea2",6270:"a8cdd963",6276:"0a2ff4f7",6322:"e9dabbc6",6393:"a9cee41b",6552:"2b832280",6777:"6db49116",6778:"63786ec6",6851:"0ff26863",7127:"d2e6d827",7223:"5ec7ce89",7254:"b9341fd6",7306:"5e82c7f5",7363:"792ec01a",7374:"e34036ab",7414:"93c2e119",7438:"05d6c764",7453:"9d156457",7540:"0456e07a",7597:"4d60761b",7749:"a634ce0a",7750:"ba775b44",7833:"5ff8848f",7868:"aa0d8eeb",7918:"3625818f",7936:"f98f9b4b",8032:"30ae90a9",8046:"fe6ed0c2",8494:"27cdbeea",8610:"d7a7cd5d",8652:"493a3e7c",8902:"4c49098e",9012:"46c9313e",9107:"834aae73",9187:"55ddc337",9226:"589671c2",9248:"ccbbefb3",9476:"d7f44886",9514:"b1e810d5",9671:"ee46d918",9712:"66f4ed67",9881:"ed87ed42"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),f={},d="@sern/website:",r.l=(e,c,a,b)=>{if(f[e])f[e].push(c);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(a))),c)return c(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",53944420:"3255",67348500:"2072","5bc4ccbc":"53","2f13d849":"65","83d480e9":"205",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371","6cfc4513":"496",b2b675dd:"533",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198",cf183316:"1472",b2f554cd:"1477","7c2ff145":"1505",a7023ddc:"1713","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",cfb1619e:"4685",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","9c021584":"7438","4b098d2e":"7453","5e8c322a":"7597","462b6925":"7749","3a2d3092":"7750","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(c,a)=>{var f=r.o(e,c)?e[c]:void 0;if(0!==f)if(f)a.push(f[2]);else if(/^(1303|532)$/.test(c))e[c]=0;else{var d=new Promise(((a,d)=>f=e[c]=[a,d]));a.push(f[2]=d);var b=r.p+r.u(c),t=new Error;r.l(b,(a=>{if(r.o(e,c)&&(0!==(f=e[c])&&(e[c]=void 0),f)){var d=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+c+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+c,c)}},r.O.j=c=>0===e[c];var c=(c,a)=>{var f,d,b=a[0],t=a[1],o=a[2],n=0;if(b.some((c=>0!==e[c]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(c&&c(a);n{"use strict";var e,c,a,f,d,b={},t={};function r(e){var c=t[e];if(void 0!==c)return c.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(c,a,f,d)=>{if(!a){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[a,f,d]},r.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return r.d(c,{a:c}),c},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};c=c||[null,a({}),a([]),a(a)];for(var t=2&f&&e;"object"==typeof t&&!~c.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((c=>b[c]=()=>e[c]));return b.default=()=>e,r.d(d,b),d},r.d=(e,c)=>{for(var a in c)r.o(c,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((c,a)=>(r.f[a](e,c),c)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",205:"83d480e9",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",496:"6cfc4513",533:"b2b675dd",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1472:"cf183316",1477:"b2f554cd",1505:"7c2ff145",1713:"a7023ddc",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4685:"cfb1619e",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7438:"9c021584",7453:"4b098d2e",7597:"5e8c322a",7749:"462b6925",7750:"3a2d3092",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"1ddd934d",65:"cf23b6e5",205:"eb0254e1",277:"bbd90c09",301:"b793f53e",332:"bdcff2ab",371:"49f8242f",496:"0511b22e",533:"bdaffa1a",681:"e483d8ef",703:"2c047c6d",1003:"2458df00",1036:"7eec0d30",1198:"a21b6830",1472:"cabca74f",1477:"909caffe",1505:"ac336ebd",1713:"391f3ab3",2005:"5410b5f0",2072:"0658172d",2129:"4565dd84",2197:"6ab10a29",2255:"45e2d407",2529:"824aaa15",2535:"002d76df",2640:"adb9b5b6",3012:"4019033d",3045:"b736b053",3085:"8c38cce5",3089:"41e3be1f",3173:"bb563f23",3247:"e15f0d38",3255:"8b9ede2a",3462:"bea9bea5",3608:"66639242",3650:"12e99255",3864:"c1442a0b",4e3:"62439e3b",4009:"646068c8",4013:"e1f6e46d",4137:"c68b21db",4195:"e4059570",4252:"4a641105",4332:"8c1af3b3",4429:"263480d0",4461:"7121fe91",4626:"45e2d19f",4685:"afbd870d",4781:"b5a8d196",4803:"5d152ee5",4865:"b7614d2a",4932:"1bf7fefb",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"8eb09160",5502:"6c9f02b6",5853:"fba9524a",6054:"4a71f8ef",6103:"7974c41a",6146:"16600ea2",6270:"a8cdd963",6276:"0a2ff4f7",6322:"e9dabbc6",6393:"a9cee41b",6552:"2b832280",6777:"6db49116",6778:"63786ec6",6851:"0ff26863",7127:"d2e6d827",7223:"5ec7ce89",7254:"b9341fd6",7306:"5e82c7f5",7363:"792ec01a",7374:"e34036ab",7414:"93c2e119",7438:"05d6c764",7453:"9d156457",7540:"0456e07a",7597:"4d60761b",7749:"a634ce0a",7750:"ba775b44",7833:"5ff8848f",7868:"aa0d8eeb",7918:"3625818f",7936:"f98f9b4b",8032:"30ae90a9",8046:"fe6ed0c2",8494:"27cdbeea",8610:"d7a7cd5d",8652:"493a3e7c",8902:"4c49098e",9012:"46c9313e",9107:"834aae73",9187:"55ddc337",9226:"589671c2",9248:"ccbbefb3",9476:"d7f44886",9514:"b1e810d5",9671:"ee46d918",9712:"66f4ed67",9881:"ed87ed42"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),f={},d="@sern/website:",r.l=(e,c,a,b)=>{if(f[e])f[e].push(c);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(a))),c)return c(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",53944420:"3255",67348500:"2072","5bc4ccbc":"53","2f13d849":"65","83d480e9":"205",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371","6cfc4513":"496",b2b675dd:"533",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198",cf183316:"1472",b2f554cd:"1477","7c2ff145":"1505",a7023ddc:"1713","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",cfb1619e:"4685",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","9c021584":"7438","4b098d2e":"7453","5e8c322a":"7597","462b6925":"7749","3a2d3092":"7750","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(c,a)=>{var f=r.o(e,c)?e[c]:void 0;if(0!==f)if(f)a.push(f[2]);else if(/^(1303|532)$/.test(c))e[c]=0;else{var d=new Promise(((a,d)=>f=e[c]=[a,d]));a.push(f[2]=d);var b=r.p+r.u(c),t=new Error;r.l(b,(a=>{if(r.o(e,c)&&(0!==(f=e[c])&&(e[c]=void 0),f)){var d=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+c+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+c,c)}},r.O.j=c=>0===e[c];var c=(c,a)=>{var f,d,b=a[0],t=a[1],o=a[2],n=0;if(b.some((c=>0!==e[c]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(c&&c(a);n Blog | sern - Handlers. Redefined. - + @@ -28,7 +28,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 min read
Sr Izan

Hello everyone!

I'm Sr Izan, your fellow user and contributor.

Today I'm going to show you how to get started with sern and all its cool features.

Step 1: Install the CLI.

Install the CLI:

npm i -g @sern/cli

and then run

sern init
tip

You can also run sern init -y if you want to use the default options.

The CLI is written in Typescript and open-sourced on Github. (thanks evo!)

Step 2: Have some way to store secrets.

Normally you'd need a way to store secrets, and the best way to do that is by installing another package: dotenv

just npm i dotenv in the project folder and add require('dotenv').config() to your import section. Then, when you login, process.env.TOKEN (or however you have it named on your .env file) should do the trick.

caution

If you're using ESM, configure dotenv with import 'dotenv/config' instead of require('dotenv').config().

And... that's it?

Yes, that's it. Here's a little FAQ to get you started. You can also join the Discord for any problems.

Extra: Video tutorial!

FAQ

Q: How do I publish a slash command?
A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
@@ -38,7 +38,7 @@ Extend the new CommandExecutabledecorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/blog/1.2.0.html b/blog/1.2.0.html index 3592d9ae3..5f9a2f443 100644 --- a/blog/1.2.0.html +++ b/blog/1.2.0.html @@ -6,7 +6,7 @@ Release 1.2.0 | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ Extend the new CommandExecuta I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/blog/2.0.0.html b/blog/2.0.0.html index 822252086..9e7958301 100644 --- a/blog/2.0.0.html +++ b/blog/2.0.0.html @@ -6,7 +6,7 @@ Release 2.0.0 | sern - Handlers. Redefined. - + @@ -25,9 +25,9 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

- + \ No newline at end of file diff --git a/blog/2.5.0.html b/blog/2.5.0.html index 127686dfe..5cca3c2cf 100644 --- a/blog/2.5.0.html +++ b/blog/2.5.0.html @@ -6,7 +6,7 @@ Release 2.5.0 | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ Wow! We're increasing our semantic versioning by +0.3.9
What does this mean?

Breaking changes

Deprecations

Reason

  • The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.
  • I realize that this affects all plugins. I have updated all plugins to match these changes
  • The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings
- + \ No newline at end of file diff --git a/blog/archive.html b/blog/archive.html index 4fceff0d0..c7ede10e6 100644 --- a/blog/archive.html +++ b/blog/archive.html @@ -6,13 +6,13 @@ Archive | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/blog/atom.xml b/blog/atom.xml index 03433734c..ab4dbf70f 100644 --- a/blog/atom.xml +++ b/blog/atom.xml @@ -43,7 +43,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> jacoobes diff --git a/blog/getting-started.html b/blog/getting-started.html index 023d92bdc..04177294b 100644 --- a/blog/getting-started.html +++ b/blog/getting-started.html @@ -6,7 +6,7 @@ How to get started with sern! | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/blog/rss.xml b/blog/rss.xml index 0e66ca984..db1fb33a9 100644 --- a/blog/rss.xml +++ b/blog/rss.xml @@ -40,7 +40,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> release diff --git a/blog/tags.html b/blog/tags.html index 061cf936b..f77b72b2c 100644 --- a/blog/tags.html +++ b/blog/tags.html @@ -6,13 +6,13 @@ Tags | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/blog/tags/guides.html b/blog/tags/guides.html index 512c7adbf..311a0b281 100644 --- a/blog/tags/guides.html +++ b/blog/tags/guides.html @@ -6,7 +6,7 @@ One post tagged with "guides" | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/blog/tags/release.html b/blog/tags/release.html index e9c1b4f9f..65ae4b55e 100644 --- a/blog/tags/release.html +++ b/blog/tags/release.html @@ -6,7 +6,7 @@ 3 posts tagged with "release" | sern - Handlers. Redefined. - + @@ -28,14 +28,14 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 min read
jacoobes

Class-based modules

Today we're announcing the ability to create class based modules! To get started, install

npm install @sern/handler@latest

Quick List of changes!

Class based modules

Incorporate class based modules into your project instead of the traditional commandModule or eventModule Extend the new CommandExecutable or EventExecutable

commands/meaning-of-life.ts
import { CommandType, CommandExecutable, type Args, type Context } from '@sern/handler';
import { publish } from '../plugins/publish.js';
import { serendipityOnly } from '../plugins/serendipityOnly.js';

export default class extends CommandExecutable<CommandType.Both> {
type = CommandType.Both as const;
description = 'What is the meaning of life?'
override onEvent = [
serendipityOnly()
];
override plugins = [
publish(),
];
execute = async (ctx: Context, args: Args) => {
await ctx.reply('42')
};
}
caution

execute must not be a method of the class. It should be as above, a property on the class!

events/guildMemberAdd.ts
import { CommandType, EventExecutable, type EventType } from '@sern/handler';
import type { GuildMember } from 'discord.js'

export default class extends EventExecutable<EventType.Discord> {
type = EventType.Discord as const;
execute = (member: GuildMember) => {
console.log(member)
};
}

Now, you might ask why this feature was added.
Simply put, to give flexibility to the developers. I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/docs/api.html b/docs/api.html index 98c8dc299..fd5db6e5c 100644 --- a/docs/api.html +++ b/docs/api.html @@ -6,13 +6,13 @@ @sern/handler | sern - Handlers. Redefined. - +

@sern/handler

Handlers. Redefined.

A customizable, batteries-included, powerful discord.js framework to streamline bot development.

NPM versionNPM downloadsLicense MITdocs.rsLines of code

📜 Installation

npm install @sern/handler
yarn add @sern/handler
pnpm add @sern/handler

Why?

  • Most handlers don't support discord.js 14.7+
  • Customizable commands
  • Plug and play or customize to your liking
  • Embraces reactive programming for consistent and reliable backend
  • Customizable logger, error handling, and more
  • Active development and growing community

👀 Quick Look

  • Support for discord.js v14 and all interactions
  • Hybrid commands
  • Lightweight and customizable
  • ESM, CommonJS and TypeScript support
  • A powerful CLI and awesome community-made plugins

👶 Basic Usage

index.js (CommonJS)

// Import the discord.js Client and GatewayIntentBits
const { Client, GatewayIntentBits } = require('discord.js');

// Import Sern namespace
const { Sern } = require('@sern/handler');

// Our configuration file
const { defaultPrefix, token } = require('./config.json');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages
]
});
export const useContainer = Sern.makeDependencies({
build: root => root
.add({ '@sern/client': single(client) })
.add({ '@sern/logger': single(new DefaultLogging()) })
});

//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
containerConfig : {
get: useContainer
}
});

client.login(token);

ping.js (CommonJS)

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
name: 'ping',
description: 'A ping pong command',
type: CommandType.Slash,
execute(ctx) {
ctx.reply('pong!');
}
});

See our templates for TypeScript examples and more.

💻 CLI

It is highly encouraged to use the command line interface for your project. Don't forget to view it.

👋 Contribute

  • Read our contribution guidelines carefully
  • Pull up on issues and report bugs
  • All kinds of contributions are welcomed.

🚈 Roadmap

You can check our roadmap to see what's going to be added or patched in the future.

- + \ No newline at end of file diff --git a/docs/api/classes/CommandExecutable.html b/docs/api/classes/CommandExecutable.html index 9c1427394..7c966076d 100644 --- a/docs/api/classes/CommandExecutable.html +++ b/docs/api/classes/CommandExecutable.html @@ -6,13 +6,13 @@ Class: CommandExecutable<Type> | sern - Handlers. Redefined. - +

Class: CommandExecutable<Type>

Experimental

Will be refactored / changed in future

Type parameters

NameType
Typeextends CommandType

Constructors

constructor

new CommandExecutable<Type>()

Type parameters

NameType
Typeextends CommandType

Properties

execute

Abstract execute: CommandModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:121


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:120


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:119


type

Abstract type: Type

Defined in

src/handler/sern.ts:118

- + \ No newline at end of file diff --git a/docs/api/classes/Context.html b/docs/api/classes/Context.html index d75128659..2c2785eb2 100644 --- a/docs/api/classes/Context.html +++ b/docs/api/classes/Context.html @@ -6,7 +6,7 @@ Class: Context | sern - Handlers. Redefined. - + @@ -18,7 +18,7 @@ Message

Returns CommandType.Slash or the event fired in a Both command was ChatInputCommandInteraction

Returns

Message<boolean>

Defined in

src/handler/structures/context.ts:29


user

get user(): User

If context is holding a message, message.author else, interaction.user

Returns

User

Defined in

src/handler/structures/context.ts:52

Methods

isMessage

isMessage(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:82


isSlash

isSlash(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:86


reply

reply(content): Promise<Message<boolean>>

Parameters

NameType
contentReplyOptions

Returns

Promise<Message<boolean>>

Defined in

src/handler/structures/context.ts:97


wrap

Static wrap(wrappable): Context

Parameters

NameType
wrappableMessage<boolean> | ChatInputCommandInteraction<CacheType>

Returns

Context

Defined in

src/handler/structures/context.ts:90

- + \ No newline at end of file diff --git a/docs/api/classes/DefaultErrorHandling.html b/docs/api/classes/DefaultErrorHandling.html index 7680a32b5..0afc951a1 100644 --- a/docs/api/classes/DefaultErrorHandling.html +++ b/docs/api/classes/DefaultErrorHandling.html @@ -6,13 +6,13 @@ Class: DefaultErrorHandling | sern - Handlers. Redefined. - +

Class: DefaultErrorHandling

Implements

Constructors

constructor

new DefaultErrorHandling()

Properties

keepAlive

keepAlive: number = 5

Number of times the process should throw an error until crashing and exiting

Implementation of

ErrorHandling.keepAlive

Defined in

src/handler/contracts/errorHandling.ts:24

Methods

crash

crash(error): never

Utility function to crash

Parameters

NameType
errorError

Returns

never

Implementation of

ErrorHandling.crash

Defined in

src/handler/contracts/errorHandling.ts:25


updateAlive

updateAlive(e): void

A function that is called on every crash. Updates keepAlive

Parameters

NameType
eError

Returns

void

Implementation of

ErrorHandling.updateAlive

Defined in

src/handler/contracts/errorHandling.ts:28

- + \ No newline at end of file diff --git a/docs/api/classes/DefaultLogging.html b/docs/api/classes/DefaultLogging.html index e72d682a3..641109884 100644 --- a/docs/api/classes/DefaultLogging.html +++ b/docs/api/classes/DefaultLogging.html @@ -6,13 +6,13 @@ Class: DefaultLogging | sern - Handlers. Redefined. - +

Class: DefaultLogging

Implements

Constructors

constructor

new DefaultLogging()

Methods

date

Private date(): Date

Returns

Date

Defined in

src/handler/contracts/logging.ts:11


debug

debug(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.debug

Defined in

src/handler/contracts/logging.ts:12


error

error(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.error

Defined in

src/handler/contracts/logging.ts:16


info

info(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.info

Defined in

src/handler/contracts/logging.ts:20


warning

warning(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.warning

Defined in

src/handler/contracts/logging.ts:24

- + \ No newline at end of file diff --git a/docs/api/classes/DefaultModuleManager.html b/docs/api/classes/DefaultModuleManager.html index 973b7d9a4..ddccd8552 100644 --- a/docs/api/classes/DefaultModuleManager.html +++ b/docs/api/classes/DefaultModuleManager.html @@ -6,13 +6,13 @@ Class: DefaultModuleManager | sern - Handlers. Redefined. - +

Class: DefaultModuleManager

Implements

Constructors

constructor

new DefaultModuleManager(moduleStore)

Parameters

NameType
moduleStoreModuleStore

Defined in

src/handler/contracts/moduleManager.ts:13

Methods

get

get<T>(strat): undefined | Processed<CommandModuleDefs[T]>

Type parameters

NameType
Textends CommandType

Parameters

NameType
strat(ms: ModuleStore) => undefined | Processed<CommandModuleDefs[T]>

Returns

undefined | Processed<CommandModuleDefs[T]>

Implementation of

ModuleManager.get

Defined in

src/handler/contracts/moduleManager.ts:14


set

set(strat): void

Parameters

NameType
strat(ms: ModuleStore) => void

Returns

void

Implementation of

ModuleManager.set

Defined in

src/handler/contracts/moduleManager.ts:20

- + \ No newline at end of file diff --git a/docs/api/classes/EventExecutable.html b/docs/api/classes/EventExecutable.html index cd3bfddff..1b0d74ac7 100644 --- a/docs/api/classes/EventExecutable.html +++ b/docs/api/classes/EventExecutable.html @@ -6,13 +6,13 @@ Class: EventExecutable<Type> | sern - Handlers. Redefined. - +

Class: EventExecutable<Type>

Experimental

Will be refactored in future

Type parameters

NameType
Typeextends EventType

Constructors

constructor

new EventExecutable<Type>()

Type parameters

NameType
Typeextends EventType

Properties

execute

Abstract execute: EventModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:130


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:129


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:128


type

Abstract type: Type

Defined in

src/handler/sern.ts:127

- + \ No newline at end of file diff --git a/docs/api/classes/ModuleStore.html b/docs/api/classes/ModuleStore.html index 33685982d..6b3abf98e 100644 --- a/docs/api/classes/ModuleStore.html +++ b/docs/api/classes/ModuleStore.html @@ -6,14 +6,14 @@ Class: ModuleStore | sern - Handlers. Redefined. - +

Class: ModuleStore

Storing all command modules This dependency is usually injected into ModuleManager

Constructors

constructor

new ModuleStore()

Properties

ApplicationCommands

Readonly ApplicationCommands: Object

Type declaration

NameType
1Map<string, Processed<CommandModule>>
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:11


BothCommands

Readonly BothCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:10


InteractionHandlers

Readonly InteractionHandlers: Object

Type declaration

NameType
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>
5Map<string, Processed<CommandModule>>
6Map<string, Processed<CommandModule>>
7Map<string, Processed<CommandModule>>
8Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:18


ModalSubmit

Readonly ModalSubmit: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:16


TextCommands

Readonly TextCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:17

- + \ No newline at end of file diff --git a/docs/api/classes/SernEmitter.html b/docs/api/classes/SernEmitter.html index bbce0f576..3d9dc67d8 100644 --- a/docs/api/classes/SernEmitter.html +++ b/docs/api/classes/SernEmitter.html @@ -6,7 +6,7 @@ Class: SernEmitter | sern - Handlers. Redefined. - + @@ -50,7 +50,7 @@ given event.

This method is intentionally generic and works with the web p semantics and does not listen to the 'error' event.

const { once, EventEmitter } = require('events');

async function run() {
const ee = new EventEmitter();

process.nextTick(() => {
ee.emit('myevent', 42);
});

const [value] = await once(ee, 'myevent');
console.log(value);

const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});

try {
await once(ee, 'myevent');
} catch (err) {
console.log('error happened', err);
}
}

run();

The special handling of the 'error' event is only used when events.once()is used to wait for another event. If events.once() is used to wait for the 'error' event itself, then it is treated as any other kind of event without special handling:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();

once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.log('error', err.message));

ee.emit('error', new Error('boom'));

// Prints: ok boom

An AbortSignal can be used to cancel waiting for the event:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();
const ac = new AbortController();

async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}

foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!

Since

v11.13.0, v10.16.0

Parameters

NameType
emitter_NodeEventTarget
eventNamestring | symbol
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:194

Static once(emitter, eventName, options?): Promise<any[]>

Parameters

NameType
emitter_DOMEventTarget
eventNamestring
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:195

Static once<E, K>(eventEmitter, eventName): Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Type parameters

NameType
Eextends __module
Kextends keyof ClientEvents

Parameters

NameType
eventEmitterE
eventNameE extends Client<boolean> ? K : string

Returns

Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:218


payload

Static Private payload<T>(type, module?, reason?): T

Type parameters

NameType
Textends Payload

Parameters

NameType
typePayloadType
module?Module
reason?unknown

Returns

T

Defined in

src/handler/sernEmitter.ts:40


setMaxListeners

Static setMaxListeners(n?, ...eventTargets): void

const {
setMaxListeners,
EventEmitter
} = require('events');

const target = new EventTarget();
const emitter = new EventEmitter();

setMaxListeners(5, target, emitter);

Since

v15.4.0

Parameters

NameTypeDescription
n?numberA non-negative number. The maximum number of listeners per EventTarget event.
...eventTargets(EventEmitter | _DOMEventTarget)[]-

Returns

void

Inherited from

EventEmitter.setMaxListeners

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:317


success

Static success(module): { module: AnyModule ; type: Success } & { type: Success } & never & never

Creates a compliant SernEmitter module success payload

Parameters

NameType
moduleModule

Returns

{ module: AnyModule ; type: Success } & { type: Success } & never & never

Defined in

src/handler/sernEmitter.ts:66


warning

Static warning(reason): never & never & { reason: string ; type: Warning } & { type: Warning }

Creates a compliant SernEmitter module warning payload

Parameters

NameType
reasonunknown

Returns

never & never & { reason: string ; type: Warning } & { type: Warning }

Defined in

src/handler/sernEmitter.ts:76

- + \ No newline at end of file diff --git a/docs/api/enums/CommandType.html b/docs/api/enums/CommandType.html index 56954506c..e35d08fd4 100644 --- a/docs/api/enums/CommandType.html +++ b/docs/api/enums/CommandType.html @@ -6,13 +6,13 @@ Enumeration: CommandType | sern - Handlers. Redefined. - +

Enumeration: CommandType

A bitfield that discriminates command modules

Example

export default commandModule({
type : CommandType.Text,
name : 'a text command'
execute(message) {
console.log(message.content)
}
})

Enumeration Members

Both

Both = 3

The CommandType for hybrid commands, text and slash

Defined in

src/handler/structures/enums.ts:28


Button

Button = 16

The CommandType for ButtonInteraction commands

Defined in

src/handler/structures/enums.ts:40


ChannelSelect

ChannelSelect = 256

The CommandType for the other SelectMenuInteractions

Defined in

src/handler/structures/enums.ts:52


CtxMsg

CtxMsg = 8

The CommandType for MessageContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:36


CtxUser

CtxUser = 4

The CommandType for UserContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:32


MentionableSelect

MentionableSelect = 512

Defined in

src/handler/structures/enums.ts:53


Modal = 64

The CommandType for ModalSubmitInteraction commands

Defined in

src/handler/structures/enums.ts:48


RoleSelect

RoleSelect = 1024

Defined in

src/handler/structures/enums.ts:54


Slash

Slash = 2

The CommandType for slash commands

Defined in

src/handler/structures/enums.ts:24


StringSelect

StringSelect = 32

The CommandType for StringSelectMenuInteraction commands

Defined in

src/handler/structures/enums.ts:44


Text

Text = 1

The CommandType for text commands

Defined in

src/handler/structures/enums.ts:20


UserSelect

UserSelect = 2048

Defined in

src/handler/structures/enums.ts:55

- + \ No newline at end of file diff --git a/docs/api/enums/EventType.html b/docs/api/enums/EventType.html index 0cdaebbc9..6d9a7b169 100644 --- a/docs/api/enums/EventType.html +++ b/docs/api/enums/EventType.html @@ -6,14 +6,14 @@ Enumeration: EventType | sern - Handlers. Redefined. - +

Enumeration: EventType

A bitfield that discriminates event modules

Example

export default eventModule({
type : EventType.Discord,
name : 'guildMemberAdd'
execute(member : GuildMember) {
console.log(member)
}
})

Enumeration Members

Discord

Discord = 1

The EventType for handling discord events

Defined in

src/handler/structures/enums.ts:77


External

External = 3

The EventType for handling external events. Could be for example, process events, database events

Defined in

src/handler/structures/enums.ts:86


Sern

Sern = 2

The EventType for handling sern events

Defined in

src/handler/structures/enums.ts:81

- + \ No newline at end of file diff --git a/docs/api/enums/PayloadType.html b/docs/api/enums/PayloadType.html index 010c54af9..c59850060 100644 --- a/docs/api/enums/PayloadType.html +++ b/docs/api/enums/PayloadType.html @@ -6,13 +6,13 @@ Enumeration: PayloadType | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/enums/PluginType.html b/docs/api/enums/PluginType.html index 2135eedaf..a8445cc14 100644 --- a/docs/api/enums/PluginType.html +++ b/docs/api/enums/PluginType.html @@ -6,13 +6,13 @@ Enumeration: PluginType | sern - Handlers. Redefined. - +

Enumeration: PluginType

A bitfield that discriminates plugins

Example

export default function myPlugin() : EventPlugin<CommandType.Text> {
type : PluginType.Event,
execute([ctx, args], controller) {
return controller.next();
}
}

Enumeration Members

Command

Command = 1

Deprecated

Use PluginType.Init instead

Defined in

src/handler/structures/enums.ts:112


Control

Control = 2

The PluginType for EventPlugins

Defined in

src/handler/structures/enums.ts:121


Event

Event = 2

Deprecated

Use PluginType.Control instead

Defined in

src/handler/structures/enums.ts:117


Init

Init = 1

The PluginType for InitPlugins

Defined in

src/handler/structures/enums.ts:107

- + \ No newline at end of file diff --git a/docs/api/enums/SernError.html b/docs/api/enums/SernError.html index cd34dc7a0..538129095 100644 --- a/docs/api/enums/SernError.html +++ b/docs/api/enums/SernError.html @@ -6,14 +6,14 @@ Enumeration: SernError | sern - Handlers. Redefined. - +

Enumeration: SernError

Enumeration Members

InvalidModuleType

InvalidModuleType = "Detected an unknown module type"

Throws when registering an invalid module. This means it is undefined or an invalid command type was provided

Defined in

src/handler/structures/errors.ts:9


MismatchEvent

MismatchEvent = "You cannot use message when an interaction fired or vice versa"

A crash that occurs when accessing an invalid property of Context

Defined in

src/handler/structures/errors.ts:29


MismatchModule

MismatchModule = "A module type mismatched with event emitted!"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:17


MissingRequired

MissingRequired = "@sern/client is required but was not found"

Required Dependency not found

Defined in

src/handler/structures/errors.ts:37


NotSupportedInteraction

NotSupportedInteraction = "This interaction is not supported."

Unsupported interaction at this moment.

Defined in

src/handler/structures/errors.ts:21


NotSupportedYet

NotSupportedYet = "This feature is not supported yet"

Unsupported feature attempted to access at this time

Defined in

src/handler/structures/errors.ts:33


PluginFailure

PluginFailure = "A plugin failed to call controller.next()"

One plugin called controller.stop() (end command execution / loading)

Defined in

src/handler/structures/errors.ts:25


UndefinedModule

UndefinedModule = "A module could not be detected"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:13

- + \ No newline at end of file diff --git a/docs/api/interfaces/AutocompleteCommand.html b/docs/api/interfaces/AutocompleteCommand.html index eb2d33935..4e152587f 100644 --- a/docs/api/interfaces/AutocompleteCommand.html +++ b/docs/api/interfaces/AutocompleteCommand.html @@ -6,13 +6,13 @@ Interface: AutocompleteCommand | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/AutocompletePlugin.html b/docs/api/interfaces/AutocompletePlugin.html index d5fe5dd13..2f381f4c4 100644 --- a/docs/api/interfaces/AutocompletePlugin.html +++ b/docs/api/interfaces/AutocompletePlugin.html @@ -6,13 +6,13 @@ Interface: AutocompletePlugin | sern - Handlers. Redefined. - +

Interface: AutocompletePlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (autocmp: AutocompleteInteraction<CacheType>, controlller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (autocmp, controlller): Awaitable<Result<void, void>>

Parameters
NameType
autocmpAutocompleteInteraction<CacheType>
controlllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:73


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:72

- + \ No newline at end of file diff --git a/docs/api/interfaces/BothCommand.html b/docs/api/interfaces/BothCommand.html index 47683afc4..c4fd0f38b 100644 --- a/docs/api/interfaces/BothCommand.html +++ b/docs/api/interfaces/BothCommand.html @@ -6,13 +6,13 @@ Interface: BothCommand | sern - Handlers. Redefined. - +

Interface: BothCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:57


description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:58


execute

execute: (ctx: Context, args: Args) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
argsArgs
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:60


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:59


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Both

Overrides

Module.type

Defined in

src/types/module.ts:56

- + \ No newline at end of file diff --git a/docs/api/interfaces/ButtonCommand.html b/docs/api/interfaces/ButtonCommand.html index af49d4654..abf2b3224 100644 --- a/docs/api/interfaces/ButtonCommand.html +++ b/docs/api/interfaces/ButtonCommand.html @@ -6,13 +6,13 @@ Interface: ButtonCommand | sern - Handlers. Redefined. - +

Interface: ButtonCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ButtonInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxButtonInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:75


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Button

Overrides

Module.type

Defined in

src/types/module.ts:74

- + \ No newline at end of file diff --git a/docs/api/interfaces/ChannelSelectCommand.html b/docs/api/interfaces/ChannelSelectCommand.html index 413e81f54..98f1036e8 100644 --- a/docs/api/interfaces/ChannelSelectCommand.html +++ b/docs/api/interfaces/ChannelSelectCommand.html @@ -6,13 +6,13 @@ Interface: ChannelSelectCommand | sern - Handlers. Redefined. - +

Interface: ChannelSelectCommand

Hierarchy

  • Module

    ChannelSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ChannelSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxChannelSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:85


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: ChannelSelect

Overrides

Module.type

Defined in

src/types/module.ts:84

- + \ No newline at end of file diff --git a/docs/api/interfaces/CommandPlugin.html b/docs/api/interfaces/CommandPlugin.html index 2f8555609..69361ccda 100644 --- a/docs/api/interfaces/CommandPlugin.html +++ b/docs/api/interfaces/CommandPlugin.html @@ -6,13 +6,13 @@ Interface: CommandPlugin<T> | sern - Handlers. Redefined. - +

Interface: CommandPlugin<T>

Deprecated

Use the newer helper functions and import { controller } from '@sern/handler'

Type parameters

NameType
Textends CommandType = CommandType

Properties

description

Optional description: string

Defined in

src/types/plugin.ts:51


execute

execute: (m: InitArgs<Processed<CommandModule>>, controller?: Deprecated<"Please import controller instead">) => PluginResult

Type declaration

▸ (m, controller?): PluginResult

Parameters
NameType
mInitArgs<Processed<CommandModule>>
controller?Deprecated<"Please import controller instead">
Returns

PluginResult

Defined in

src/types/plugin.ts:53


name

Optional name: string

Defined in

src/types/plugin.ts:50


type

type: Init

Defined in

src/types/plugin.ts:52

- + \ No newline at end of file diff --git a/docs/api/interfaces/ContextMenuMsg.html b/docs/api/interfaces/ContextMenuMsg.html index 39b93b80c..8b3196350 100644 --- a/docs/api/interfaces/ContextMenuMsg.html +++ b/docs/api/interfaces/ContextMenuMsg.html @@ -6,13 +6,13 @@ Interface: ContextMenuMsg | sern - Handlers. Redefined. - +

Interface: ContextMenuMsg

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MessageContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMessageContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:70


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxMsg

Overrides

Module.type

Defined in

src/types/module.ts:69

- + \ No newline at end of file diff --git a/docs/api/interfaces/ContextMenuUser.html b/docs/api/interfaces/ContextMenuUser.html index e4f45a74b..f7f37cf48 100644 --- a/docs/api/interfaces/ContextMenuUser.html +++ b/docs/api/interfaces/ContextMenuUser.html @@ -6,13 +6,13 @@ Interface: ContextMenuUser | sern - Handlers. Redefined. - +

Interface: ContextMenuUser

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:65


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxUser

Overrides

Module.type

Defined in

src/types/module.ts:64

- + \ No newline at end of file diff --git a/docs/api/interfaces/ControlPlugin.html b/docs/api/interfaces/ControlPlugin.html index 57850ee23..bc0e92e94 100644 --- a/docs/api/interfaces/ControlPlugin.html +++ b/docs/api/interfaces/ControlPlugin.html @@ -6,13 +6,13 @@ Interface: ControlPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/Controller.html b/docs/api/interfaces/Controller.html index e1247bbdf..b4d1bb6cf 100644 --- a/docs/api/interfaces/Controller.html +++ b/docs/api/interfaces/Controller.html @@ -6,13 +6,13 @@ Interface: Controller | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/Dependencies.html b/docs/api/interfaces/Dependencies.html index 362efebec..09a9a1c41 100644 --- a/docs/api/interfaces/Dependencies.html +++ b/docs/api/interfaces/Dependencies.html @@ -6,13 +6,13 @@ Interface: Dependencies | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/interfaces/DependencyConfiguration.html b/docs/api/interfaces/DependencyConfiguration.html index b3d79db87..6cd158ea2 100644 --- a/docs/api/interfaces/DependencyConfiguration.html +++ b/docs/api/interfaces/DependencyConfiguration.html @@ -6,13 +6,13 @@ Interface: DependencyConfiguration<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/DiscordEmitterPlugin.html b/docs/api/interfaces/DiscordEmitterPlugin.html index 5c92b2876..7b725ade7 100644 --- a/docs/api/interfaces/DiscordEmitterPlugin.html +++ b/docs/api/interfaces/DiscordEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEmitterPlugin | sern - Handlers. Redefined. - +

Interface: DiscordEmitterPlugin

Hierarchy

  • Plugin

    DiscordEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: DiscordEventCommand<keyof ClientEvents> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modDiscordEventCommand<keyof ClientEvents> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:49


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:48

- + \ No newline at end of file diff --git a/docs/api/interfaces/DiscordEventCommand.html b/docs/api/interfaces/DiscordEventCommand.html index 135c3b24c..929e1032d 100644 --- a/docs/api/interfaces/DiscordEventCommand.html +++ b/docs/api/interfaces/DiscordEventCommand.html @@ -6,13 +6,13 @@ Interface: DiscordEventCommand<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventCommand<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:123


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Discord

Overrides

Module.type

Defined in

src/types/module.ts:124

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsClientEvents[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:125

- + \ No newline at end of file diff --git a/docs/api/interfaces/DiscordEventPlugin.html b/docs/api/interfaces/DiscordEventPlugin.html index eb9e41199..fdd771176 100644 --- a/docs/api/interfaces/DiscordEventPlugin.html +++ b/docs/api/interfaces/DiscordEventPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventPlugin<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: ClientEvents[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsClientEvents[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:105


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:103


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:104

- + \ No newline at end of file diff --git a/docs/api/interfaces/ErrorHandling.html b/docs/api/interfaces/ErrorHandling.html index 0de78670a..451f4d049 100644 --- a/docs/api/interfaces/ErrorHandling.html +++ b/docs/api/interfaces/ErrorHandling.html @@ -6,13 +6,13 @@ Interface: ErrorHandling | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/interfaces/EventPlugin.html b/docs/api/interfaces/EventPlugin.html index 2c502c4aa..4724fedd5 100644 --- a/docs/api/interfaces/EventPlugin.html +++ b/docs/api/interfaces/EventPlugin.html @@ -6,13 +6,13 @@ Interface: EventPlugin<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/interfaces/ExternalEmitterPlugin.html b/docs/api/interfaces/ExternalEmitterPlugin.html index ff34d05a3..80996ce20 100644 --- a/docs/api/interfaces/ExternalEmitterPlugin.html +++ b/docs/api/interfaces/ExternalEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEmitterPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEmitterPlugin

Hierarchy

  • Plugin

    ExternalEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: ExternalEventCommand & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modExternalEventCommand & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:57


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:56

- + \ No newline at end of file diff --git a/docs/api/interfaces/ExternalEventCommand.html b/docs/api/interfaces/ExternalEventCommand.html index 7a06b7054..ab164eb6f 100644 --- a/docs/api/interfaces/ExternalEventCommand.html +++ b/docs/api/interfaces/ExternalEventCommand.html @@ -6,13 +6,13 @@ Interface: ExternalEventCommand | sern - Handlers. Redefined. - +

Interface: ExternalEventCommand

Hierarchy

  • Module

    ExternalEventCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


emitter

emitter: string

Defined in

src/types/module.ts:130


name

Optional name: string

Overrides

Module.name

Defined in

src/types/module.ts:129


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: External

Overrides

Module.type

Defined in

src/types/module.ts:131

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsunknown[]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:132

- + \ No newline at end of file diff --git a/docs/api/interfaces/ExternalEventPlugin.html b/docs/api/interfaces/ExternalEventPlugin.html index ee9200f56..641be1954 100644 --- a/docs/api/interfaces/ExternalEventPlugin.html +++ b/docs/api/interfaces/ExternalEventPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEventPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEventPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: unknown[], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsunknown[]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:99


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:98

- + \ No newline at end of file diff --git a/docs/api/interfaces/InitArgs.html b/docs/api/interfaces/InitArgs.html index 544df21b1..c0fbab2fe 100644 --- a/docs/api/interfaces/InitArgs.html +++ b/docs/api/interfaces/InitArgs.html @@ -6,13 +6,13 @@ Interface: InitArgs<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/InitPlugin.html b/docs/api/interfaces/InitPlugin.html index 057c663ed..f41a8e618 100644 --- a/docs/api/interfaces/InitPlugin.html +++ b/docs/api/interfaces/InitPlugin.html @@ -6,13 +6,13 @@ Interface: InitPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/Logging.html b/docs/api/interfaces/Logging.html index 9c7044a23..77700dcb6 100644 --- a/docs/api/interfaces/Logging.html +++ b/docs/api/interfaces/Logging.html @@ -6,13 +6,13 @@ Interface: Logging<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/interfaces/MentionableSelectCommand.html b/docs/api/interfaces/MentionableSelectCommand.html index d754eef67..a98360067 100644 --- a/docs/api/interfaces/MentionableSelectCommand.html +++ b/docs/api/interfaces/MentionableSelectCommand.html @@ -6,13 +6,13 @@ Interface: MentionableSelectCommand | sern - Handlers. Redefined. - +

Interface: MentionableSelectCommand

Hierarchy

  • Module

    MentionableSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MentionableSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMentionableSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:95


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: MentionableSelect

Overrides

Module.type

Defined in

src/types/module.ts:94

- + \ No newline at end of file diff --git a/docs/api/interfaces/ModalSubmitCommand.html b/docs/api/interfaces/ModalSubmitCommand.html index 2eb8dfe40..92864fa42 100644 --- a/docs/api/interfaces/ModalSubmitCommand.html +++ b/docs/api/interfaces/ModalSubmitCommand.html @@ -6,13 +6,13 @@ Interface: ModalSubmitCommand | sern - Handlers. Redefined. - +

Interface: ModalSubmitCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ModalSubmitInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxModalSubmitInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:105


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Modal

Overrides

Module.type

Defined in

src/types/module.ts:104

- + \ No newline at end of file diff --git a/docs/api/interfaces/Module.html b/docs/api/interfaces/Module.html index 0e2b3a290..d7298f785 100644 --- a/docs/api/interfaces/Module.html +++ b/docs/api/interfaces/Module.html @@ -6,13 +6,13 @@ Interface: Module | sern - Handlers. Redefined. - +

Interface: Module

Hierarchy

Properties

description

Optional description: string

Defined in

src/types/module.ts:38


execute

execute: (...args: any[]) => any

Type declaration

▸ (...args): any

Parameters
NameType
...argsany[]
Returns

any

Defined in

src/types/module.ts:39


name

Optional name: string

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Defined in

src/types/module.ts:37


type

type: CommandType | EventType

Defined in

src/types/module.ts:34

- + \ No newline at end of file diff --git a/docs/api/interfaces/ModuleManager.html b/docs/api/interfaces/ModuleManager.html index 8dabb5f9f..86aa75b75 100644 --- a/docs/api/interfaces/ModuleManager.html +++ b/docs/api/interfaces/ModuleManager.html @@ -6,13 +6,13 @@ Interface: ModuleManager | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/Plugin.html b/docs/api/interfaces/Plugin.html index 5981ce7a1..3020eba83 100644 --- a/docs/api/interfaces/Plugin.html +++ b/docs/api/interfaces/Plugin.html @@ -6,13 +6,13 @@ Interface: Plugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/docs/api/interfaces/RoleSelectCommand.html b/docs/api/interfaces/RoleSelectCommand.html index d2ebce64d..9bbf16e0b 100644 --- a/docs/api/interfaces/RoleSelectCommand.html +++ b/docs/api/interfaces/RoleSelectCommand.html @@ -6,13 +6,13 @@ Interface: RoleSelectCommand | sern - Handlers. Redefined. - +

Interface: RoleSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: RoleSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxRoleSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:90


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: RoleSelect

Overrides

Module.type

Defined in

src/types/module.ts:89

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernAutocompleteData.html b/docs/api/interfaces/SernAutocompleteData.html index 27afa2b45..212716827 100644 --- a/docs/api/interfaces/SernAutocompleteData.html +++ b/docs/api/interfaces/SernAutocompleteData.html @@ -6,13 +6,13 @@ Interface: SernAutocompleteData | sern - Handlers. Redefined. - +

Interface: SernAutocompleteData

Hierarchy

  • Omit<BaseApplicationCommandOptionsData, "autocomplete">

    SernAutocompleteData

Properties

autocomplete

autocomplete: true

Defined in

src/types/module.ts:177


command

command: AutocompleteCommand

Defined in

src/types/module.ts:182


description

description: string

Inherited from

Omit.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

Omit.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


required

Optional required: boolean

Inherited from

Omit.required

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4202


type

type: String | Integer | Number

Defined in

src/types/module.ts:178

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernEmitterPlugin.html b/docs/api/interfaces/SernEmitterPlugin.html index f8c36ff47..65c687765 100644 --- a/docs/api/interfaces/SernEmitterPlugin.html +++ b/docs/api/interfaces/SernEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: SernEmitterPlugin | sern - Handlers. Redefined. - +

Interface: SernEmitterPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: SernEventCommand<keyof SernEventsMapping> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modSernEventCommand<keyof SernEventsMapping> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:65


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:64

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernEventCommand.html b/docs/api/interfaces/SernEventCommand.html index ad6422584..39c206435 100644 --- a/docs/api/interfaces/SernEventCommand.html +++ b/docs/api/interfaces/SernEventCommand.html @@ -6,13 +6,13 @@ Interface: SernEventCommand<T> | sern - Handlers. Redefined. - +

Interface: SernEventCommand<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:116


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Sern

Overrides

Module.type

Defined in

src/types/module.ts:117

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsSernEventsMapping[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:118

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernEventPlugin.html b/docs/api/interfaces/SernEventPlugin.html index c8cf935ab..a75f0b307 100644 --- a/docs/api/interfaces/SernEventPlugin.html +++ b/docs/api/interfaces/SernEventPlugin.html @@ -6,13 +6,13 @@ Interface: SernEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: SernEventPlugin<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: SernEventsMapping[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsSernEventsMapping[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:91


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:89


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:90

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernSubCommandData.html b/docs/api/interfaces/SernSubCommandData.html index 02291f6d6..b641946fd 100644 --- a/docs/api/interfaces/SernSubCommandData.html +++ b/docs/api/interfaces/SernSubCommandData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandData | sern - Handlers. Redefined. - +

Interface: SernSubCommandData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: BaseOptions[]

Defined in

src/types/module.ts:214


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:213


type

type: Subcommand

Defined in

src/types/module.ts:212

- + \ No newline at end of file diff --git a/docs/api/interfaces/SernSubCommandGroupData.html b/docs/api/interfaces/SernSubCommandGroupData.html index b8a15b137..ce7c8fdaa 100644 --- a/docs/api/interfaces/SernSubCommandGroupData.html +++ b/docs/api/interfaces/SernSubCommandGroupData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandGroupData | sern - Handlers. Redefined. - +

Interface: SernSubCommandGroupData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandGroupData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: SernSubCommandData[]

Defined in

src/types/module.ts:220


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:219


type

type: SubcommandGroup

Defined in

src/types/module.ts:218

- + \ No newline at end of file diff --git a/docs/api/interfaces/SlashCommand.html b/docs/api/interfaces/SlashCommand.html index eb8d3cf9b..f784ad3e3 100644 --- a/docs/api/interfaces/SlashCommand.html +++ b/docs/api/interfaces/SlashCommand.html @@ -6,13 +6,13 @@ Interface: SlashCommand | sern - Handlers. Redefined. - +

Interface: SlashCommand

Hierarchy

Properties

description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:50


execute

execute: (ctx: Context, args: ["slash", SlashOptions]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["slash", SlashOptions]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:52


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:51


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Slash

Overrides

Module.type

Defined in

src/types/module.ts:49

- + \ No newline at end of file diff --git a/docs/api/interfaces/StringSelectCommand.html b/docs/api/interfaces/StringSelectCommand.html index 72c90f269..83a30dd3c 100644 --- a/docs/api/interfaces/StringSelectCommand.html +++ b/docs/api/interfaces/StringSelectCommand.html @@ -6,13 +6,13 @@ Interface: StringSelectCommand | sern - Handlers. Redefined. - +

Interface: StringSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: StringSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxStringSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:80


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: StringSelect

Overrides

Module.type

Defined in

src/types/module.ts:79

- + \ No newline at end of file diff --git a/docs/api/interfaces/TextCommand.html b/docs/api/interfaces/TextCommand.html index ca2331c2c..020ea9a60 100644 --- a/docs/api/interfaces/TextCommand.html +++ b/docs/api/interfaces/TextCommand.html @@ -6,13 +6,13 @@ Interface: TextCommand | sern - Handlers. Redefined. - +

Interface: TextCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:44


description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: Context, args: ["text", string[]]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["text", string[]]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:45


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Text

Overrides

Module.type

Defined in

src/types/module.ts:43

- + \ No newline at end of file diff --git a/docs/api/interfaces/UserSelectCommand.html b/docs/api/interfaces/UserSelectCommand.html index cc2609212..fcdfe98af 100644 --- a/docs/api/interfaces/UserSelectCommand.html +++ b/docs/api/interfaces/UserSelectCommand.html @@ -6,13 +6,13 @@ Interface: UserSelectCommand | sern - Handlers. Redefined. - +

Interface: UserSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:100


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: UserSelect

Overrides

Module.type

Defined in

src/types/module.ts:99

- + \ No newline at end of file diff --git a/docs/api/interfaces/Wrapper.html b/docs/api/interfaces/Wrapper.html index 62acd99d7..6e5337d1f 100644 --- a/docs/api/interfaces/Wrapper.html +++ b/docs/api/interfaces/Wrapper.html @@ -6,13 +6,13 @@ Interface: Wrapper | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/api/modules.html b/docs/api/modules.html index cc43b1617..416a7f4d4 100644 --- a/docs/api/modules.html +++ b/docs/api/modules.html @@ -6,7 +6,7 @@ @sern/handler | sern - Handlers. Redefined. - + @@ -19,7 +19,7 @@ where typings can be very bad.

Type parameters

NameType
Textends () => () => unknown

Parameters

NameType
cbT

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:33


useContainerRaw

useContainerRaw<T>(): Container<T, {}>

Returns the underlying data structure holding all dependencies. Please be careful as this only gets the client's current state. Exposes some methods from iti

Type parameters

NameType
Textends Dependencies

Returns

Container<T, {}>

Defined in

src/handler/dependencies/provider.ts:54

- + \ No newline at end of file diff --git a/docs/api/namespaces/Sern.html b/docs/api/namespaces/Sern.html index 98d2e962f..88ef6bb9f 100644 --- a/docs/api/namespaces/Sern.html +++ b/docs/api/namespaces/Sern.html @@ -6,13 +6,13 @@ Namespace: Sern | sern - Handlers. Redefined. - +

Namespace: Sern

References

CommandExecutable

Re-exports CommandExecutable


EventExecutable

Re-exports EventExecutable


commandModule

Re-exports commandModule


controller

Re-exports controller


discordEvent

Re-exports discordEvent


eventModule

Re-exports eventModule

Functions

init

init(wrapper): void

Example

src/index.ts
Sern.init({
defaultPrefix: '!',
commands: 'dist/commands',
events: 'dist/events',
containerConfig : {
get: useContainer
}
})

Parameters

NameTypeDescription
wrapperWrapperOptions to pass into sern. Function to start the handler up

Returns

void

Defined in

src/handler/sern.ts:38


makeDependencies

makeDependencies<T>(conf): <V>(...keys: [...V[]]) => MapDeps<T, V>

Type parameters

NameType
Textends Dependencies

Parameters

NameTypeDescription
confDependencyConfiguration<T>a configuration for creating your project dependencies

Returns

fn

▸ <V>(...keys): MapDeps<T, V>

Type parameters
NameType
Vextends keyof T[]
Parameters
NameType
...keys[...V[]]
Returns

MapDeps<T, V>

Defined in

src/handler/sern.ts:107

- + \ No newline at end of file diff --git a/docs/guide.html b/docs/guide.html index 826bada57..976417e20 100644 --- a/docs/guide.html +++ b/docs/guide.html @@ -6,13 +6,13 @@ Introduction | sern - Handlers. Redefined. - +

Introduction

Welcome to our official guide. This guide will go through all the core features of the framework.

  • 💖 Thank you for choosing sern to be your framework!

  • Teaching the discord.js library and / or Javascript / Typescript is out of scope of this project, so the documentation assumes you already know these elements.

  • discord.js v14 is the only supported library at the moment

You will learn

Working with plugins

Events

Good to know

- + \ No newline at end of file diff --git a/docs/guide/getting-started/choose-ide.html b/docs/guide/getting-started/choose-ide.html index 7ff663ce8..d3a6dd9b3 100644 --- a/docs/guide/getting-started/choose-ide.html +++ b/docs/guide/getting-started/choose-ide.html @@ -6,14 +6,14 @@ Choosing an IDE | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/docs/guide/getting-started/preparing.html b/docs/guide/getting-started/preparing.html index 6293fa708..040ac1a89 100644 --- a/docs/guide/getting-started/preparing.html +++ b/docs/guide/getting-started/preparing.html @@ -6,13 +6,13 @@ Preparing to Code | sern - Handlers. Redefined. - +

Preparing to Code

After installing and IDE you need to install node.

Click to download the LTS version of node right here.

After you downloaded node, you can start using us

Running this will install our CLI, which allows you to create a template project without writing a single line of code.

npm install -g @sern/cli

If you want to do more with our CLI, continue reading our guides.

- + \ No newline at end of file diff --git a/docs/guide/walkthrough/cli.html b/docs/guide/walkthrough/cli.html index 896b4d574..ac8c5ed17 100644 --- a/docs/guide/walkthrough/cli.html +++ b/docs/guide/walkthrough/cli.html @@ -6,7 +6,7 @@ CLI | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

CLI

Setting up the CLI is easy.

  • To start a brand-new project, run :
sern init (-y)
tip

It creates a directory for you so you don't need to!

Include the -y flag if you want to set up defaults. The default langauge is Typescript

sern plugins
info

Make sure to have a correct sern.config.json

This will display a menu selection of all installable plugins.
Note: You must have a sern.config.json to use this command. If you want to view plugins, visit the repository linked above.

  • To install extra utilities into your project
sern extra
- + \ No newline at end of file diff --git a/docs/guide/walkthrough/conclusion.html b/docs/guide/walkthrough/conclusion.html index e2e648a49..0c228cdba 100644 --- a/docs/guide/walkthrough/conclusion.html +++ b/docs/guide/walkthrough/conclusion.html @@ -6,7 +6,7 @@ Conclusion | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Conclusion

If you reached this far, thank you for reading! We hope you have learned the necessities you need to create a bot with the sern framework. If you have any other questions, bugs, feature requests, concerns, please join our community server, and we'll be glad to answer your questions.

- + \ No newline at end of file diff --git a/docs/guide/walkthrough/first-command.html b/docs/guide/walkthrough/first-command.html index 1d762a254..8db5cd9ee 100644 --- a/docs/guide/walkthrough/first-command.html +++ b/docs/guide/walkthrough/first-command.html @@ -6,7 +6,7 @@ First Command | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ If you installed a new project via the cli, This is the ping command located in src/commands folder.

Typescript

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
})

To view what each of these properties mean in depth, visit the official documentation.

Types of command modules

Every command module type is part of an enum. This field allows type inference for the rest of a module's fields.
All the command types can be found in the official documentation!

So, lets say you want to make a command module that listens to modals.

Note: Keep in mind you'll need to send a modal with a custom id dm-me. This example below is the response to a modal being sent.


Typescript:

import { commandModule, CommandType } from '@sern/handler';
export default commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Javascript:

const { CommandType, commandModule } = require('@sern/handler');
exports.default = commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Commands are straight forward. Keep in mind, every other property on the commandModule object is optional except the type and execute function.

Context class

The provided Context class helps with modules of CommandType.Both (A mixture of slash / legacy commands).

The Context class is passed into modules with type:

  • CommandType.Both
  • CommandType.Slash
  • CommandType.Text

This data structure helps interop between legacy commands and slash commands with ease.

note

View the docs

Typescript:

export default commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx: Context) {
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});

Javascript:

exports.default = commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx) { //ctx is a Context instance
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});
- + \ No newline at end of file diff --git a/docs/guide/walkthrough/first-event.html b/docs/guide/walkthrough/first-event.html index 696787754..a0fd768d3 100644 --- a/docs/guide/walkthrough/first-event.html +++ b/docs/guide/walkthrough/first-event.html @@ -6,7 +6,7 @@ First Event Module | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

First Event Module

We will dissect a basic event module.
Typescript:

export default eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate', //name of event.
execute(event) {
console.log(event);
}
})

Javascript:

exports.default = eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate',
execute(event) {
console.log(event);
}
})

Like command modules, the type property denotes what kind of event it is, which can be found here.

To view what each of these properties mean in depth, visit the official documentation.


Event modules are laid out similarly to command modules. These listen to any and all event you provide. In the current version 1.1.0-beta, plugins are not supported.

Another example of an event module

Typescript:

export default eventModule({
type: EventType.Discord,
plugins : [],
name: 'guildMemberAdd', //name of event.
async execute(member: GuildMember) {
(await member.guild.channels.fetch('channel-id') as TextChannel).send(`Welcome, ${member}`);
}
})

Javascript:


exports.default = eventModule({
type: EventType.Discord,
plugins : [], //NOT SUPPORTED YET!!
name: 'guildMemberAdd', //name of event.
async execute(member) {
(await member.guild.channels.fetch('channel-id')).send(`Welcome, ${member}`);
}
})
- + \ No newline at end of file diff --git a/docs/guide/walkthrough/goal.html b/docs/guide/walkthrough/goal.html index 471a3e8ad..235dde6ee 100644 --- a/docs/guide/walkthrough/goal.html +++ b/docs/guide/walkthrough/goal.html @@ -6,7 +6,7 @@ Goal | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Goal

sern strives to be minimalist, but with all batteries included. Meaning, this framework provides the necessary tools to start up a bot in minutes, and leaves plenty room space to customize your experience and create an amazing project. It should include all the tools for any bot at any scale.

- + \ No newline at end of file diff --git a/docs/guide/walkthrough/good-to-know.html b/docs/guide/walkthrough/good-to-know.html index 6a1e46c22..bb504aee0 100644 --- a/docs/guide/walkthrough/good-to-know.html +++ b/docs/guide/walkthrough/good-to-know.html @@ -6,7 +6,7 @@ Good to know | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Good to know

sern.config.json

A sern.config.json, although not necessary, allows your project to communicate with our cli.

For example, when installing typescript plugins, the language property is necessary to install from our open source repository.

Using the cli and running sern init --sync on pre-existing projects should install this json file in the root directory given. Or, if this is a brand-new project, sern init automatically installs it.

{
"language": "typescript",
"paths": {
"base": "src",
"commands": "commands"
}
}
- + \ No newline at end of file diff --git a/docs/guide/walkthrough/plugins.html b/docs/guide/walkthrough/plugins.html index a6022b4fb..fcab9b82e 100644 --- a/docs/guide/walkthrough/plugins.html +++ b/docs/guide/walkthrough/plugins.html @@ -6,7 +6,7 @@ Plugins | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ This controls whether a module is stored into sern.
Typescript:

export function inDir(dir : string) : CommandPlugin<CommandType.Both> {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Javascript:

export function inDir(dir : string) {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Above, this simple plugin logs that the module has been loaded along with a timestamp.
Again, it is up to you to define plugin logic! The possibilities to customize your bots are endless.

tip

Command Plugins are good for ensuring the shape, location, and preprocessing of your commands.

Event Plugins

event-plugins

  • An event is emitted by discord.js.
  • This event is passed to all plugins (in order!!),
  • If all are successful,

The command is executed. Calling controller.stop() notifies sern that this command should not be run, and this event is ignored.

So, what does a command module look like with plugins?

Typescript:

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly()
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript:

const { commandModule, CommandType } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly() //The plugins in this section applied to this module!
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Can you predict the behavior of this command?

  • Before loading into sern, this command module will check if this module is in the correct directory other.
  • Before an event occurs, this command module will check if the user has the id 182326315813306368.
tip

Event Plugins are good for filtering, preconditions, parsing.

If all plugins return controller.next(), this command replies Pong 🏓

- + \ No newline at end of file diff --git a/docs/guide/walkthrough/sern-emitter.html b/docs/guide/walkthrough/sern-emitter.html index 8602e7b48..fc5a49ddf 100644 --- a/docs/guide/walkthrough/sern-emitter.html +++ b/docs/guide/walkthrough/sern-emitter.html @@ -6,13 +6,13 @@ The SernEmitter class | sern - Handlers. Redefined. - +

The SernEmitter class

You're shipped with the SernEmitter. This EventEmitter listens to

  • command modules executing and its status, the module.activate event
  • command modules registered and its status, the module.register event
  • On default, sern creates a single SernEmitter for your bot process.
  • any error that occurs, the error event
  • warn events, where it is possible to throw errors

You can put these and other event listeners into event modules!


View all events
- + \ No newline at end of file diff --git a/docs/intro.html b/docs/intro.html index 69db0d8ca..ac63daf4b 100644 --- a/docs/intro.html +++ b/docs/intro.html @@ -6,13 +6,13 @@ Welcome! | sern - Handlers. Redefined. - +

Welcome!

Content

  • /docs/api contains autogenerated documentation of our codebase using typedoc
  • /docs/guide contains a basic startup guide and details to get started with sern faster!
tip

This site is open source! Please do contribute if you find any bugs, typos, or sections in need of improvements.

tip

If you have problems, join the discord server here

- + \ No newline at end of file diff --git a/fr/404.html b/fr/404.html index 505451718..8098fb239 100644 --- a/fr/404.html +++ b/fr/404.html @@ -6,13 +6,13 @@ Page introuvable | sern - Handlers. Redefined. - +

Page introuvable

Nous n'avons pas trouvé ce que vous recherchez.

Veuillez contacter le propriétaire du site qui vous a lié à l'URL d'origine et leur faire savoir que leur lien est cassé.

- + \ No newline at end of file diff --git a/fr/assets/js/3a25b5a8.c940503c.js b/fr/assets/js/3a25b5a8.4e081471.js similarity index 80% rename from fr/assets/js/3a25b5a8.c940503c.js rename to fr/assets/js/3a25b5a8.4e081471.js index b09546607..8a7d5964d 100644 --- a/fr/assets/js/3a25b5a8.c940503c.js +++ b/fr/assets/js/3a25b5a8.4e081471.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(t),u=a,g=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=m;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/fr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 d\xe9cembre 2022",tags:[{label:"release",permalink:"/fr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/fr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/fr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/fr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 d\xe9cembre 2022",tags:[{label:"release",permalink:"/fr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/fr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/fr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/fr/assets/js/67348500.87bb0878.js b/fr/assets/js/67348500.54808ddc.js similarity index 80% rename from fr/assets/js/67348500.87bb0878.js rename to fr/assets/js/67348500.54808ddc.js index 6f64cd0fd..afc1cb541 100644 --- a/fr/assets/js/67348500.87bb0878.js +++ b/fr/assets/js/67348500.54808ddc.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>u});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(t),u=a,g=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=m;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/fr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 d\xe9cembre 2022",tags:[{label:"release",permalink:"/fr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/fr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/fr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/fr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 d\xe9cembre 2022",tags:[{label:"release",permalink:"/fr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/fr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/fr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/fr/assets/js/cf23ded0.85fc53a6.js b/fr/assets/js/cf23ded0.2847bc7f.js similarity index 50% rename from fr/assets/js/cf23ded0.85fc53a6.js rename to fr/assets/js/cf23ded0.2847bc7f.js index 48939f7a1..a2fe25590 100644 --- a/fr/assets/js/cf23ded0.85fc53a6.js +++ b/fr/assets/js/cf23ded0.2847bc7f.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[1375],{441:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/fr/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"12 janvier 2023","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/fr/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/fr/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"13 d\xe9cembre 2022","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/fr/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/fr/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/fr/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"30 septembre 2022","tags":[{"label":"guides","permalink":"/fr/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/fr/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/fr/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/fr/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"28 septembre 2022","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/fr/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[1375],{441:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/fr/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"12 janvier 2023","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/fr/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/fr/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"13 d\xe9cembre 2022","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/fr/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/fr/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/fr/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"30 septembre 2022","tags":[{"label":"guides","permalink":"/fr/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/fr/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/fr/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/fr/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"28 septembre 2022","tags":[{"label":"release","permalink":"/fr/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/fr/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file diff --git a/fr/assets/js/runtime~main.9889f742.js b/fr/assets/js/runtime~main.53a29af0.js similarity index 97% rename from fr/assets/js/runtime~main.9889f742.js rename to fr/assets/js/runtime~main.53a29af0.js index 63ed52ed5..b1d2c04b2 100644 --- a/fr/assets/js/runtime~main.9889f742.js +++ b/fr/assets/js/runtime~main.53a29af0.js @@ -1 +1 @@ -(()=>{"use strict";var e,c,a,f,d,b={},t={};function r(e){var c=t[e];if(void 0!==c)return c.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(c,a,f,d)=>{if(!a){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[a,f,d]},r.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return r.d(c,{a:c}),c},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};c=c||[null,a({}),a([]),a(a)];for(var t=2&f&&e;"object"==typeof t&&!~c.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((c=>b[c]=()=>e[c]));return b.default=()=>e,r.d(d,b),d},r.d=(e,c)=>{for(var a in c)r.o(c,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((c,a)=>(r.f[a](e,c),c)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1213:"7f673e27",1375:"cf23ded0",1472:"cf183316",1505:"7c2ff145",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4039:"174e7412",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6280:"85f3506b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",6918:"92293c9c",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7453:"4b098d2e",7597:"5e8c322a",7749:"462b6925",7750:"3a2d3092",7800:"d58f2f6c",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8069:"2eae8f3a",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"b86e0db9",65:"17ef5892",277:"bbd90c09",301:"3a7e2072",332:"e39aa5be",371:"1d24f64f",681:"4558f268",703:"be6fb0ae",1003:"efa19797",1036:"5240f2d2",1198:"ee2bfa3a",1213:"4c8b8cc4",1375:"85fc53a6",1472:"a0777f80",1505:"ac336ebd",2005:"f2bf20fc",2072:"87bb0878",2129:"e0eca003",2197:"573f4904",2255:"4aa76dec",2529:"824aaa15",2535:"67afd6ac",2640:"9625b0b7",3012:"c940503c",3045:"c84be8e6",3085:"8c38cce5",3089:"41e3be1f",3173:"fb27d836",3247:"8abfaf58",3255:"27db4706",3462:"29aca210",3608:"66639242",3650:"502897e0",3864:"3e0f7dbe",4e3:"b7cdf6a3",4009:"e7c059b4",4013:"e1f6e46d",4039:"278c7070",4137:"00f6c2a2",4195:"e4059570",4252:"cbc8323a",4332:"e8a2b732",4429:"d246f899",4461:"b4b09a9e",4626:"e404f1b9",4781:"76660bfe",4803:"0cd9e16a",4865:"466ea9bf",4932:"056dfe52",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"fc5347ee",5502:"24b6eb50",5853:"6f6365f6",6054:"d53df99d",6103:"7974c41a",6146:"16383731",6270:"a44bdaa5",6276:"9d0d3668",6280:"8dbd18b7",6322:"0d3ac253",6393:"27b2c405",6552:"44bd6e72",6777:"2c532199",6778:"c7f422f9",6851:"515811b0",6918:"f34397f9",7127:"e104054d",7223:"529bb797",7254:"7897abd7",7306:"7f7f6372",7363:"b59e8529",7374:"18dbd34f",7414:"ca4670d5",7453:"08f2b0db",7540:"0456e07a",7597:"0e2257b5",7749:"893c9e8a",7750:"3b268b53",7800:"e097f77c",7833:"dec9cbbd",7868:"37d89f2e",7918:"3625818f",7936:"90c37f11",8032:"615124fd",8046:"9920ffc9",8069:"71012eb7",8494:"ef3278d5",8610:"d7a7cd5d",8652:"d5b56b64",8902:"23ad8e66",9012:"85863279",9107:"b5ca7cc4",9187:"8e1050ca",9226:"5f897078",9248:"51fa3223",9476:"91e0f5f9",9514:"b1e810d5",9671:"a6b2b144",9712:"4a919036",9881:"78b34abf"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),f={},d="@sern/website:",r.l=(e,c,a,b)=>{if(f[e])f[e].push(c);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(a))),c)return c(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/fr/",r.gca=function(e){return e={17896441:"7918",53944420:"3255",67348500:"2072","5bc4ccbc":"53","2f13d849":"65",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198","7f673e27":"1213",cf23ded0:"1375",cf183316:"1472","7c2ff145":"1505","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","174e7412":"4039","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276","85f3506b":"6280",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","92293c9c":"6918","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","4b098d2e":"7453","5e8c322a":"7597","462b6925":"7749","3a2d3092":"7750",d58f2f6c:"7800","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","2eae8f3a":"8069","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(c,a)=>{var f=r.o(e,c)?e[c]:void 0;if(0!==f)if(f)a.push(f[2]);else if(/^(1303|532)$/.test(c))e[c]=0;else{var d=new Promise(((a,d)=>f=e[c]=[a,d]));a.push(f[2]=d);var b=r.p+r.u(c),t=new Error;r.l(b,(a=>{if(r.o(e,c)&&(0!==(f=e[c])&&(e[c]=void 0),f)){var d=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+c+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+c,c)}},r.O.j=c=>0===e[c];var c=(c,a)=>{var f,d,b=a[0],t=a[1],o=a[2],n=0;if(b.some((c=>0!==e[c]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(c&&c(a);n{"use strict";var e,c,a,f,d,b={},t={};function r(e){var c=t[e];if(void 0!==c)return c.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(c,a,f,d)=>{if(!a){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[a,f,d]},r.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return r.d(c,{a:c}),c},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};c=c||[null,a({}),a([]),a(a)];for(var t=2&f&&e;"object"==typeof t&&!~c.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((c=>b[c]=()=>e[c]));return b.default=()=>e,r.d(d,b),d},r.d=(e,c)=>{for(var a in c)r.o(c,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((c,a)=>(r.f[a](e,c),c)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1213:"7f673e27",1375:"cf23ded0",1472:"cf183316",1505:"7c2ff145",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4039:"174e7412",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6280:"85f3506b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",6918:"92293c9c",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7453:"4b098d2e",7597:"5e8c322a",7749:"462b6925",7750:"3a2d3092",7800:"d58f2f6c",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8069:"2eae8f3a",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"b86e0db9",65:"17ef5892",277:"bbd90c09",301:"3a7e2072",332:"e39aa5be",371:"1d24f64f",681:"4558f268",703:"be6fb0ae",1003:"efa19797",1036:"5240f2d2",1198:"ee2bfa3a",1213:"4c8b8cc4",1375:"2847bc7f",1472:"a0777f80",1505:"ac336ebd",2005:"f2bf20fc",2072:"54808ddc",2129:"e0eca003",2197:"573f4904",2255:"4aa76dec",2529:"824aaa15",2535:"67afd6ac",2640:"9625b0b7",3012:"4e081471",3045:"c84be8e6",3085:"8c38cce5",3089:"41e3be1f",3173:"fb27d836",3247:"8abfaf58",3255:"27db4706",3462:"29aca210",3608:"66639242",3650:"502897e0",3864:"3e0f7dbe",4e3:"b7cdf6a3",4009:"e7c059b4",4013:"e1f6e46d",4039:"278c7070",4137:"00f6c2a2",4195:"e4059570",4252:"cbc8323a",4332:"e8a2b732",4429:"d246f899",4461:"b4b09a9e",4626:"e404f1b9",4781:"76660bfe",4803:"0cd9e16a",4865:"466ea9bf",4932:"056dfe52",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"fc5347ee",5502:"24b6eb50",5853:"6f6365f6",6054:"d53df99d",6103:"7974c41a",6146:"16383731",6270:"a44bdaa5",6276:"9d0d3668",6280:"8dbd18b7",6322:"0d3ac253",6393:"27b2c405",6552:"44bd6e72",6777:"2c532199",6778:"c7f422f9",6851:"515811b0",6918:"f34397f9",7127:"e104054d",7223:"529bb797",7254:"7897abd7",7306:"7f7f6372",7363:"b59e8529",7374:"18dbd34f",7414:"ca4670d5",7453:"08f2b0db",7540:"0456e07a",7597:"0e2257b5",7749:"893c9e8a",7750:"3b268b53",7800:"e097f77c",7833:"dec9cbbd",7868:"37d89f2e",7918:"3625818f",7936:"90c37f11",8032:"615124fd",8046:"9920ffc9",8069:"71012eb7",8494:"ef3278d5",8610:"d7a7cd5d",8652:"d5b56b64",8902:"23ad8e66",9012:"85863279",9107:"b5ca7cc4",9187:"8e1050ca",9226:"5f897078",9248:"51fa3223",9476:"91e0f5f9",9514:"b1e810d5",9671:"a6b2b144",9712:"4a919036",9881:"78b34abf"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),f={},d="@sern/website:",r.l=(e,c,a,b)=>{if(f[e])f[e].push(c);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(a))),c)return c(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/fr/",r.gca=function(e){return e={17896441:"7918",53944420:"3255",67348500:"2072","5bc4ccbc":"53","2f13d849":"65",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198","7f673e27":"1213",cf23ded0:"1375",cf183316:"1472","7c2ff145":"1505","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","174e7412":"4039","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276","85f3506b":"6280",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","92293c9c":"6918","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","4b098d2e":"7453","5e8c322a":"7597","462b6925":"7749","3a2d3092":"7750",d58f2f6c:"7800","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","2eae8f3a":"8069","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(c,a)=>{var f=r.o(e,c)?e[c]:void 0;if(0!==f)if(f)a.push(f[2]);else if(/^(1303|532)$/.test(c))e[c]=0;else{var d=new Promise(((a,d)=>f=e[c]=[a,d]));a.push(f[2]=d);var b=r.p+r.u(c),t=new Error;r.l(b,(a=>{if(r.o(e,c)&&(0!==(f=e[c])&&(e[c]=void 0),f)){var d=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+c+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+c,c)}},r.O.j=c=>0===e[c];var c=(c,a)=>{var f,d,b=a[0],t=a[1],o=a[2],n=0;if(b.some((c=>0!==e[c]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(c&&c(a);n Blog | sern - Handlers. Redefined. - + @@ -28,7 +28,7 @@ we'll autofill with a
remarque

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 minutes de lecture
Sr Izan

Hello everyone!

I'm Sr Izan, your fellow user and contributor.

Today I'm going to show you how to get started with sern and all its cool features.

Step 1: Install the CLI.

Install the CLI:

npm i -g @sern/cli

and then run

sern init
astuce

You can also run sern init -y if you want to use the default options.

The CLI is written in Typescript and open-sourced on Github. (thanks evo!)

Step 2: Have some way to store secrets.

Normally you'd need a way to store secrets, and the best way to do that is by installing another package: dotenv

just npm i dotenv in the project folder and add require('dotenv').config() to your import section. Then, when you login, process.env.TOKEN (or however you have it named on your .env file) should do the trick.

attention

If you're using ESM, configure dotenv with import 'dotenv/config' instead of require('dotenv').config().

And... that's it?

Yes, that's it. Here's a little FAQ to get you started. You can also join the Discord for any problems.

Extra: Video tutorial!

FAQ

Q: How do I publish a slash command?
A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
@@ -38,7 +38,7 @@ Extend the new CommandExecutabl I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/fr/blog/1.2.0.html b/fr/blog/1.2.0.html index da2966d76..3c76978c2 100644 --- a/fr/blog/1.2.0.html +++ b/fr/blog/1.2.0.html @@ -6,7 +6,7 @@ Release 1.2.0 | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ Extend the new CommandExec I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/fr/blog/2.0.0.html b/fr/blog/2.0.0.html index c0d080ab5..2ebe4e680 100644 --- a/fr/blog/2.0.0.html +++ b/fr/blog/2.0.0.html @@ -6,7 +6,7 @@ Release 2.0.0 | sern - Handlers. Redefined. - + @@ -25,9 +25,9 @@ we'll autofill with a
remarque

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

- + \ No newline at end of file diff --git a/fr/blog/2.5.0.html b/fr/blog/2.5.0.html index 509d8bedb..d0cd85c73 100644 --- a/fr/blog/2.5.0.html +++ b/fr/blog/2.5.0.html @@ -6,7 +6,7 @@ Release 2.5.0 | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ Wow! We're increasing our semantic versioning by +0.3.9
What does this mean?

Breaking changes

Deprecations

Reason

  • The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.
  • I realize that this affects all plugins. I have updated all plugins to match these changes
  • The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings
- + \ No newline at end of file diff --git a/fr/blog/archive.html b/fr/blog/archive.html index 6882a2395..a659ae4bf 100644 --- a/fr/blog/archive.html +++ b/fr/blog/archive.html @@ -6,13 +6,13 @@ Archive | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/blog/atom.xml b/fr/blog/atom.xml index 021db3429..6854d4808 100644 --- a/fr/blog/atom.xml +++ b/fr/blog/atom.xml @@ -43,7 +43,7 @@ we'll autofill with a
remarque

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> jacoobes diff --git a/fr/blog/getting-started.html b/fr/blog/getting-started.html index 9bf5f1808..c89ddc0be 100644 --- a/fr/blog/getting-started.html +++ b/fr/blog/getting-started.html @@ -6,7 +6,7 @@ How to get started with sern! | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/fr/blog/rss.xml b/fr/blog/rss.xml index 97415aeda..d503bde2f 100644 --- a/fr/blog/rss.xml +++ b/fr/blog/rss.xml @@ -40,7 +40,7 @@ we'll autofill with a
remarque

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> release diff --git a/fr/blog/tags.html b/fr/blog/tags.html index e2cfd8b19..f75f43436 100644 --- a/fr/blog/tags.html +++ b/fr/blog/tags.html @@ -6,13 +6,13 @@ Tags | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/blog/tags/guides.html b/fr/blog/tags/guides.html index afb95317a..68ec692b1 100644 --- a/fr/blog/tags/guides.html +++ b/fr/blog/tags/guides.html @@ -6,7 +6,7 @@ Un article tagués avec « guides » | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/fr/blog/tags/release.html b/fr/blog/tags/release.html index ab81a7c21..286955006 100644 --- a/fr/blog/tags/release.html +++ b/fr/blog/tags/release.html @@ -6,7 +6,7 @@ 3 articles tagués avec « release » | sern - Handlers. Redefined. - + @@ -28,14 +28,14 @@ we'll autofill with a
remarque

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 minutes de lecture
jacoobes

Class-based modules

Today we're announcing the ability to create class based modules! To get started, install

npm install @sern/handler@latest

Quick List of changes!

Class based modules

Incorporate class based modules into your project instead of the traditional commandModule or eventModule Extend the new CommandExecutable or EventExecutable

commands/meaning-of-life.ts
import { CommandType, CommandExecutable, type Args, type Context } from '@sern/handler';
import { publish } from '../plugins/publish.js';
import { serendipityOnly } from '../plugins/serendipityOnly.js';

export default class extends CommandExecutable<CommandType.Both> {
type = CommandType.Both as const;
description = 'What is the meaning of life?'
override onEvent = [
serendipityOnly()
];
override plugins = [
publish(),
];
execute = async (ctx: Context, args: Args) => {
await ctx.reply('42')
};
}
attention

execute must not be a method of the class. It should be as above, a property on the class!

events/guildMemberAdd.ts
import { CommandType, EventExecutable, type EventType } from '@sern/handler';
import type { GuildMember } from 'discord.js'

export default class extends EventExecutable<EventType.Discord> {
type = EventType.Discord as const;
execute = (member: GuildMember) => {
console.log(member)
};
}

Now, you might ask why this feature was added.
Simply put, to give flexibility to the developers. I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/fr/docs/api.html b/fr/docs/api.html index 0fd13c77f..a1c3e7b85 100644 --- a/fr/docs/api.html +++ b/fr/docs/api.html @@ -6,13 +6,13 @@ @sern/handler | sern - Handlers. Redefined. - +

@sern/handler

Handlers. Redefined.

A customizable, batteries-included, powerful discord.js framework to streamline bot development.

NPM versionNPM downloadsLicense MITdocs.rsLines of code

📜 Installation

npm install @sern/handler
yarn add @sern/handler
pnpm add @sern/handler

Why?

  • Most handlers don't support discord.js 14.7+
  • Customizable commands
  • Plug and play or customize to your liking
  • Embraces reactive programming for consistent and reliable backend
  • Customizable logger, error handling, and more
  • Active development and growing community

👀 Quick Look

  • Support for discord.js v14 and all interactions
  • Hybrid commands
  • Lightweight and customizable
  • ESM, CommonJS and TypeScript support
  • A powerful CLI and awesome community-made plugins

👶 Basic Usage

index.js (CommonJS)

// Import the discord.js Client and GatewayIntentBits
const { Client, GatewayIntentBits } = require('discord.js');

// Import Sern namespace
const { Sern } = require('@sern/handler');

// Our configuration file
const { defaultPrefix, token } = require('./config.json');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages
]
});
export const useContainer = Sern.makeDependencies({
build: root => root
.add({ '@sern/client': single(client) })
.add({ '@sern/logger': single(new DefaultLogging()) })
});

//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
containerConfig : {
get: useContainer
}
});

client.login(token);

ping.js (CommonJS)

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
name: 'ping',
description: 'A ping pong command',
type: CommandType.Slash,
execute(ctx) {
ctx.reply('pong!');
}
});

See our templates for TypeScript examples and more.

💻 CLI

It is highly encouraged to use the command line interface for your project. Don't forget to view it.

👋 Contribute

  • Read our contribution guidelines carefully
  • Pull up on issues and report bugs
  • All kinds of contributions are welcomed.

🚈 Roadmap

You can check our roadmap to see what's going to be added or patched in the future.

- + \ No newline at end of file diff --git a/fr/docs/api/classes/CommandExecutable.html b/fr/docs/api/classes/CommandExecutable.html index 1ce021173..80b563e7b 100644 --- a/fr/docs/api/classes/CommandExecutable.html +++ b/fr/docs/api/classes/CommandExecutable.html @@ -6,13 +6,13 @@ Class: CommandExecutable<Type> | sern - Handlers. Redefined. - +

Class: CommandExecutable<Type>

Experimental

Will be refactored / changed in future

Type parameters

NameType
Typeextends CommandType

Constructors

constructor

new CommandExecutable<Type>()

Type parameters

NameType
Typeextends CommandType

Properties

execute

Abstract execute: CommandModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:121


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:120


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:119


type

Abstract type: Type

Defined in

src/handler/sern.ts:118

- + \ No newline at end of file diff --git a/fr/docs/api/classes/Context.html b/fr/docs/api/classes/Context.html index 8fb5b5baf..db99432e9 100644 --- a/fr/docs/api/classes/Context.html +++ b/fr/docs/api/classes/Context.html @@ -6,7 +6,7 @@ Class: Context | sern - Handlers. Redefined. - + @@ -18,7 +18,7 @@ Message

Returns CommandType.Slash or the event fired in a Both command was ChatInputCommandInteraction

Returns

Message<boolean>

Defined in

src/handler/structures/context.ts:29


user

get user(): User

If context is holding a message, message.author else, interaction.user

Returns

User

Defined in

src/handler/structures/context.ts:52

Methods

isMessage

isMessage(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:82


isSlash

isSlash(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:86


reply

reply(content): Promise<Message<boolean>>

Parameters

NameType
contentReplyOptions

Returns

Promise<Message<boolean>>

Defined in

src/handler/structures/context.ts:97


wrap

Static wrap(wrappable): Context

Parameters

NameType
wrappableMessage<boolean> | ChatInputCommandInteraction<CacheType>

Returns

Context

Defined in

src/handler/structures/context.ts:90

- + \ No newline at end of file diff --git a/fr/docs/api/classes/DefaultErrorHandling.html b/fr/docs/api/classes/DefaultErrorHandling.html index 82cb3a4b2..fe988049e 100644 --- a/fr/docs/api/classes/DefaultErrorHandling.html +++ b/fr/docs/api/classes/DefaultErrorHandling.html @@ -6,13 +6,13 @@ Class: DefaultErrorHandling | sern - Handlers. Redefined. - +

Class: DefaultErrorHandling

Implements

Constructors

constructor

new DefaultErrorHandling()

Properties

keepAlive

keepAlive: number = 5

Number of times the process should throw an error until crashing and exiting

Implementation of

ErrorHandling.keepAlive

Defined in

src/handler/contracts/errorHandling.ts:24

Methods

crash

crash(error): never

Utility function to crash

Parameters

NameType
errorError

Returns

never

Implementation of

ErrorHandling.crash

Defined in

src/handler/contracts/errorHandling.ts:25


updateAlive

updateAlive(e): void

A function that is called on every crash. Updates keepAlive

Parameters

NameType
eError

Returns

void

Implementation of

ErrorHandling.updateAlive

Defined in

src/handler/contracts/errorHandling.ts:28

- + \ No newline at end of file diff --git a/fr/docs/api/classes/DefaultLogging.html b/fr/docs/api/classes/DefaultLogging.html index ff34b4703..59eac33dc 100644 --- a/fr/docs/api/classes/DefaultLogging.html +++ b/fr/docs/api/classes/DefaultLogging.html @@ -6,13 +6,13 @@ Class: DefaultLogging | sern - Handlers. Redefined. - +

Class: DefaultLogging

Implements

Constructors

constructor

new DefaultLogging()

Methods

date

Private date(): Date

Returns

Date

Defined in

src/handler/contracts/logging.ts:11


debug

debug(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.debug

Defined in

src/handler/contracts/logging.ts:12


error

error(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.error

Defined in

src/handler/contracts/logging.ts:16


info

info(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.info

Defined in

src/handler/contracts/logging.ts:20


warning

warning(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.warning

Defined in

src/handler/contracts/logging.ts:24

- + \ No newline at end of file diff --git a/fr/docs/api/classes/DefaultModuleManager.html b/fr/docs/api/classes/DefaultModuleManager.html index 83c5d8141..a27e2a80c 100644 --- a/fr/docs/api/classes/DefaultModuleManager.html +++ b/fr/docs/api/classes/DefaultModuleManager.html @@ -6,13 +6,13 @@ Class: DefaultModuleManager | sern - Handlers. Redefined. - +

Class: DefaultModuleManager

Implements

Constructors

constructor

new DefaultModuleManager(moduleStore)

Parameters

NameType
moduleStoreModuleStore

Defined in

src/handler/contracts/moduleManager.ts:13

Methods

get

get<T>(strat): undefined | Processed<CommandModuleDefs[T]>

Type parameters

NameType
Textends CommandType

Parameters

NameType
strat(ms: ModuleStore) => undefined | Processed<CommandModuleDefs[T]>

Returns

undefined | Processed<CommandModuleDefs[T]>

Implementation of

ModuleManager.get

Defined in

src/handler/contracts/moduleManager.ts:14


set

set(strat): void

Parameters

NameType
strat(ms: ModuleStore) => void

Returns

void

Implementation of

ModuleManager.set

Defined in

src/handler/contracts/moduleManager.ts:20

- + \ No newline at end of file diff --git a/fr/docs/api/classes/EventExecutable.html b/fr/docs/api/classes/EventExecutable.html index f16ea5719..6456059d2 100644 --- a/fr/docs/api/classes/EventExecutable.html +++ b/fr/docs/api/classes/EventExecutable.html @@ -6,13 +6,13 @@ Class: EventExecutable<Type> | sern - Handlers. Redefined. - +

Class: EventExecutable<Type>

Experimental

Will be refactored in future

Type parameters

NameType
Typeextends EventType

Constructors

constructor

new EventExecutable<Type>()

Type parameters

NameType
Typeextends EventType

Properties

execute

Abstract execute: EventModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:130


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:129


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:128


type

Abstract type: Type

Defined in

src/handler/sern.ts:127

- + \ No newline at end of file diff --git a/fr/docs/api/classes/ModuleStore.html b/fr/docs/api/classes/ModuleStore.html index 3bea98143..f2e4607e8 100644 --- a/fr/docs/api/classes/ModuleStore.html +++ b/fr/docs/api/classes/ModuleStore.html @@ -6,14 +6,14 @@ Class: ModuleStore | sern - Handlers. Redefined. - +

Class: ModuleStore

Storing all command modules This dependency is usually injected into ModuleManager

Constructors

constructor

new ModuleStore()

Properties

ApplicationCommands

Readonly ApplicationCommands: Object

Type declaration

NameType
1Map<string, Processed<CommandModule>>
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:11


BothCommands

Readonly BothCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:10


InteractionHandlers

Readonly InteractionHandlers: Object

Type declaration

NameType
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>
5Map<string, Processed<CommandModule>>
6Map<string, Processed<CommandModule>>
7Map<string, Processed<CommandModule>>
8Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:18


ModalSubmit

Readonly ModalSubmit: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:16


TextCommands

Readonly TextCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:17

- + \ No newline at end of file diff --git a/fr/docs/api/classes/SernEmitter.html b/fr/docs/api/classes/SernEmitter.html index ac100ce51..81fffb922 100644 --- a/fr/docs/api/classes/SernEmitter.html +++ b/fr/docs/api/classes/SernEmitter.html @@ -6,7 +6,7 @@ Class: SernEmitter | sern - Handlers. Redefined. - + @@ -50,7 +50,7 @@ given event.

This method is intentionally generic and works with the web p semantics and does not listen to the 'error' event.

const { once, EventEmitter } = require('events');

async function run() {
const ee = new EventEmitter();

process.nextTick(() => {
ee.emit('myevent', 42);
});

const [value] = await once(ee, 'myevent');
console.log(value);

const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});

try {
await once(ee, 'myevent');
} catch (err) {
console.log('error happened', err);
}
}

run();

The special handling of the 'error' event is only used when events.once()is used to wait for another event. If events.once() is used to wait for the 'error' event itself, then it is treated as any other kind of event without special handling:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();

once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.log('error', err.message));

ee.emit('error', new Error('boom'));

// Prints: ok boom

An AbortSignal can be used to cancel waiting for the event:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();
const ac = new AbortController();

async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}

foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!

Since

v11.13.0, v10.16.0

Parameters

NameType
emitter_NodeEventTarget
eventNamestring | symbol
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:194

Static once(emitter, eventName, options?): Promise<any[]>

Parameters

NameType
emitter_DOMEventTarget
eventNamestring
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:195

Static once<E, K>(eventEmitter, eventName): Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Type parameters

NameType
Eextends __module
Kextends keyof ClientEvents

Parameters

NameType
eventEmitterE
eventNameE extends Client<boolean> ? K : string

Returns

Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:218


payload

Static Private payload<T>(type, module?, reason?): T

Type parameters

NameType
Textends Payload

Parameters

NameType
typePayloadType
module?Module
reason?unknown

Returns

T

Defined in

src/handler/sernEmitter.ts:40


setMaxListeners

Static setMaxListeners(n?, ...eventTargets): void

const {
setMaxListeners,
EventEmitter
} = require('events');

const target = new EventTarget();
const emitter = new EventEmitter();

setMaxListeners(5, target, emitter);

Since

v15.4.0

Parameters

NameTypeDescription
n?numberA non-negative number. The maximum number of listeners per EventTarget event.
...eventTargets(EventEmitter | _DOMEventTarget)[]-

Returns

void

Inherited from

EventEmitter.setMaxListeners

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:317


success

Static success(module): { module: AnyModule ; type: Success } & { type: Success } & never & never

Creates a compliant SernEmitter module success payload

Parameters

NameType
moduleModule

Returns

{ module: AnyModule ; type: Success } & { type: Success } & never & never

Defined in

src/handler/sernEmitter.ts:66


warning

Static warning(reason): never & never & { reason: string ; type: Warning } & { type: Warning }

Creates a compliant SernEmitter module warning payload

Parameters

NameType
reasonunknown

Returns

never & never & { reason: string ; type: Warning } & { type: Warning }

Defined in

src/handler/sernEmitter.ts:76

- + \ No newline at end of file diff --git a/fr/docs/api/enums/CommandType.html b/fr/docs/api/enums/CommandType.html index 20cabc97c..a7e6acb2c 100644 --- a/fr/docs/api/enums/CommandType.html +++ b/fr/docs/api/enums/CommandType.html @@ -6,13 +6,13 @@ Enumeration: CommandType | sern - Handlers. Redefined. - +

Enumeration: CommandType

A bitfield that discriminates command modules

Example

export default commandModule({
type : CommandType.Text,
name : 'a text command'
execute(message) {
console.log(message.content)
}
})

Enumeration Members

Both

Both = 3

The CommandType for hybrid commands, text and slash

Defined in

src/handler/structures/enums.ts:28


Button

Button = 16

The CommandType for ButtonInteraction commands

Defined in

src/handler/structures/enums.ts:40


ChannelSelect

ChannelSelect = 256

The CommandType for the other SelectMenuInteractions

Defined in

src/handler/structures/enums.ts:52


CtxMsg

CtxMsg = 8

The CommandType for MessageContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:36


CtxUser

CtxUser = 4

The CommandType for UserContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:32


MentionableSelect

MentionableSelect = 512

Defined in

src/handler/structures/enums.ts:53


Modal = 64

The CommandType for ModalSubmitInteraction commands

Defined in

src/handler/structures/enums.ts:48


RoleSelect

RoleSelect = 1024

Defined in

src/handler/structures/enums.ts:54


Slash

Slash = 2

The CommandType for slash commands

Defined in

src/handler/structures/enums.ts:24


StringSelect

StringSelect = 32

The CommandType for StringSelectMenuInteraction commands

Defined in

src/handler/structures/enums.ts:44


Text

Text = 1

The CommandType for text commands

Defined in

src/handler/structures/enums.ts:20


UserSelect

UserSelect = 2048

Defined in

src/handler/structures/enums.ts:55

- + \ No newline at end of file diff --git a/fr/docs/api/enums/EventType.html b/fr/docs/api/enums/EventType.html index 2ea270562..85c99c917 100644 --- a/fr/docs/api/enums/EventType.html +++ b/fr/docs/api/enums/EventType.html @@ -6,14 +6,14 @@ Enumeration: EventType | sern - Handlers. Redefined. - +

Enumeration: EventType

A bitfield that discriminates event modules

Example

export default eventModule({
type : EventType.Discord,
name : 'guildMemberAdd'
execute(member : GuildMember) {
console.log(member)
}
})

Enumeration Members

Discord

Discord = 1

The EventType for handling discord events

Defined in

src/handler/structures/enums.ts:77


External

External = 3

The EventType for handling external events. Could be for example, process events, database events

Defined in

src/handler/structures/enums.ts:86


Sern

Sern = 2

The EventType for handling sern events

Defined in

src/handler/structures/enums.ts:81

- + \ No newline at end of file diff --git a/fr/docs/api/enums/PayloadType.html b/fr/docs/api/enums/PayloadType.html index ed90ae073..b4c627e81 100644 --- a/fr/docs/api/enums/PayloadType.html +++ b/fr/docs/api/enums/PayloadType.html @@ -6,13 +6,13 @@ Enumeration: PayloadType | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/enums/PluginType.html b/fr/docs/api/enums/PluginType.html index 771bd3512..382fb99b7 100644 --- a/fr/docs/api/enums/PluginType.html +++ b/fr/docs/api/enums/PluginType.html @@ -6,13 +6,13 @@ Enumeration: PluginType | sern - Handlers. Redefined. - +

Enumeration: PluginType

A bitfield that discriminates plugins

Example

export default function myPlugin() : EventPlugin<CommandType.Text> {
type : PluginType.Event,
execute([ctx, args], controller) {
return controller.next();
}
}

Enumeration Members

Command

Command = 1

Deprecated

Use PluginType.Init instead

Defined in

src/handler/structures/enums.ts:112


Control

Control = 2

The PluginType for EventPlugins

Defined in

src/handler/structures/enums.ts:121


Event

Event = 2

Deprecated

Use PluginType.Control instead

Defined in

src/handler/structures/enums.ts:117


Init

Init = 1

The PluginType for InitPlugins

Defined in

src/handler/structures/enums.ts:107

- + \ No newline at end of file diff --git a/fr/docs/api/enums/SernError.html b/fr/docs/api/enums/SernError.html index 0f093b232..bc2ac2575 100644 --- a/fr/docs/api/enums/SernError.html +++ b/fr/docs/api/enums/SernError.html @@ -6,14 +6,14 @@ Enumeration: SernError | sern - Handlers. Redefined. - +

Enumeration: SernError

Enumeration Members

InvalidModuleType

InvalidModuleType = "Detected an unknown module type"

Throws when registering an invalid module. This means it is undefined or an invalid command type was provided

Defined in

src/handler/structures/errors.ts:9


MismatchEvent

MismatchEvent = "You cannot use message when an interaction fired or vice versa"

A crash that occurs when accessing an invalid property of Context

Defined in

src/handler/structures/errors.ts:29


MismatchModule

MismatchModule = "A module type mismatched with event emitted!"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:17


MissingRequired

MissingRequired = "@sern/client is required but was not found"

Required Dependency not found

Defined in

src/handler/structures/errors.ts:37


NotSupportedInteraction

NotSupportedInteraction = "This interaction is not supported."

Unsupported interaction at this moment.

Defined in

src/handler/structures/errors.ts:21


NotSupportedYet

NotSupportedYet = "This feature is not supported yet"

Unsupported feature attempted to access at this time

Defined in

src/handler/structures/errors.ts:33


PluginFailure

PluginFailure = "A plugin failed to call controller.next()"

One plugin called controller.stop() (end command execution / loading)

Defined in

src/handler/structures/errors.ts:25


UndefinedModule

UndefinedModule = "A module could not be detected"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:13

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/AutocompleteCommand.html b/fr/docs/api/interfaces/AutocompleteCommand.html index 2389d54cc..d33cbed94 100644 --- a/fr/docs/api/interfaces/AutocompleteCommand.html +++ b/fr/docs/api/interfaces/AutocompleteCommand.html @@ -6,13 +6,13 @@ Interface: AutocompleteCommand | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/AutocompletePlugin.html b/fr/docs/api/interfaces/AutocompletePlugin.html index 361c19a2f..a7130097b 100644 --- a/fr/docs/api/interfaces/AutocompletePlugin.html +++ b/fr/docs/api/interfaces/AutocompletePlugin.html @@ -6,13 +6,13 @@ Interface: AutocompletePlugin | sern - Handlers. Redefined. - +

Interface: AutocompletePlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (autocmp: AutocompleteInteraction<CacheType>, controlller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (autocmp, controlller): Awaitable<Result<void, void>>

Parameters
NameType
autocmpAutocompleteInteraction<CacheType>
controlllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:73


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:72

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/BothCommand.html b/fr/docs/api/interfaces/BothCommand.html index 26e445b7a..8767d27f6 100644 --- a/fr/docs/api/interfaces/BothCommand.html +++ b/fr/docs/api/interfaces/BothCommand.html @@ -6,13 +6,13 @@ Interface: BothCommand | sern - Handlers. Redefined. - +

Interface: BothCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:57


description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:58


execute

execute: (ctx: Context, args: Args) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
argsArgs
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:60


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:59


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Both

Overrides

Module.type

Defined in

src/types/module.ts:56

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ButtonCommand.html b/fr/docs/api/interfaces/ButtonCommand.html index 0062061b8..1dc70d94c 100644 --- a/fr/docs/api/interfaces/ButtonCommand.html +++ b/fr/docs/api/interfaces/ButtonCommand.html @@ -6,13 +6,13 @@ Interface: ButtonCommand | sern - Handlers. Redefined. - +

Interface: ButtonCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ButtonInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxButtonInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:75


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Button

Overrides

Module.type

Defined in

src/types/module.ts:74

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ChannelSelectCommand.html b/fr/docs/api/interfaces/ChannelSelectCommand.html index 2047be115..30750ad8b 100644 --- a/fr/docs/api/interfaces/ChannelSelectCommand.html +++ b/fr/docs/api/interfaces/ChannelSelectCommand.html @@ -6,13 +6,13 @@ Interface: ChannelSelectCommand | sern - Handlers. Redefined. - +

Interface: ChannelSelectCommand

Hierarchy

  • Module

    ChannelSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ChannelSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxChannelSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:85


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: ChannelSelect

Overrides

Module.type

Defined in

src/types/module.ts:84

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/CommandPlugin.html b/fr/docs/api/interfaces/CommandPlugin.html index 6f09ac001..66c1ec60e 100644 --- a/fr/docs/api/interfaces/CommandPlugin.html +++ b/fr/docs/api/interfaces/CommandPlugin.html @@ -6,13 +6,13 @@ Interface: CommandPlugin<T> | sern - Handlers. Redefined. - +

Interface: CommandPlugin<T>

Deprecated

Use the newer helper functions and import { controller } from '@sern/handler'

Type parameters

NameType
Textends CommandType = CommandType

Properties

description

Optional description: string

Defined in

src/types/plugin.ts:51


execute

execute: (m: InitArgs<Processed<CommandModule>>, controller?: Deprecated<"Please import controller instead">) => PluginResult

Type declaration

▸ (m, controller?): PluginResult

Parameters
NameType
mInitArgs<Processed<CommandModule>>
controller?Deprecated<"Please import controller instead">
Returns

PluginResult

Defined in

src/types/plugin.ts:53


name

Optional name: string

Defined in

src/types/plugin.ts:50


type

type: Init

Defined in

src/types/plugin.ts:52

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ContextMenuMsg.html b/fr/docs/api/interfaces/ContextMenuMsg.html index dba9565e5..267897df2 100644 --- a/fr/docs/api/interfaces/ContextMenuMsg.html +++ b/fr/docs/api/interfaces/ContextMenuMsg.html @@ -6,13 +6,13 @@ Interface: ContextMenuMsg | sern - Handlers. Redefined. - +

Interface: ContextMenuMsg

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MessageContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMessageContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:70


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxMsg

Overrides

Module.type

Defined in

src/types/module.ts:69

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ContextMenuUser.html b/fr/docs/api/interfaces/ContextMenuUser.html index 63a956f94..6ceb95db7 100644 --- a/fr/docs/api/interfaces/ContextMenuUser.html +++ b/fr/docs/api/interfaces/ContextMenuUser.html @@ -6,13 +6,13 @@ Interface: ContextMenuUser | sern - Handlers. Redefined. - +

Interface: ContextMenuUser

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:65


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxUser

Overrides

Module.type

Defined in

src/types/module.ts:64

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ControlPlugin.html b/fr/docs/api/interfaces/ControlPlugin.html index f75350a8d..52ae56670 100644 --- a/fr/docs/api/interfaces/ControlPlugin.html +++ b/fr/docs/api/interfaces/ControlPlugin.html @@ -6,13 +6,13 @@ Interface: ControlPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Controller.html b/fr/docs/api/interfaces/Controller.html index f87986e1f..9e2b06046 100644 --- a/fr/docs/api/interfaces/Controller.html +++ b/fr/docs/api/interfaces/Controller.html @@ -6,13 +6,13 @@ Interface: Controller | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Dependencies.html b/fr/docs/api/interfaces/Dependencies.html index 4972068cc..738148f9d 100644 --- a/fr/docs/api/interfaces/Dependencies.html +++ b/fr/docs/api/interfaces/Dependencies.html @@ -6,13 +6,13 @@ Interface: Dependencies | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/DependencyConfiguration.html b/fr/docs/api/interfaces/DependencyConfiguration.html index bec1ee15b..5ca7e11ea 100644 --- a/fr/docs/api/interfaces/DependencyConfiguration.html +++ b/fr/docs/api/interfaces/DependencyConfiguration.html @@ -6,13 +6,13 @@ Interface: DependencyConfiguration<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/DiscordEmitterPlugin.html b/fr/docs/api/interfaces/DiscordEmitterPlugin.html index 89aa36123..540228693 100644 --- a/fr/docs/api/interfaces/DiscordEmitterPlugin.html +++ b/fr/docs/api/interfaces/DiscordEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEmitterPlugin | sern - Handlers. Redefined. - +

Interface: DiscordEmitterPlugin

Hierarchy

  • Plugin

    DiscordEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: DiscordEventCommand<keyof ClientEvents> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modDiscordEventCommand<keyof ClientEvents> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:49


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:48

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/DiscordEventCommand.html b/fr/docs/api/interfaces/DiscordEventCommand.html index df1276905..e07ccc33a 100644 --- a/fr/docs/api/interfaces/DiscordEventCommand.html +++ b/fr/docs/api/interfaces/DiscordEventCommand.html @@ -6,13 +6,13 @@ Interface: DiscordEventCommand<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventCommand<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:123


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Discord

Overrides

Module.type

Defined in

src/types/module.ts:124

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsClientEvents[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:125

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/DiscordEventPlugin.html b/fr/docs/api/interfaces/DiscordEventPlugin.html index 9c82d7847..b1f8f35c8 100644 --- a/fr/docs/api/interfaces/DiscordEventPlugin.html +++ b/fr/docs/api/interfaces/DiscordEventPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventPlugin<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: ClientEvents[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsClientEvents[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:105


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:103


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:104

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ErrorHandling.html b/fr/docs/api/interfaces/ErrorHandling.html index 8f92751b9..bd11cd997 100644 --- a/fr/docs/api/interfaces/ErrorHandling.html +++ b/fr/docs/api/interfaces/ErrorHandling.html @@ -6,13 +6,13 @@ Interface: ErrorHandling | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/EventPlugin.html b/fr/docs/api/interfaces/EventPlugin.html index c9b42c787..84805a19c 100644 --- a/fr/docs/api/interfaces/EventPlugin.html +++ b/fr/docs/api/interfaces/EventPlugin.html @@ -6,13 +6,13 @@ Interface: EventPlugin<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ExternalEmitterPlugin.html b/fr/docs/api/interfaces/ExternalEmitterPlugin.html index 55a03a288..12953868a 100644 --- a/fr/docs/api/interfaces/ExternalEmitterPlugin.html +++ b/fr/docs/api/interfaces/ExternalEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEmitterPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEmitterPlugin

Hierarchy

  • Plugin

    ExternalEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: ExternalEventCommand & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modExternalEventCommand & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:57


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:56

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ExternalEventCommand.html b/fr/docs/api/interfaces/ExternalEventCommand.html index 65b7b90b7..8c39a78cc 100644 --- a/fr/docs/api/interfaces/ExternalEventCommand.html +++ b/fr/docs/api/interfaces/ExternalEventCommand.html @@ -6,13 +6,13 @@ Interface: ExternalEventCommand | sern - Handlers. Redefined. - +

Interface: ExternalEventCommand

Hierarchy

  • Module

    ExternalEventCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


emitter

emitter: string

Defined in

src/types/module.ts:130


name

Optional name: string

Overrides

Module.name

Defined in

src/types/module.ts:129


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: External

Overrides

Module.type

Defined in

src/types/module.ts:131

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsunknown[]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:132

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ExternalEventPlugin.html b/fr/docs/api/interfaces/ExternalEventPlugin.html index f8d79ff80..e6545218f 100644 --- a/fr/docs/api/interfaces/ExternalEventPlugin.html +++ b/fr/docs/api/interfaces/ExternalEventPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEventPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEventPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: unknown[], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsunknown[]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:99


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:98

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/InitArgs.html b/fr/docs/api/interfaces/InitArgs.html index 55b973147..b83fa6c83 100644 --- a/fr/docs/api/interfaces/InitArgs.html +++ b/fr/docs/api/interfaces/InitArgs.html @@ -6,13 +6,13 @@ Interface: InitArgs<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/InitPlugin.html b/fr/docs/api/interfaces/InitPlugin.html index b347add9a..3d9080ae1 100644 --- a/fr/docs/api/interfaces/InitPlugin.html +++ b/fr/docs/api/interfaces/InitPlugin.html @@ -6,13 +6,13 @@ Interface: InitPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Logging.html b/fr/docs/api/interfaces/Logging.html index 23d9c09eb..c2d2dfb22 100644 --- a/fr/docs/api/interfaces/Logging.html +++ b/fr/docs/api/interfaces/Logging.html @@ -6,13 +6,13 @@ Interface: Logging<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/MentionableSelectCommand.html b/fr/docs/api/interfaces/MentionableSelectCommand.html index cf919b5eb..7e289f3db 100644 --- a/fr/docs/api/interfaces/MentionableSelectCommand.html +++ b/fr/docs/api/interfaces/MentionableSelectCommand.html @@ -6,13 +6,13 @@ Interface: MentionableSelectCommand | sern - Handlers. Redefined. - +

Interface: MentionableSelectCommand

Hierarchy

  • Module

    MentionableSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MentionableSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMentionableSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:95


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: MentionableSelect

Overrides

Module.type

Defined in

src/types/module.ts:94

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ModalSubmitCommand.html b/fr/docs/api/interfaces/ModalSubmitCommand.html index 1a9fff7b4..9d0f8fadd 100644 --- a/fr/docs/api/interfaces/ModalSubmitCommand.html +++ b/fr/docs/api/interfaces/ModalSubmitCommand.html @@ -6,13 +6,13 @@ Interface: ModalSubmitCommand | sern - Handlers. Redefined. - +

Interface: ModalSubmitCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ModalSubmitInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxModalSubmitInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:105


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Modal

Overrides

Module.type

Defined in

src/types/module.ts:104

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Module.html b/fr/docs/api/interfaces/Module.html index 00de81b9b..4f85ac9b6 100644 --- a/fr/docs/api/interfaces/Module.html +++ b/fr/docs/api/interfaces/Module.html @@ -6,13 +6,13 @@ Interface: Module | sern - Handlers. Redefined. - +

Interface: Module

Hierarchy

Properties

description

Optional description: string

Defined in

src/types/module.ts:38


execute

execute: (...args: any[]) => any

Type declaration

▸ (...args): any

Parameters
NameType
...argsany[]
Returns

any

Defined in

src/types/module.ts:39


name

Optional name: string

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Defined in

src/types/module.ts:37


type

type: CommandType | EventType

Defined in

src/types/module.ts:34

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/ModuleManager.html b/fr/docs/api/interfaces/ModuleManager.html index a94c28a22..0cae6178c 100644 --- a/fr/docs/api/interfaces/ModuleManager.html +++ b/fr/docs/api/interfaces/ModuleManager.html @@ -6,13 +6,13 @@ Interface: ModuleManager | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Plugin.html b/fr/docs/api/interfaces/Plugin.html index 15e855162..2d4f8ed8e 100644 --- a/fr/docs/api/interfaces/Plugin.html +++ b/fr/docs/api/interfaces/Plugin.html @@ -6,13 +6,13 @@ Interface: Plugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/fr/docs/api/interfaces/RoleSelectCommand.html b/fr/docs/api/interfaces/RoleSelectCommand.html index b9033d4db..9aa4c46bd 100644 --- a/fr/docs/api/interfaces/RoleSelectCommand.html +++ b/fr/docs/api/interfaces/RoleSelectCommand.html @@ -6,13 +6,13 @@ Interface: RoleSelectCommand | sern - Handlers. Redefined. - +

Interface: RoleSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: RoleSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxRoleSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:90


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: RoleSelect

Overrides

Module.type

Defined in

src/types/module.ts:89

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernAutocompleteData.html b/fr/docs/api/interfaces/SernAutocompleteData.html index bd207ef97..d901f9b06 100644 --- a/fr/docs/api/interfaces/SernAutocompleteData.html +++ b/fr/docs/api/interfaces/SernAutocompleteData.html @@ -6,13 +6,13 @@ Interface: SernAutocompleteData | sern - Handlers. Redefined. - +

Interface: SernAutocompleteData

Hierarchy

  • Omit<BaseApplicationCommandOptionsData, "autocomplete">

    SernAutocompleteData

Properties

autocomplete

autocomplete: true

Defined in

src/types/module.ts:177


command

command: AutocompleteCommand

Defined in

src/types/module.ts:182


description

description: string

Inherited from

Omit.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

Omit.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


required

Optional required: boolean

Inherited from

Omit.required

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4202


type

type: String | Integer | Number

Defined in

src/types/module.ts:178

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernEmitterPlugin.html b/fr/docs/api/interfaces/SernEmitterPlugin.html index b2dfee2e7..416c2a4a3 100644 --- a/fr/docs/api/interfaces/SernEmitterPlugin.html +++ b/fr/docs/api/interfaces/SernEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: SernEmitterPlugin | sern - Handlers. Redefined. - +

Interface: SernEmitterPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: SernEventCommand<keyof SernEventsMapping> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modSernEventCommand<keyof SernEventsMapping> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:65


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:64

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernEventCommand.html b/fr/docs/api/interfaces/SernEventCommand.html index 64f9c7c8d..a1474ce27 100644 --- a/fr/docs/api/interfaces/SernEventCommand.html +++ b/fr/docs/api/interfaces/SernEventCommand.html @@ -6,13 +6,13 @@ Interface: SernEventCommand<T> | sern - Handlers. Redefined. - +

Interface: SernEventCommand<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:116


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Sern

Overrides

Module.type

Defined in

src/types/module.ts:117

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsSernEventsMapping[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:118

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernEventPlugin.html b/fr/docs/api/interfaces/SernEventPlugin.html index 4bd7f4554..d87129d57 100644 --- a/fr/docs/api/interfaces/SernEventPlugin.html +++ b/fr/docs/api/interfaces/SernEventPlugin.html @@ -6,13 +6,13 @@ Interface: SernEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: SernEventPlugin<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: SernEventsMapping[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsSernEventsMapping[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:91


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:89


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:90

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernSubCommandData.html b/fr/docs/api/interfaces/SernSubCommandData.html index 4dcafcb7e..3b991bfc2 100644 --- a/fr/docs/api/interfaces/SernSubCommandData.html +++ b/fr/docs/api/interfaces/SernSubCommandData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandData | sern - Handlers. Redefined. - +

Interface: SernSubCommandData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: BaseOptions[]

Defined in

src/types/module.ts:214


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:213


type

type: Subcommand

Defined in

src/types/module.ts:212

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SernSubCommandGroupData.html b/fr/docs/api/interfaces/SernSubCommandGroupData.html index 99f4bc713..e1352132d 100644 --- a/fr/docs/api/interfaces/SernSubCommandGroupData.html +++ b/fr/docs/api/interfaces/SernSubCommandGroupData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandGroupData | sern - Handlers. Redefined. - +

Interface: SernSubCommandGroupData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandGroupData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: SernSubCommandData[]

Defined in

src/types/module.ts:220


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:219


type

type: SubcommandGroup

Defined in

src/types/module.ts:218

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/SlashCommand.html b/fr/docs/api/interfaces/SlashCommand.html index 890b033d8..1be7b2356 100644 --- a/fr/docs/api/interfaces/SlashCommand.html +++ b/fr/docs/api/interfaces/SlashCommand.html @@ -6,13 +6,13 @@ Interface: SlashCommand | sern - Handlers. Redefined. - +

Interface: SlashCommand

Hierarchy

Properties

description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:50


execute

execute: (ctx: Context, args: ["slash", SlashOptions]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["slash", SlashOptions]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:52


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:51


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Slash

Overrides

Module.type

Defined in

src/types/module.ts:49

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/StringSelectCommand.html b/fr/docs/api/interfaces/StringSelectCommand.html index bf3eabfd5..137bdb2f9 100644 --- a/fr/docs/api/interfaces/StringSelectCommand.html +++ b/fr/docs/api/interfaces/StringSelectCommand.html @@ -6,13 +6,13 @@ Interface: StringSelectCommand | sern - Handlers. Redefined. - +

Interface: StringSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: StringSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxStringSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:80


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: StringSelect

Overrides

Module.type

Defined in

src/types/module.ts:79

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/TextCommand.html b/fr/docs/api/interfaces/TextCommand.html index a4826e922..9c43b38c8 100644 --- a/fr/docs/api/interfaces/TextCommand.html +++ b/fr/docs/api/interfaces/TextCommand.html @@ -6,13 +6,13 @@ Interface: TextCommand | sern - Handlers. Redefined. - +

Interface: TextCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:44


description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: Context, args: ["text", string[]]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["text", string[]]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:45


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Text

Overrides

Module.type

Defined in

src/types/module.ts:43

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/UserSelectCommand.html b/fr/docs/api/interfaces/UserSelectCommand.html index 90e45af2c..fc4d1ce8c 100644 --- a/fr/docs/api/interfaces/UserSelectCommand.html +++ b/fr/docs/api/interfaces/UserSelectCommand.html @@ -6,13 +6,13 @@ Interface: UserSelectCommand | sern - Handlers. Redefined. - +

Interface: UserSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:100


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: UserSelect

Overrides

Module.type

Defined in

src/types/module.ts:99

- + \ No newline at end of file diff --git a/fr/docs/api/interfaces/Wrapper.html b/fr/docs/api/interfaces/Wrapper.html index c5347e9df..f9be13d91 100644 --- a/fr/docs/api/interfaces/Wrapper.html +++ b/fr/docs/api/interfaces/Wrapper.html @@ -6,13 +6,13 @@ Interface: Wrapper | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/api/modules.html b/fr/docs/api/modules.html index 011e0eff3..692f3494a 100644 --- a/fr/docs/api/modules.html +++ b/fr/docs/api/modules.html @@ -6,7 +6,7 @@ @sern/handler | sern - Handlers. Redefined. - + @@ -19,7 +19,7 @@ where typings can be very bad.

Type parameters

NameType
Textends () => () => unknown

Parameters

NameType
cbT

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:33


useContainerRaw

useContainerRaw<T>(): Container<T, {}>

Returns the underlying data structure holding all dependencies. Please be careful as this only gets the client's current state. Exposes some methods from iti

Type parameters

NameType
Textends Dependencies

Returns

Container<T, {}>

Defined in

src/handler/dependencies/provider.ts:54

- + \ No newline at end of file diff --git a/fr/docs/api/namespaces/Sern.html b/fr/docs/api/namespaces/Sern.html index 8d2c26b9a..01fdbb245 100644 --- a/fr/docs/api/namespaces/Sern.html +++ b/fr/docs/api/namespaces/Sern.html @@ -6,13 +6,13 @@ Namespace: Sern | sern - Handlers. Redefined. - +

Namespace: Sern

References

CommandExecutable

Re-exports CommandExecutable


EventExecutable

Re-exports EventExecutable


commandModule

Re-exports commandModule


controller

Re-exports controller


discordEvent

Re-exports discordEvent


eventModule

Re-exports eventModule

Functions

init

init(wrapper): void

Example

src/index.ts
Sern.init({
defaultPrefix: '!',
commands: 'dist/commands',
events: 'dist/events',
containerConfig : {
get: useContainer
}
})

Parameters

NameTypeDescription
wrapperWrapperOptions to pass into sern. Function to start the handler up

Returns

void

Defined in

src/handler/sern.ts:38


makeDependencies

makeDependencies<T>(conf): <V>(...keys: [...V[]]) => MapDeps<T, V>

Type parameters

NameType
Textends Dependencies

Parameters

NameTypeDescription
confDependencyConfiguration<T>a configuration for creating your project dependencies

Returns

fn

▸ <V>(...keys): MapDeps<T, V>

Type parameters
NameType
Vextends keyof T[]
Parameters
NameType
...keys[...V[]]
Returns

MapDeps<T, V>

Defined in

src/handler/sern.ts:107

- + \ No newline at end of file diff --git a/fr/docs/guide.html b/fr/docs/guide.html index 9497cf416..d7124c531 100644 --- a/fr/docs/guide.html +++ b/fr/docs/guide.html @@ -6,13 +6,13 @@ Introduction | sern - Handlers. Redefined. - +

Introduction

Welcome to our official guide. This guide will go through all the core features of the framework.

  • 💖 Thank you for choosing sern to be your framework!

  • Teaching the discord.js library and / or Javascript / Typescript is out of scope of this project, so the documentation assumes you already know these elements.

  • discord.js v14 is the only supported library at the moment

You will learn

Working with plugins

Events

Good to know

- + \ No newline at end of file diff --git a/fr/docs/guide/getting-started/choose-ide.html b/fr/docs/guide/getting-started/choose-ide.html index 81bbb2d74..d526897a1 100644 --- a/fr/docs/guide/getting-started/choose-ide.html +++ b/fr/docs/guide/getting-started/choose-ide.html @@ -6,14 +6,14 @@ Choosing an IDE | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/fr/docs/guide/getting-started/preparing.html b/fr/docs/guide/getting-started/preparing.html index ebea1c7fd..42b8b3afc 100644 --- a/fr/docs/guide/getting-started/preparing.html +++ b/fr/docs/guide/getting-started/preparing.html @@ -6,13 +6,13 @@ Preparing to Code | sern - Handlers. Redefined. - +

Preparing to Code

After installing and IDE you need to install node.

Click to download the LTS version of node right here.

After you downloaded node, you can start using us

Running this will install our CLI, which allows you to create a template project without writing a single line of code.

npm install -g @sern/cli

If you want to do more with our CLI, continue reading our guides.

- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/cli.html b/fr/docs/guide/walkthrough/cli.html index 6425c724e..734ed9719 100644 --- a/fr/docs/guide/walkthrough/cli.html +++ b/fr/docs/guide/walkthrough/cli.html @@ -6,7 +6,7 @@ CLI | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

CLI

Setting up the CLI is easy.

  • To start a brand-new project, run :
sern init (-y)
astuce

It creates a directory for you so you don't need to!

Include the -y flag if you want to set up defaults. The default langauge is Typescript

sern plugins
info

Make sure to have a correct sern.config.json

This will display a menu selection of all installable plugins.
Note: You must have a sern.config.json to use this command. If you want to view plugins, visit the repository linked above.

  • To install extra utilities into your project
sern extra
- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/conclusion.html b/fr/docs/guide/walkthrough/conclusion.html index 6bc933d7d..0e4664aca 100644 --- a/fr/docs/guide/walkthrough/conclusion.html +++ b/fr/docs/guide/walkthrough/conclusion.html @@ -6,7 +6,7 @@ Conclusion | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Conclusion

If you reached this far, thank you for reading! We hope you have learned the necessities you need to create a bot with the sern framework. If you have any other questions, bugs, feature requests, concerns, please join our community server, and we'll be glad to answer your questions.

- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/first-command.html b/fr/docs/guide/walkthrough/first-command.html index 5916ebe43..9676f80c9 100644 --- a/fr/docs/guide/walkthrough/first-command.html +++ b/fr/docs/guide/walkthrough/first-command.html @@ -6,7 +6,7 @@ First Command | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ If you installed a new project via the cli, This is the ping command located in src/commands folder.

Typescript

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
})

To view what each of these properties mean in depth, visit the official documentation.

Types of command modules

Every command module type is part of an enum. This field allows type inference for the rest of a module's fields.
All the command types can be found in the official documentation!

So, lets say you want to make a command module that listens to modals.

Note: Keep in mind you'll need to send a modal with a custom id dm-me. This example below is the response to a modal being sent.


Typescript:

import { commandModule, CommandType } from '@sern/handler';
export default commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Javascript:

const { CommandType, commandModule } = require('@sern/handler');
exports.default = commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Commands are straight forward. Keep in mind, every other property on the commandModule object is optional except the type and execute function.

Context class

The provided Context class helps with modules of CommandType.Both (A mixture of slash / legacy commands).

The Context class is passed into modules with type:

  • CommandType.Both
  • CommandType.Slash
  • CommandType.Text

This data structure helps interop between legacy commands and slash commands with ease.

remarque

View the docs

Typescript:

export default commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx: Context) {
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});

Javascript:

exports.default = commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx) { //ctx is a Context instance
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});
- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/first-event.html b/fr/docs/guide/walkthrough/first-event.html index f6402edfe..0eb16597d 100644 --- a/fr/docs/guide/walkthrough/first-event.html +++ b/fr/docs/guide/walkthrough/first-event.html @@ -6,7 +6,7 @@ First Event Module | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

First Event Module

We will dissect a basic event module.
Typescript:

export default eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate', //name of event.
execute(event) {
console.log(event);
}
})

Javascript:

exports.default = eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate',
execute(event) {
console.log(event);
}
})

Like command modules, the type property denotes what kind of event it is, which can be found here.

To view what each of these properties mean in depth, visit the official documentation.


Event modules are laid out similarly to command modules. These listen to any and all event you provide. In the current version 1.1.0-beta, plugins are not supported.

Another example of an event module

Typescript:

export default eventModule({
type: EventType.Discord,
plugins : [],
name: 'guildMemberAdd', //name of event.
async execute(member: GuildMember) {
(await member.guild.channels.fetch('channel-id') as TextChannel).send(`Welcome, ${member}`);
}
})

Javascript:


exports.default = eventModule({
type: EventType.Discord,
plugins : [], //NOT SUPPORTED YET!!
name: 'guildMemberAdd', //name of event.
async execute(member) {
(await member.guild.channels.fetch('channel-id')).send(`Welcome, ${member}`);
}
})
- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/goal.html b/fr/docs/guide/walkthrough/goal.html index 19988a16a..a932fc079 100644 --- a/fr/docs/guide/walkthrough/goal.html +++ b/fr/docs/guide/walkthrough/goal.html @@ -6,7 +6,7 @@ Goal | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Goal

sern strives to be minimalist, but with all batteries included. Meaning, this framework provides the necessary tools to start up a bot in minutes, and leaves plenty room space to customize your experience and create an amazing project. It should include all the tools for any bot at any scale.

- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/good-to-know.html b/fr/docs/guide/walkthrough/good-to-know.html index 5bfa3c0af..615cb6df2 100644 --- a/fr/docs/guide/walkthrough/good-to-know.html +++ b/fr/docs/guide/walkthrough/good-to-know.html @@ -6,7 +6,7 @@ Good to know | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Good to know

sern.config.json

A sern.config.json, although not necessary, allows your project to communicate with our cli.

For example, when installing typescript plugins, the language property is necessary to install from our open source repository.

Using the cli and running sern init --sync on pre-existing projects should install this json file in the root directory given. Or, if this is a brand-new project, sern init automatically installs it.

{
"language": "typescript",
"paths": {
"base": "src",
"commands": "commands"
}
}
- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/plugins.html b/fr/docs/guide/walkthrough/plugins.html index 93aa0d8e7..f78d7be43 100644 --- a/fr/docs/guide/walkthrough/plugins.html +++ b/fr/docs/guide/walkthrough/plugins.html @@ -6,7 +6,7 @@ Plugins | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ This controls whether a module is stored into sern.
Typescript:

export function inDir(dir : string) : CommandPlugin<CommandType.Both> {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Javascript:

export function inDir(dir : string) {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Above, this simple plugin logs that the module has been loaded along with a timestamp.
Again, it is up to you to define plugin logic! The possibilities to customize your bots are endless.

astuce

Command Plugins are good for ensuring the shape, location, and preprocessing of your commands.

Event Plugins

event-plugins

  • An event is emitted by discord.js.
  • This event is passed to all plugins (in order!!),
  • If all are successful,

The command is executed. Calling controller.stop() notifies sern that this command should not be run, and this event is ignored.

So, what does a command module look like with plugins?

Typescript:

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly()
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript:

const { commandModule, CommandType } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly() //The plugins in this section applied to this module!
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Can you predict the behavior of this command?

  • Before loading into sern, this command module will check if this module is in the correct directory other.
  • Before an event occurs, this command module will check if the user has the id 182326315813306368.
astuce

Event Plugins are good for filtering, preconditions, parsing.

If all plugins return controller.next(), this command replies Pong 🏓

- + \ No newline at end of file diff --git a/fr/docs/guide/walkthrough/sern-emitter.html b/fr/docs/guide/walkthrough/sern-emitter.html index 96b9045ca..a342875a5 100644 --- a/fr/docs/guide/walkthrough/sern-emitter.html +++ b/fr/docs/guide/walkthrough/sern-emitter.html @@ -6,13 +6,13 @@ The SernEmitter class | sern - Handlers. Redefined. - +

The SernEmitter class

You're shipped with the SernEmitter. This EventEmitter listens to

  • command modules executing and its status, the module.activate event
  • command modules registered and its status, the module.register event
  • On default, sern creates a single SernEmitter for your bot process.
  • any error that occurs, the error event
  • warn events, where it is possible to throw errors

You can put these and other event listeners into event modules!


View all events
- + \ No newline at end of file diff --git a/fr/docs/intro.html b/fr/docs/intro.html index a72ca98a2..bf9203ef1 100644 --- a/fr/docs/intro.html +++ b/fr/docs/intro.html @@ -6,13 +6,13 @@ Welcome! | sern - Handlers. Redefined. - +

Welcome!

Content

  • /docs/api contains autogenerated documentation of our codebase using typedoc
  • /docs/guide contains a basic startup guide and details to get started with sern faster!
astuce

This site is open source! Please do contribute if you find any bugs, typos, or sections in need of improvements.

astuce

If you have problems, join the discord server here

- + \ No newline at end of file diff --git a/fr/index.html b/fr/index.html index 45018fef6..05d3cf185 100644 --- a/fr/index.html +++ b/fr/index.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. | sern - Handlers. Redefined. - +

Handlers. Redefined.

With the support of the community made plugins and a powerful CLI, it's more than just a handler.

sern init
logo

Batteries included

Start or integrate a new project in minutes.

Customizable

Extend or customize with community-based plugins to provide utilities, filters, and more.

Modern

Uses modern and powerful tooling such as swc, tsup, typescript, and rxjs to future-proof and ensure project quality.

- + \ No newline at end of file diff --git a/fr/markdown-page.html b/fr/markdown-page.html index 49e5f3a21..0cedb7760 100644 --- a/fr/markdown-page.html +++ b/fr/markdown-page.html @@ -6,13 +6,13 @@ Markdown page example | sern - Handlers. Redefined. - +

Markdown page example

You don't need React to write simple standalone pages.

- + \ No newline at end of file diff --git a/fr/plugins.html b/fr/plugins.html index 6e27e9641..70535fc54 100644 --- a/fr/plugins.html +++ b/fr/plugins.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. - +

Coming soon

- + \ No newline at end of file diff --git a/index.html b/index.html index 44052b8d5..20edfda33 100644 --- a/index.html +++ b/index.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. | sern - Handlers. Redefined. - +

Handlers. Redefined.

With the support of the community made plugins and a powerful CLI, it's more than just a handler.

sern init
logo

Batteries included

Start or integrate a new project in minutes.

Customizable

Extend or customize with community-based plugins to provide utilities, filters, and more.

Modern

Uses modern and powerful tooling such as swc, tsup, typescript, and rxjs to future-proof and ensure project quality.

- + \ No newline at end of file diff --git a/markdown-page.html b/markdown-page.html index 38ef8e4f4..23e59ee88 100644 --- a/markdown-page.html +++ b/markdown-page.html @@ -6,13 +6,13 @@ Markdown page example | sern - Handlers. Redefined. - +

Markdown page example

You don't need React to write simple standalone pages.

- + \ No newline at end of file diff --git a/plugins.html b/plugins.html index 6fb62f775..b4ad367c4 100644 --- a/plugins.html +++ b/plugins.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. - +

Coming soon

- + \ No newline at end of file diff --git a/tr/404.html b/tr/404.html index 68853cd3d..c9fe8aceb 100644 --- a/tr/404.html +++ b/tr/404.html @@ -6,13 +6,13 @@ Sayfa Bulunamadı | sern - Handlers. Redefined. - +

Sayfa Bulunamadı

Aradığınız şeyi bulamadık.

Lütfen sizi orijinal URL'ye yönlendiren sitenin sahibiyle iletişime geçin ve bağlantısının bozuk olduğunu bildirin.

- + \ No newline at end of file diff --git a/tr/assets/js/3a25b5a8.b31ee531.js b/tr/assets/js/3a25b5a8.8df251cf.js similarity index 83% rename from tr/assets/js/3a25b5a8.b31ee531.js rename to tr/assets/js/3a25b5a8.8df251cf.js index c1290e968..7517baa1b 100644 --- a/tr/assets/js/3a25b5a8.b31ee531.js +++ b/tr/assets/js/3a25b5a8.8df251cf.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/tr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 Aral\u0131k 2022",tags:[{label:"release",permalink:"/tr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/tr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/tr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[3012],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/tr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 Aral\u0131k 2022",tags:[{label:"release",permalink:"/tr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/tr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/tr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/tr/assets/js/67348500.d439a66b.js b/tr/assets/js/67348500.8dca85ed.js similarity index 83% rename from tr/assets/js/67348500.d439a66b.js rename to tr/assets/js/67348500.8dca85ed.js index decc2cebf..730e73176 100644 --- a/tr/assets/js/67348500.d439a66b.js +++ b/tr/assets/js/67348500.8dca85ed.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/tr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 Aral\u0131k 2022",tags:[{label:"release",permalink:"/tr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/tr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/tr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.ml/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[2072],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>m});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(t),m=a,g=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return t?r.createElement(g,l(l({ref:n},d),{},{components:t})):r.createElement(g,l({ref:n},d))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,l=new Array(o);l[0]=u;var i={};for(var s in n)hasOwnProperty.call(n,s)&&(i[s]=n[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=t(7462),a=(t(7294),t(3905));const o={slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},l=void 0,i={permalink:"/tr/blog/2.0.0",editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md",source:"@site/blog/2022-12-13-mdx-blog-post.md",title:"Release 2.0.0",description:"2.0 Release",date:"2022-12-13T00:00:00.000Z",formattedDate:"13 Aral\u0131k 2022",tags:[{label:"release",permalink:"/tr/blog/tags/release"}],readingTime:3.63,hasTruncateMarker:!1,authors:[{name:"jacoobes",title:"Head Dev",url:"https://github.com/jacoobes",imageURL:"https://github.com/jacoobes.png",key:"jacoobes"}],frontMatter:{slug:"2.0.0",title:"Release 2.0.0",authors:["jacoobes"],tags:["release"]},prevItem:{title:"Release 2.5.0",permalink:"/tr/blog/2.5.0"},nextItem:{title:"How to get started with sern!",permalink:"/tr/blog/getting-started"}},s={authorsImageUrls:[void 0]},p=[{value:"2.0 Release",id:"20-release",level:2},{value:"Plugin Support for Event Modules",id:"plugin-support-for-event-modules",level:3},{value:"Dependency Injection and Decoupling",id:"dependency-injection-and-decoupling",level:2},{value:"How do I start?",id:"how-do-i-start",level:3},{value:"New CommandTypes",id:"new-commandtypes",level:2},{value:"Typings Simplification",id:"typings-simplification",level:2},{value:"Breaking Changes",id:"breaking-changes",level:2},{value:"Context refactoring",id:"context-refactoring",level:2}],d={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"20-release"},"2.0 Release"),(0,a.kt)("p",null,"Join our ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/discord"},"discord"),"! ",(0,a.kt)("br",null),"\nWow! We're finally increasing our semantic versioning by +",(0,a.kt)("inlineCode",{parentName:"p"},"1.7.9.")," ",(0,a.kt)("br",null),"\nWhat does this mean?"),(0,a.kt)("h3",{id:"plugin-support-for-event-modules"},"Plugin Support for Event Modules"),(0,a.kt)("p",null,"You can now use plugins for event modules. Previous version would throw an error if the\n",(0,a.kt)("inlineCode",{parentName:"p"},"plugins")," field was populated."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export function commandPlTest() : SernEmitterPlugin {\n return {\n type: PluginType.Command,\n execute: ({ mod}, controller) => {\n if(mod.name === 'module.register') {\n console.log('Event Module created correctly')\n return controller.next()\n }\n console.log('event name is wrong')\n return controller.stop()\n }\n }\n}\n")),(0,a.kt)("p",null,"Applying this plugin to some ",(0,a.kt)("inlineCode",{parentName:"p"},"eventModule"),": "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export default eventModule({\n name: 'error',\n type: EventType.Sern,\n plugins: [commandPlTest()],\n execute(m) {\n console.log(m)\n },\n})\n")),(0,a.kt)("h2",{id:"dependency-injection-and-decoupling"},"Dependency Injection and Decoupling"),(0,a.kt)("p",null,"The powerful npm package ",(0,a.kt)("inlineCode",{parentName:"p"},"iti")," decouples sern even more.\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\nand make sern even more customizable than before."),(0,a.kt)("h3",{id:"how-do-i-start"},"How do I start?"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="src/index.ts"',title:'"src/index.ts"'},"//With typescript, you can customize / augment your typings.\ninterface MyDependencies extends Dependencies {\n '@sern/client' : Singleton;\n '@sern/logger' : Singleton\n}\n\nexport const useContainer = Sern.makeDependencies({\n// exclude: new Set(['@sern/logger']), don't autofill optional dependencies\n build: root => root\n .add({ '@sern/client': single(client) }) \n .add({ '@sern/logger': single(new DefaultLogging()) })\n});\n\nSern.init({\n defaultPrefix: '!', // removing defaultPrefix will shut down text commands\n commands: 'src/commands',\n // events: 'src/events' (optional),\n containerConfig : {\n get: useContainer //pass in your dependency getter here\n }\n});\n\n")),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"Sern#makeDependencies")," function, inject your dependencies.\nWe'll use specific dependencies that are created with the ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/keyword"),"\nkey.\nUsing typescript to display all ",(0,a.kt)("inlineCode",{parentName:"p"},"keywords")," and what they represent:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface Dependencies {\n '@sern/client': Singleton; //Discord Client\n '@sern/logger'?: Singleton; //Logger\n '@sern/emitter': Singleton; //SernEmitter\n '@sern/store' : Singleton; //Stores all Command Modules\n '@sern/modules' : Singleton; //Manages Modules\n '@sern/errors': Singleton; //A Lifetime / Crash Handler\n}\n")),(0,a.kt)("admonition",{type:"danger"},(0,a.kt)("p",{parentName:"admonition"},"Sern#addExternal has been deprecated and removed in favor of Sern#makeDependencies")),(0,a.kt)("p",null,"At the moment, one optional dependency, ",(0,a.kt)("inlineCode",{parentName:"p"},"@sern/logger"),", exists. If not added explicitly,\nwe'll ",(0,a.kt)("strong",{parentName:"p"},"autofill")," with a ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/classes/defaultlogging"},"DefaultLogger"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you don't want a logger, add it to the\n",(0,a.kt)("inlineCode",{parentName:"p"},"exclude")," field while composing dependencies.")),(0,a.kt)("p",null,"Use your generated dependency getter ",(0,a.kt)("inlineCode",{parentName:"p"},"useContainer")," (use whatever name you want), access them\nfrom anywhere."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"the function ",(0,a.kt)("a",{parentName:"p",href:"https://sern.dev/docs/api/modules#usecontainerraw"},"useContainerRaw")," is provided for direct access to dependencies and the internal\ndata structure. Use this wisely as no guarantees are made and crashes can happen.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"build")," field follows ",(0,a.kt)("a",{parentName:"p",href:"https://itijs.org/docs/quick-start#usage"},"createContainer")," function call."),(0,a.kt)("h2",{id:"new-commandtypes"},"New CommandTypes"),(0,a.kt)("p",null,"2.0 includes all the new role select menus. ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MenuSelect")," has been renamed into\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.StringSelect"),". The remaining SelectMenus are\n",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.RoleSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.ChannelSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.UserSelect"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"CommandType.MentionableSelect")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-typescript",metastring:'title="commands/roleselect.ts"',title:'"commands/roleselect.ts"'},"export default commandModule({\n type: CommandType.RoleSelect,\n execute(ctx) {\n ctx.reply('role select')\n },\n})\n")),(0,a.kt)("p",null,"In addition, commandModules with ContextMenus have been renamed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- CommandType.MenuUser, CommandType.MenuMsg \n+ CommandType.CtxUser, CommandType.CtxMsg\n")),(0,a.kt)("h2",{id:"typings-simplification"},"Typings Simplification"),(0,a.kt)("p",null,"Pre 2.0: "),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1038577974829666386/image.png"}),(0,a.kt)("br",null)," ",(0,a.kt)("br",null)," ",(0,a.kt)("br",null),"Post 2.0:",(0,a.kt)("br",null),(0,a.kt)("img",{src:"https://cdn.discordapp.com/attachments/820348341358952550/1052623728489550015/image.png"}),(0,a.kt)("p",null,"CommandPlugin"," and EventPlugin"," typings have also been static'ified, transformed from types to interfaces"),(0,a.kt)("h2",{id:"breaking-changes"},"Breaking Changes"),(0,a.kt)("img",{src:"https://img.srizan.dev/Discord_z8Sn1UBfEe.png"}),(0,a.kt)("br",null),"All deprecation warnings from previous versions have taken effect, and are removed in 2.0.",(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- type Module = EventModule | CommandModule\n+ type AnyModule = EventModule | CommandModule\n\n-export type SpreadParams unknown> = (\n- args: Parameters[number],\n- ) => unknown;\n")),(0,a.kt)("p",null,"Override type has been removed due to redundancy"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- discord.js : 14.5\n+ discord.js : 14.7\n\n-typescript: 4.7\n+ typescript: 4.9\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ interface Wrapper {\n+ readonly defaultPrefix?: string;\n+ readonly commands: string;\n+ readonly events?: string;\n+ readonly containerConfig : {\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\n+ }\n+}\n\n- interface Wrapper {\n- readonly client: Client;\n- readonly sernEmitter?: SernEmitter;\n- readonly defaultPrefix?: string;\n- readonly commands: string;\n- readonly events?:\n- | string\n- | { mod: EventModule; absPath: string }[]\n- | (() => { mod: EventModule; absPath: string }[]);\n-}\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"+ DefaultLogger\n+ DefaultModuleManager\n+ SernEmitter\n+ DefaultErrorHandling\n+ type Singleton = () => T\n+ type Transient = () => () => T; \n+ type LogPayload = { message: T }\n+ export const single = () => T\n+ export const many = () => () => T\n")),(0,a.kt)("p",null,"Including the previous section, some names to symbols and data structures were altered to\nbe better represented. view ",(0,a.kt)("a",{parentName:"p",href:"/404.html"},"changelog")),(0,a.kt)("h2",{id:"context-refactoring"},"Context refactoring"),(0,a.kt)("p",null,"The context data structure has been internally altered to represent its dynamics better."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/tr/assets/js/c103c7fb.cc83e030.js b/tr/assets/js/c103c7fb.295c9c95.js similarity index 50% rename from tr/assets/js/c103c7fb.cc83e030.js rename to tr/assets/js/c103c7fb.295c9c95.js index 595bcc735..dc2e5ed17 100644 --- a/tr/assets/js/c103c7fb.cc83e030.js +++ b/tr/assets/js/c103c7fb.295c9c95.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[4918],{7527:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/tr/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"12 Ocak 2023","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/tr/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/tr/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"13 Aral\u0131k 2022","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/tr/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/tr/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/tr/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"30 Eyl\xfcl 2022","tags":[{"label":"guides","permalink":"/tr/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/tr/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/tr/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/tr/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"28 Eyl\xfcl 2022","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/tr/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file +"use strict";(self.webpackChunk_sern_website=self.webpackChunk_sern_website||[]).push([[4918],{7527:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"2.5.0","metadata":{"permalink":"/tr/blog/2.5.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2023-01-12-mdx-blog-post.md","source":"@site/blog/2023-01-12-mdx-blog-post.md","title":"Release 2.5.0","description":"2.5 Release","date":"2023-01-12T00:00:00.000Z","formattedDate":"12 Ocak 2023","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":0.895,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.5.0","title":"Release 2.5.0","authors":["jacoobes"],"tags":["release"]},"nextItem":{"title":"Release 2.0.0","permalink":"/tr/blog/2.0.0"}},"content":"## 2.5 Release\\n\\n### Join our [discord](https://sern.dev/discord)
\\n- Thank you for using sern in your projects. It\'s only going to get better!\\n- I apologize for the sudden small breaking change. After this update, there won\'t be any for a while.\\nWow! We\'re increasing our semantic versioning by `+0.3.9`
\\nWhat does this mean?\\n### Breaking changes\\n- [controller](../docs/api/modules#controller) parameter for plugins has been removed\\n - You\'ll need to import it instead\\n - This **breaks** old [CommandPlugin](../docs/api/interfaces/CommandPlugin), but **not** old [EventPlugin](../docs/api/interfaces/EventPlugin)\\n### Deprecations\\n- [CommandPlugin](../docs/api/interfaces/CommandPlugin) and [EventPlugin](../docs/api/interfaces/EventPlugin) have been renamed [InitPlugin](../docs/api/interfaces/InitPlugin) and [ControlPlugin](../docs/api/interfaces/ControlPlugin)\\n\\n### Reason\\n- The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.\\n- I realize that this affects all plugins. I have updated all [plugins](https://github.com/sern-handler/awesome-plugins/pull/68) to match these changes\\n- The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings\\n - [CommandControlPlugin](../docs/api/modules#commandcontrolplugin)\\n - [CommandInitPlugin](../docs/api/modules#commandinitplugin)\\n - [EventControlPlugin](../docs/api/modules#eventcontrolplugin)\\n - [EventInitPlugin](../docs/api/modules#eventinitplugin)\\n - [DiscordEventControlPlugin](../docs/api/modules#discordeventcontrolplugin)\\n This will probably be the last breaking change in a while. Thanks for using sern!"},{"id":"2.0.0","metadata":{"permalink":"/tr/blog/2.0.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-12-13-mdx-blog-post.md","source":"@site/blog/2022-12-13-mdx-blog-post.md","title":"Release 2.0.0","description":"2.0 Release","date":"2022-12-13T00:00:00.000Z","formattedDate":"13 Aral\u0131k 2022","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":3.63,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"2.0.0","title":"Release 2.0.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"Release 2.5.0","permalink":"/tr/blog/2.5.0"},"nextItem":{"title":"How to get started with sern!","permalink":"/tr/blog/getting-started"}},"content":"## 2.0 Release\\nJoin our [discord](https://sern.dev/discord)!
\\nWow! We\'re finally increasing our semantic versioning by +`1.7.9.`
\\nWhat does this mean?\\n\\n### Plugin Support for Event Modules\\nYou can now use plugins for event modules. Previous version would throw an error if the \\n`plugins` field was populated.\\n\\n```typescript \\nexport function commandPlTest() : SernEmitterPlugin {\\n return {\\n type: PluginType.Command,\\n execute: ({ mod}, controller) => {\\n if(mod.name === \'module.register\') {\\n console.log(\'Event Module created correctly\')\\n return controller.next()\\n }\\n console.log(\'event name is wrong\')\\n return controller.stop()\\n }\\n }\\n}\\n```\\nApplying this plugin to some `eventModule`: \\n```typescript\\nexport default eventModule({\\n name: \'error\',\\n type: EventType.Sern,\\n plugins: [commandPlTest()],\\n execute(m) {\\n console.log(m)\\n },\\n})\\n```\\n## Dependency Injection and Decoupling\\n\\nThe powerful npm package `iti` decouples sern even more.\\nDecoupling data structures with the Inversion of Control pattern separates data from logic, which will help speed production\\nand make sern even more customizable than before.\\n\\n### How do I start?\\n```typescript title=\\"src/index.ts\\"\\n//With typescript, you can customize / augment your typings.\\ninterface MyDependencies extends Dependencies {\\n \'@sern/client\' : Singleton;\\n \'@sern/logger\' : Singleton\\n}\\n\\nexport const useContainer = Sern.makeDependencies({\\n// exclude: new Set([\'@sern/logger\']), don\'t autofill optional dependencies\\n build: root => root\\n .add({ \'@sern/client\': single(client) }) \\n .add({ \'@sern/logger\': single(new DefaultLogging()) })\\n});\\n\\nSern.init({\\n defaultPrefix: \'!\', // removing defaultPrefix will shut down text commands\\n commands: \'src/commands\',\\n // events: \'src/events\' (optional),\\n containerConfig : {\\n get: useContainer //pass in your dependency getter here\\n }\\n});\\n\\n```\\nUsing the `Sern#makeDependencies` function, inject your dependencies. \\nWe\'ll use specific dependencies that are created with the `@sern/keyword`\\nkey.\\nUsing typescript to display all `keywords` and what they represent:\\n```typescript\\nexport interface Dependencies {\\n \'@sern/client\': Singleton; //Discord Client\\n \'@sern/logger\'?: Singleton; //Logger\\n \'@sern/emitter\': Singleton; //SernEmitter\\n \'@sern/store\' : Singleton; //Stores all Command Modules\\n \'@sern/modules\' : Singleton; //Manages Modules\\n \'@sern/errors\': Singleton; //A Lifetime / Crash Handler\\n}\\n```\\n:::danger\\nSern#addExternal has been deprecated and removed in favor of Sern#makeDependencies\\n:::\\nAt the moment, one optional dependency, `@sern/logger`, exists. If not added explicitly,\\nwe\'ll **autofill** with a [DefaultLogger](https://sern.dev/docs/api/classes/defaultlogging).\\n\\n:::tip\\nIf you don\'t want a logger, add it to the\\n`exclude` field while composing dependencies.\\n:::\\n\\nUse your generated dependency getter `useContainer` (use whatever name you want), access them\\nfrom anywhere.\\n:::note\\nthe function [useContainerRaw](https://sern.dev/docs/api/modules#usecontainerraw) is provided for direct access to dependencies and the internal\\ndata structure. Use this wisely as no guarantees are made and crashes can happen.\\n:::\\n\\nThe `build` field follows [createContainer](https://itijs.org/docs/quick-start#usage) function call.\\n\\n## New CommandTypes\\n2.0 includes all the new role select menus. `CommandType.MenuSelect` has been renamed into\\n`CommandType.StringSelect`. The remaining SelectMenus are\\n`CommandType.RoleSelect`, `CommandType.ChannelSelect`, `CommandType.UserSelect`, `CommandType.MentionableSelect`\\n```typescript title=\\"commands/roleselect.ts\\"\\nexport default commandModule({\\n type: CommandType.RoleSelect,\\n execute(ctx) {\\n ctx.reply(\'role select\')\\n },\\n})\\n```\\nIn addition, commandModules with ContextMenus have been renamed.\\n```diff\\n- CommandType.MenuUser, CommandType.MenuMsg \\n+ CommandType.CtxUser, CommandType.CtxMsg\\n```\\n## Typings Simplification\\nPre 2.0: \\n\\n


\\nPost 2.0:\\n
\\n\\n\\nCommandPlugin and EventPlugin typings have also been static\'ified, transformed from types to interfaces\\n## Breaking Changes\\n\\n
\\nAll deprecation warnings from previous versions have taken effect, and are removed in 2.0.\\n\\n```diff\\n- type Module = EventModule | CommandModule\\n+ type AnyModule = EventModule | CommandModule\\n\\n-export type SpreadParams unknown> = (\\n- args: Parameters[number],\\n- ) => unknown;\\n```\\nOverride type has been removed due to redundancy\\n```diff\\n- discord.js : 14.5\\n+ discord.js : 14.7\\n\\n-typescript: 4.7\\n+ typescript: 4.9\\n```\\n```diff\\n+ interface Wrapper {\\n+ readonly defaultPrefix?: string;\\n+ readonly commands: string;\\n+ readonly events?: string;\\n+ readonly containerConfig : {\\n+ get: (...keys: (keyof Dependencies)[]) => unknown[];\\n+ }\\n+}\\n\\n- interface Wrapper {\\n- readonly client: Client;\\n- readonly sernEmitter?: SernEmitter;\\n- readonly defaultPrefix?: string;\\n- readonly commands: string;\\n- readonly events?:\\n- | string\\n- | { mod: EventModule; absPath: string }[]\\n- | (() => { mod: EventModule; absPath: string }[]);\\n-}\\n```\\n```diff\\n+ DefaultLogger\\n+ DefaultModuleManager\\n+ SernEmitter\\n+ DefaultErrorHandling\\n+ type Singleton = () => T\\n+ type Transient = () => () => T; \\n+ type LogPayload = { message: T }\\n+ export const single = () => T\\n+ export const many = () => () => T\\n```\\nIncluding the previous section, some names to symbols and data structures were altered to\\nbe better represented. view [changelog](/404.html)\\n\\n## Context refactoring\\nThe context data structure has been internally altered to represent its dynamics better."},{"id":"getting-started","metadata":{"permalink":"/tr/blog/getting-started","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-30-mdx-blog-post.md","source":"@site/blog/2022-09-30-mdx-blog-post.md","title":"How to get started with sern!","description":"Hello everyone!","date":"2022-09-30T00:00:00.000Z","formattedDate":"30 Eyl\xfcl 2022","tags":[{"label":"guides","permalink":"/tr/blog/tags/guides"}],"readingTime":1.31,"hasTruncateMarker":false,"authors":[{"name":"Sr Izan","title":"Contributor","url":"https://github.com/SrIzan10","imageURL":"https://github.com/SrIzan10.png","key":"Sr Izan"}],"frontMatter":{"slug":"getting-started","title":"How to get started with sern!","authors":["Sr Izan"],"tags":["guides"]},"prevItem":{"title":"Release 2.0.0","permalink":"/tr/blog/2.0.0"},"nextItem":{"title":"Release 1.2.0","permalink":"/tr/blog/1.2.0"}},"content":"## Hello everyone!\\n\\nI\'m Sr Izan, your fellow user and contributor.\\n\\nToday I\'m going to show you how to get started with sern and all its cool features.\\n\\n### Step 1: Install the CLI.\\n\\nInstall the CLI:\\n```\\nnpm i -g @sern/cli\\n```\\nand then run\\n```\\nsern init\\n```\\n:::tip\\nYou can also run `sern init -y` if you want to use the default options.\\n:::\\n\\nThe CLI is written in Typescript and open-sourced on [Github](https://github.com/sern-handler/cli). (thanks [evo](https://github.com/EvolutionX-10)!)\\n\\n### Step 2: Have some way to store secrets.\\n\\nNormally you\'d need a way to store secrets, and the best way to do that is by installing another package: `dotenv`\\n\\njust `npm i dotenv` in the project folder and add `require(\'dotenv\').config()` to your import section. Then, when you login, `process.env.TOKEN` (or however you have it named on your `.env` file) should do the trick.\\n\\n:::caution\\nIf you\'re using ESM, configure dotenv with `import \'dotenv/config\'` instead of `require(\'dotenv\').config()`.\\n:::\\n\\n### And... that\'s it?\\n\\nYes, that\'s it. Here\'s a little FAQ to get you started. You can also join the [Discord](https://sern-handler.js.org/discord) for any problems.\\n\\n### Extra: Video tutorial!\\n\\n\\n\\n## FAQ\\n\\n**Q**: How do I publish a slash command? \\n**A**: Install the publish extension. Little video: \\n\\n\\n**Q**: Any snippet VSCode extension? \\n**A**: Yeah, just search `sern Snippets` made by a verified publisher called Sr Izan (haha yeah me funny!) \\n\\n**Q**: HEEEELLLPPPP!!!! \\n**A**: Hey, don\'t panic! We\'re here to help so, join the [Discord](https://sern-handler.js.org/discord). We\'re trying to get to 100 members!"},{"id":"1.2.0","metadata":{"permalink":"/tr/blog/1.2.0","editUrl":"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/blog/2022-09-28-mdx-blog-post.md","source":"@site/blog/2022-09-28-mdx-blog-post.md","title":"Release 1.2.0","description":"Class-based modules","date":"2022-09-28T00:00:00.000Z","formattedDate":"28 Eyl\xfcl 2022","tags":[{"label":"release","permalink":"/tr/blog/tags/release"}],"readingTime":1.71,"hasTruncateMarker":false,"authors":[{"name":"jacoobes","title":"Head Dev","url":"https://github.com/jacoobes","imageURL":"https://github.com/jacoobes.png","key":"jacoobes"}],"frontMatter":{"slug":"1.2.0","title":"Release 1.2.0","authors":["jacoobes"],"tags":["release"]},"prevItem":{"title":"How to get started with sern!","permalink":"/tr/blog/getting-started"}},"content":"## Class-based modules\\n\\nToday we\'re announcing the ability to create class based modules!\\nTo get started, install\\n```\\nnpm install @sern/handler@latest\\n```\\n\\nQuick List of changes!\\n- [Class based modules](#class-based-modules)\\n- [Deprecation Warnings](#deprecation-warnings)\\n- [Dependencies update](#dependencies-update)\\n\\n\\n### Class based modules\\nIncorporate class based modules into your project instead of the traditional `commandModule` or `eventModule`\\nExtend the new [CommandExecutable](docs/api/classes/CommandExecutable) or [EventExecutable](docs/api/classes/EventExecutable)\\n```ts title=\\"commands/meaning-of-life.ts\\"\\nimport { CommandType, CommandExecutable, type Args, type Context } from \'@sern/handler\';\\nimport { publish } from \'../plugins/publish.js\';\\nimport { serendipityOnly } from \'../plugins/serendipityOnly.js\';\\n\\nexport default class extends CommandExecutable {\\n type = CommandType.Both as const;\\n description = \'What is the meaning of life?\'\\n override onEvent = [\\n serendipityOnly()\\n ];\\n override plugins = [\\n publish(),\\n ];\\n // highlight-next-line\\n execute = async (ctx: Context, args: Args) => {\\n await ctx.reply(\'42\')\\n };\\n}\\n```\\n:::caution\\n\\nexecute must not be a method of the class. It should be as above, a property on the class!\\n\\n:::\\n\\n```ts title=\\"events/guildMemberAdd.ts\\"\\nimport { CommandType, EventExecutable, type EventType } from \'@sern/handler\';\\nimport type { GuildMember } from \'discord.js\'\\n\\nexport default class extends EventExecutable {\\n type = EventType.Discord as const;\\n // highlight-next-line\\n execute = (member: GuildMember) => {\\n console.log(member)\\n };\\n}\\n```\\nNow, you might ask **why** this feature was added.
Simply put, to give flexibility to the developers.\\nI believe that you should build your own structures however you might like and customize to your liking.\\nIn addition, **decorators now unofficially work with modules!**\\nFeel free to use TypeScript experimental decorators to augment and customize your classes. \\n\\n### Deprecation Warnings\\nThe next update will bring sern v2 with some important features. Here are some things to watch out for.\\n\\n- [Wrapper#client](docs/api/interfaces/Wrapper) will be deprecated\\n- [Wrapper#sernEmitter](docs/api/interfaces/Wrapper) will be deprecated\\n - a SernEmitter will be automatically created once Sern#init is called\\n- The option to pass in a function or array for [Wrapper#events](docs/api/interfaces/Wrapper) will be deprecated. Only strings are accepted.\\n- [Sern#addExternal](docs/api/classes/SernEmitter) will be deprecated in favor of a better way.\\n\\n### Dependencies Update\\n- TypeScript has been updated to 4.8.3\\n- Discord.js has been upgraded to 14.5"}]}')}}]); \ No newline at end of file diff --git a/tr/assets/js/runtime~main.48e9d178.js b/tr/assets/js/runtime~main.bd95b748.js similarity index 97% rename from tr/assets/js/runtime~main.48e9d178.js rename to tr/assets/js/runtime~main.bd95b748.js index 75766e535..7534ad203 100644 --- a/tr/assets/js/runtime~main.48e9d178.js +++ b/tr/assets/js/runtime~main.bd95b748.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1472:"cf183316",1505:"7c2ff145",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2165:"26739013",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",2792:"f50fe504",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4901:"6e015ab1",4918:"c103c7fb",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7453:"4b098d2e",7597:"5e8c322a",7705:"b40a3c0d",7749:"462b6925",7750:"3a2d3092",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",8938:"59284627",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9232:"afe88353",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"24efdafc",65:"f510da2f",277:"bbd90c09",301:"6fb3727a",332:"9d800187",371:"7619fb56",681:"0305d049",703:"88d5799a",1003:"aabb8fa6",1036:"4256ffad",1198:"c7602d10",1472:"bc033c27",1505:"ac336ebd",2005:"988e020d",2072:"d439a66b",2129:"1989886f",2165:"40911282",2197:"c55750a8",2255:"ccac9ffd",2529:"824aaa15",2535:"41a5b1c9",2640:"6512f1aa",2792:"75e7e6f6",3012:"b31ee531",3045:"cb4f8a25",3085:"8c38cce5",3089:"41e3be1f",3173:"652e1420",3247:"e1f6f0e3",3255:"7ae05c18",3462:"eeb2dd31",3608:"66639242",3650:"6595b6c7",3864:"a632ed02",4e3:"d3432ec7",4009:"e6810844",4013:"e1f6e46d",4137:"e6336864",4195:"e4059570",4252:"d195b545",4332:"40f1fab2",4429:"5ef6fba3",4461:"444e203b",4626:"8b7b233f",4781:"894e9187",4803:"a0a46979",4865:"e45cc536",4901:"a4722255",4918:"cc83e030",4932:"8a2f4e9d",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"78dbca29",5502:"f04bb058",5853:"52b0f2f5",6054:"7d8f5897",6103:"7974c41a",6146:"cd167ef6",6270:"271ea21e",6276:"7ce07f68",6322:"e5ba72de",6393:"e6920a0f",6552:"fd10b8ae",6777:"45f78fdb",6778:"8e41627d",6851:"b46d67f4",7127:"c270e52b",7223:"290935e6",7254:"0c6b8361",7306:"d11dd528",7363:"508193e4",7374:"b7f5d35f",7414:"28b43cb8",7453:"c0531356",7540:"0456e07a",7597:"04b90aad",7705:"7f02429b",7749:"ff49ed30",7750:"339afe92",7833:"a6b3589f",7868:"9cb5e8e9",7918:"3625818f",7936:"e7a0f6f8",8032:"b05158cc",8046:"232bd9f4",8494:"bb52c90b",8610:"d7a7cd5d",8652:"42db8687",8902:"a4e1e1de",8938:"8c214108",9012:"1d47f737",9107:"a06283ec",9187:"a51f0611",9226:"bef7fee6",9232:"d0e1f2ac",9248:"d7a67187",9476:"b762485d",9514:"b1e810d5",9671:"1e321d7c",9712:"a2af70f7",9881:"5473d8a2"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="@sern/website:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/tr/",r.gca=function(e){return e={17896441:"7918",26739013:"2165",53944420:"3255",59284627:"8938",67348500:"2072","5bc4ccbc":"53","2f13d849":"65",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198",cf183316:"1472","7c2ff145":"1505","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640",f50fe504:"2792","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865","6e015ab1":"4901",c103c7fb:"4918",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","4b098d2e":"7453","5e8c322a":"7597",b40a3c0d:"7705","462b6925":"7749","3a2d3092":"7750","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226",afe88353:"9232","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({53:"5bc4ccbc",65:"2f13d849",277:"c4348237",301:"5ae130ee",332:"73bd57bd",371:"edc18331",681:"f1cc380d",703:"981f6151",1003:"67e3e25a",1036:"c0846785",1198:"476a0444",1472:"cf183316",1505:"7c2ff145",2005:"1ac1bfe9",2072:"67348500",2129:"1c127a4d",2165:"26739013",2197:"935f2afb",2255:"beef0c9d",2535:"814f3328",2640:"a96c96b0",2792:"f50fe504",3012:"3a25b5a8",3045:"888566f1",3085:"1f391b9e",3089:"a6aa9e1f",3173:"2caf5b7a",3247:"7f2ac8b7",3255:"53944420",3462:"6ff82968",3608:"9e4087bc",3650:"425cbb82",3864:"57fe7727",4e3:"701614d9",4009:"79e7cc44",4013:"01a85c17",4137:"1aef51bd",4195:"c4f5d8e4",4252:"8a062262",4332:"6c624b4c",4429:"eea0bf40",4461:"a3030d1c",4626:"d9ea5336",4781:"e2a53654",4803:"9201de17",4865:"e8e3d8c7",4901:"6e015ab1",4918:"c103c7fb",4932:"a0fd2c7a",5062:"69369ae2",5397:"312c2bc5",5433:"9f1290f8",5502:"9b620520",5853:"447d9066",6054:"7cd974c8",6103:"ccc49370",6146:"608ca171",6270:"e4877132",6276:"4e28a08b",6322:"a5467962",6393:"e04ffa77",6552:"a0b9ee13",6777:"720cd117",6778:"85456a26",6851:"4279c33d",7127:"7e205c4a",7223:"3020eeee",7254:"97c22b42",7306:"f6aebfbf",7363:"26f1f3a5",7374:"6ba1d2c1",7414:"393be207",7453:"4b098d2e",7597:"5e8c322a",7705:"b40a3c0d",7749:"462b6925",7750:"3a2d3092",7833:"65578b65",7868:"7343edf0",7918:"17896441",7936:"3a0cb3a9",8032:"1b0c702f",8046:"c606405e",8494:"0a33f845",8610:"6875c492",8652:"bcd9df7e",8902:"a4d0ee3e",8938:"59284627",9012:"3f83d40d",9107:"82cdda05",9187:"295686f2",9226:"707baeff",9232:"afe88353",9248:"9693de07",9476:"90fdad0c",9514:"1be78505",9671:"0e384e19",9712:"3dc7c79a",9881:"f7831d67"}[e]||e)+"."+{53:"24efdafc",65:"f510da2f",277:"bbd90c09",301:"6fb3727a",332:"9d800187",371:"7619fb56",681:"0305d049",703:"88d5799a",1003:"aabb8fa6",1036:"4256ffad",1198:"c7602d10",1472:"bc033c27",1505:"ac336ebd",2005:"988e020d",2072:"8dca85ed",2129:"1989886f",2165:"40911282",2197:"c55750a8",2255:"ccac9ffd",2529:"824aaa15",2535:"41a5b1c9",2640:"6512f1aa",2792:"75e7e6f6",3012:"8df251cf",3045:"cb4f8a25",3085:"8c38cce5",3089:"41e3be1f",3173:"652e1420",3247:"e1f6f0e3",3255:"7ae05c18",3462:"eeb2dd31",3608:"66639242",3650:"6595b6c7",3864:"a632ed02",4e3:"d3432ec7",4009:"e6810844",4013:"e1f6e46d",4137:"e6336864",4195:"e4059570",4252:"d195b545",4332:"40f1fab2",4429:"5ef6fba3",4461:"444e203b",4626:"8b7b233f",4781:"894e9187",4803:"a0a46979",4865:"e45cc536",4901:"a4722255",4918:"295c9c95",4932:"8a2f4e9d",4972:"8f7e7193",5062:"40f3e7eb",5397:"1cae9e75",5433:"78dbca29",5502:"f04bb058",5853:"52b0f2f5",6054:"7d8f5897",6103:"7974c41a",6146:"cd167ef6",6270:"271ea21e",6276:"7ce07f68",6322:"e5ba72de",6393:"e6920a0f",6552:"fd10b8ae",6777:"45f78fdb",6778:"8e41627d",6851:"b46d67f4",7127:"c270e52b",7223:"290935e6",7254:"0c6b8361",7306:"d11dd528",7363:"508193e4",7374:"b7f5d35f",7414:"28b43cb8",7453:"c0531356",7540:"0456e07a",7597:"04b90aad",7705:"7f02429b",7749:"ff49ed30",7750:"339afe92",7833:"a6b3589f",7868:"9cb5e8e9",7918:"3625818f",7936:"e7a0f6f8",8032:"b05158cc",8046:"232bd9f4",8494:"bb52c90b",8610:"d7a7cd5d",8652:"42db8687",8902:"a4e1e1de",8938:"8c214108",9012:"1d47f737",9107:"a06283ec",9187:"a51f0611",9226:"bef7fee6",9232:"d0e1f2ac",9248:"d7a67187",9476:"b762485d",9514:"b1e810d5",9671:"1e321d7c",9712:"a2af70f7",9881:"5473d8a2"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="@sern/website:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/tr/",r.gca=function(e){return e={17896441:"7918",26739013:"2165",53944420:"3255",59284627:"8938",67348500:"2072","5bc4ccbc":"53","2f13d849":"65",c4348237:"277","5ae130ee":"301","73bd57bd":"332",edc18331:"371",f1cc380d:"681","981f6151":"703","67e3e25a":"1003",c0846785:"1036","476a0444":"1198",cf183316:"1472","7c2ff145":"1505","1ac1bfe9":"2005","1c127a4d":"2129","935f2afb":"2197",beef0c9d:"2255","814f3328":"2535",a96c96b0:"2640",f50fe504:"2792","3a25b5a8":"3012","888566f1":"3045","1f391b9e":"3085",a6aa9e1f:"3089","2caf5b7a":"3173","7f2ac8b7":"3247","6ff82968":"3462","9e4087bc":"3608","425cbb82":"3650","57fe7727":"3864","701614d9":"4000","79e7cc44":"4009","01a85c17":"4013","1aef51bd":"4137",c4f5d8e4:"4195","8a062262":"4252","6c624b4c":"4332",eea0bf40:"4429",a3030d1c:"4461",d9ea5336:"4626",e2a53654:"4781","9201de17":"4803",e8e3d8c7:"4865","6e015ab1":"4901",c103c7fb:"4918",a0fd2c7a:"4932","69369ae2":"5062","312c2bc5":"5397","9f1290f8":"5433","9b620520":"5502","447d9066":"5853","7cd974c8":"6054",ccc49370:"6103","608ca171":"6146",e4877132:"6270","4e28a08b":"6276",a5467962:"6322",e04ffa77:"6393",a0b9ee13:"6552","720cd117":"6777","85456a26":"6778","4279c33d":"6851","7e205c4a":"7127","3020eeee":"7223","97c22b42":"7254",f6aebfbf:"7306","26f1f3a5":"7363","6ba1d2c1":"7374","393be207":"7414","4b098d2e":"7453","5e8c322a":"7597",b40a3c0d:"7705","462b6925":"7749","3a2d3092":"7750","65578b65":"7833","7343edf0":"7868","3a0cb3a9":"7936","1b0c702f":"8032",c606405e:"8046","0a33f845":"8494","6875c492":"8610",bcd9df7e:"8652",a4d0ee3e:"8902","3f83d40d":"9012","82cdda05":"9107","295686f2":"9187","707baeff":"9226",afe88353:"9232","9693de07":"9248","90fdad0c":"9476","1be78505":"9514","0e384e19":"9671","3dc7c79a":"9712",f7831d67:"9881"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n Blog | sern - Handlers. Redefined. - + @@ -28,7 +28,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 dakikalık okuma
Sr Izan

Hello everyone!

I'm Sr Izan, your fellow user and contributor.

Today I'm going to show you how to get started with sern and all its cool features.

Step 1: Install the CLI.

Install the CLI:

npm i -g @sern/cli

and then run

sern init
tip

You can also run sern init -y if you want to use the default options.

The CLI is written in Typescript and open-sourced on Github. (thanks evo!)

Step 2: Have some way to store secrets.

Normally you'd need a way to store secrets, and the best way to do that is by installing another package: dotenv

just npm i dotenv in the project folder and add require('dotenv').config() to your import section. Then, when you login, process.env.TOKEN (or however you have it named on your .env file) should do the trick.

caution

If you're using ESM, configure dotenv with import 'dotenv/config' instead of require('dotenv').config().

And... that's it?

Yes, that's it. Here's a little FAQ to get you started. You can also join the Discord for any problems.

Extra: Video tutorial!

FAQ

Q: How do I publish a slash command?
A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
@@ -38,7 +38,7 @@ Extend the new CommandExecutabl I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/tr/blog/1.2.0.html b/tr/blog/1.2.0.html index 59c5e7617..5c78771bb 100644 --- a/tr/blog/1.2.0.html +++ b/tr/blog/1.2.0.html @@ -6,7 +6,7 @@ Release 1.2.0 | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ Extend the new CommandExec I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/tr/blog/2.0.0.html b/tr/blog/2.0.0.html index 373fe7985..69147a1d5 100644 --- a/tr/blog/2.0.0.html +++ b/tr/blog/2.0.0.html @@ -6,7 +6,7 @@ Release 2.0.0 | sern - Handlers. Redefined. - + @@ -25,9 +25,9 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

- + \ No newline at end of file diff --git a/tr/blog/2.5.0.html b/tr/blog/2.5.0.html index ac1d19368..35ff7586d 100644 --- a/tr/blog/2.5.0.html +++ b/tr/blog/2.5.0.html @@ -6,7 +6,7 @@ Release 2.5.0 | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ Wow! We're increasing our semantic versioning by +0.3.9
What does this mean?

Breaking changes

Deprecations

Reason

  • The naming of plugins was getting too complex. For example, plugin naming evolved into CommandModuleCommandPlugin, CommandModuleEventPlugin and more.
  • I realize that this affects all plugins. I have updated all plugins to match these changes
  • The old way of declaring plugins has been deprecated in favor of newer functions that facilitate and ease typings
- + \ No newline at end of file diff --git a/tr/blog/archive.html b/tr/blog/archive.html index 40a86d71f..f7f424d41 100644 --- a/tr/blog/archive.html +++ b/tr/blog/archive.html @@ -6,13 +6,13 @@ Arşiv | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/blog/atom.xml b/tr/blog/atom.xml index 2ebebe77f..0037c2af6 100644 --- a/tr/blog/atom.xml +++ b/tr/blog/atom.xml @@ -43,7 +43,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> jacoobes diff --git a/tr/blog/getting-started.html b/tr/blog/getting-started.html index 349db25d9..3d71b2434 100644 --- a/tr/blog/getting-started.html +++ b/tr/blog/getting-started.html @@ -6,7 +6,7 @@ How to get started with sern! | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/tr/blog/rss.xml b/tr/blog/rss.xml index 66d93a5b4..e88fb271e 100644 --- a/tr/blog/rss.xml +++ b/tr/blog/rss.xml @@ -40,7 +40,7 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

]]> release diff --git a/tr/blog/tags.html b/tr/blog/tags.html index 383f9ddde..04060c769 100644 --- a/tr/blog/tags.html +++ b/tr/blog/tags.html @@ -6,13 +6,13 @@ Etiketler | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/blog/tags/guides.html b/tr/blog/tags/guides.html index 5f01452a4..11f500b8e 100644 --- a/tr/blog/tags/guides.html +++ b/tr/blog/tags/guides.html @@ -6,7 +6,7 @@ "guides" ile etiketlenmiş Bir gönderi | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ A: Install the publish extension. Little video:

Q: Any snippet VSCode extension?
A: Yeah, just search sern Snippets made by a verified publisher called Sr Izan (haha yeah me funny!)

Q: HEEEELLLPPPP!!!!
A: Hey, don't panic! We're here to help so, join the Discord. We're trying to get to 100 members!

- + \ No newline at end of file diff --git a/tr/blog/tags/release.html b/tr/blog/tags/release.html index a48aea45c..dab93602c 100644 --- a/tr/blog/tags/release.html +++ b/tr/blog/tags/release.html @@ -6,7 +6,7 @@ "release" ile etiketlenmiş 3 gönderi | sern - Handlers. Redefined. - + @@ -28,14 +28,14 @@ we'll autofill with a
note

the function useContainerRaw is provided for direct access to dependencies and the internal data structure. Use this wisely as no guarantees are made and crashes can happen.

The build field follows createContainer function call.

New CommandTypes

2.0 includes all the new role select menus. CommandType.MenuSelect has been renamed into CommandType.StringSelect. The remaining SelectMenus are -CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to +CommandType.RoleSelect, CommandType.ChannelSelect, CommandType.UserSelect, CommandType.MentionableSelect

commands/roleselect.ts
export default commandModule({
type: CommandType.RoleSelect,
execute(ctx) {
ctx.reply('role select')
},
})

In addition, commandModules with ContextMenus have been renamed.

- CommandType.MenuUser, CommandType.MenuMsg 
+ CommandType.CtxUser, CommandType.CtxMsg

Typings Simplification

Pre 2.0:




Post 2.0:

CommandPlugin<T> and EventPlugin<T> typings have also been static'ified, transformed from types to interfaces

Breaking Changes


All deprecation warnings from previous versions have taken effect, and are removed in 2.0.
- type Module = EventModule | CommandModule
+ type AnyModule = EventModule | CommandModule

-export type SpreadParams<T extends (...args: never) => unknown> = (
- args: Parameters<T>[number],
- ) => unknown;

Override type has been removed due to redundancy

- discord.js : 14.5
+ discord.js : 14.7

-typescript: 4.7
+ typescript: 4.9
+ interface Wrapper {
+ readonly defaultPrefix?: string;
+ readonly commands: string;
+ readonly events?: string;
+ readonly containerConfig : {
+ get: (...keys: (keyof Dependencies)[]) => unknown[];
+ }
+}

- interface Wrapper {
- readonly client: Client;
- readonly sernEmitter?: SernEmitter;
- readonly defaultPrefix?: string;
- readonly commands: string;
- readonly events?:
- | string
- | { mod: EventModule; absPath: string }[]
- | (() => { mod: EventModule; absPath: string }[]);
-}
+ DefaultLogger
+ DefaultModuleManager
+ SernEmitter
+ DefaultErrorHandling
+ type Singleton<T> = () => T
+ type Transient<T> = () => () => T;
+ type LogPayload<T = unknown> = { message: T }
+ export const single = <T>() => T
+ export const many = <T>() => () => T

Including the previous section, some names to symbols and data structures were altered to be better represented. view changelog

Context refactoring

The context data structure has been internally altered to represent its dynamics better.

· 2 dakikalık okuma
jacoobes

Class-based modules

Today we're announcing the ability to create class based modules! To get started, install

npm install @sern/handler@latest

Quick List of changes!

Class based modules

Incorporate class based modules into your project instead of the traditional commandModule or eventModule Extend the new CommandExecutable or EventExecutable

commands/meaning-of-life.ts
import { CommandType, CommandExecutable, type Args, type Context } from '@sern/handler';
import { publish } from '../plugins/publish.js';
import { serendipityOnly } from '../plugins/serendipityOnly.js';

export default class extends CommandExecutable<CommandType.Both> {
type = CommandType.Both as const;
description = 'What is the meaning of life?'
override onEvent = [
serendipityOnly()
];
override plugins = [
publish(),
];
execute = async (ctx: Context, args: Args) => {
await ctx.reply('42')
};
}
caution

execute must not be a method of the class. It should be as above, a property on the class!

events/guildMemberAdd.ts
import { CommandType, EventExecutable, type EventType } from '@sern/handler';
import type { GuildMember } from 'discord.js'

export default class extends EventExecutable<EventType.Discord> {
type = EventType.Discord as const;
execute = (member: GuildMember) => {
console.log(member)
};
}

Now, you might ask why this feature was added.
Simply put, to give flexibility to the developers. I believe that you should build your own structures however you might like and customize to your liking. In addition, decorators now unofficially work with modules! Feel free to use TypeScript experimental decorators to augment and customize your classes.

Deprecation Warnings

The next update will bring sern v2 with some important features. Here are some things to watch out for.

Dependencies Update

  • TypeScript has been updated to 4.8.3
  • Discord.js has been upgraded to 14.5
- + \ No newline at end of file diff --git a/tr/docs/api.html b/tr/docs/api.html index 24f8f7644..b1b85a324 100644 --- a/tr/docs/api.html +++ b/tr/docs/api.html @@ -6,13 +6,13 @@ @sern/handler | sern - Handlers. Redefined. - +

@sern/handler

Handlers. Redefined.

A customizable, batteries-included, powerful discord.js framework to streamline bot development.

NPM versionNPM downloadsLicense MITdocs.rsLines of code

📜 Installation

npm install @sern/handler
yarn add @sern/handler
pnpm add @sern/handler

Why?

  • Most handlers don't support discord.js 14.7+
  • Customizable commands
  • Plug and play or customize to your liking
  • Embraces reactive programming for consistent and reliable backend
  • Customizable logger, error handling, and more
  • Active development and growing community

👀 Quick Look

  • Support for discord.js v14 and all interactions
  • Hybrid commands
  • Lightweight and customizable
  • ESM, CommonJS and TypeScript support
  • A powerful CLI and awesome community-made plugins

👶 Basic Usage

index.js (CommonJS)

// Import the discord.js Client and GatewayIntentBits
const { Client, GatewayIntentBits } = require('discord.js');

// Import Sern namespace
const { Sern } = require('@sern/handler');

// Our configuration file
const { defaultPrefix, token } = require('./config.json');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages
]
});
export const useContainer = Sern.makeDependencies({
build: root => root
.add({ '@sern/client': single(client) })
.add({ '@sern/logger': single(new DefaultLogging()) })
});

//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
containerConfig : {
get: useContainer
}
});

client.login(token);

ping.js (CommonJS)

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
name: 'ping',
description: 'A ping pong command',
type: CommandType.Slash,
execute(ctx) {
ctx.reply('pong!');
}
});

See our templates for TypeScript examples and more.

💻 CLI

It is highly encouraged to use the command line interface for your project. Don't forget to view it.

👋 Contribute

  • Read our contribution guidelines carefully
  • Pull up on issues and report bugs
  • All kinds of contributions are welcomed.

🚈 Roadmap

You can check our roadmap to see what's going to be added or patched in the future.

- + \ No newline at end of file diff --git a/tr/docs/api/classes/CommandExecutable.html b/tr/docs/api/classes/CommandExecutable.html index 003b40e0e..eadf62c7c 100644 --- a/tr/docs/api/classes/CommandExecutable.html +++ b/tr/docs/api/classes/CommandExecutable.html @@ -6,13 +6,13 @@ Class: CommandExecutable<Type> | sern - Handlers. Redefined. - +

Class: CommandExecutable<Type>

Experimental

Will be refactored / changed in future

Type parameters

NameType
Typeextends CommandType

Constructors

constructor

new CommandExecutable<Type>()

Type parameters

NameType
Typeextends CommandType

Properties

execute

Abstract execute: CommandModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:121


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:120


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:119


type

Abstract type: Type

Defined in

src/handler/sern.ts:118

- + \ No newline at end of file diff --git a/tr/docs/api/classes/Context.html b/tr/docs/api/classes/Context.html index 9324adab2..1dbf77bb8 100644 --- a/tr/docs/api/classes/Context.html +++ b/tr/docs/api/classes/Context.html @@ -6,7 +6,7 @@ Class: Context | sern - Handlers. Redefined. - + @@ -18,7 +18,7 @@ Message

Returns CommandType.Slash or the event fired in a Both command was ChatInputCommandInteraction

Returns

Message<boolean>

Defined in

src/handler/structures/context.ts:29


user

get user(): User

If context is holding a message, message.author else, interaction.user

Returns

User

Defined in

src/handler/structures/context.ts:52

Methods

isMessage

isMessage(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:82


isSlash

isSlash(): boolean

Returns

boolean

Defined in

src/handler/structures/context.ts:86


reply

reply(content): Promise<Message<boolean>>

Parameters

NameType
contentReplyOptions

Returns

Promise<Message<boolean>>

Defined in

src/handler/structures/context.ts:97


wrap

Static wrap(wrappable): Context

Parameters

NameType
wrappableMessage<boolean> | ChatInputCommandInteraction<CacheType>

Returns

Context

Defined in

src/handler/structures/context.ts:90

- + \ No newline at end of file diff --git a/tr/docs/api/classes/DefaultErrorHandling.html b/tr/docs/api/classes/DefaultErrorHandling.html index 690fe3e20..504c0ea1c 100644 --- a/tr/docs/api/classes/DefaultErrorHandling.html +++ b/tr/docs/api/classes/DefaultErrorHandling.html @@ -6,13 +6,13 @@ Class: DefaultErrorHandling | sern - Handlers. Redefined. - +

Class: DefaultErrorHandling

Implements

Constructors

constructor

new DefaultErrorHandling()

Properties

keepAlive

keepAlive: number = 5

Number of times the process should throw an error until crashing and exiting

Implementation of

ErrorHandling.keepAlive

Defined in

src/handler/contracts/errorHandling.ts:24

Methods

crash

crash(error): never

Utility function to crash

Parameters

NameType
errorError

Returns

never

Implementation of

ErrorHandling.crash

Defined in

src/handler/contracts/errorHandling.ts:25


updateAlive

updateAlive(e): void

A function that is called on every crash. Updates keepAlive

Parameters

NameType
eError

Returns

void

Implementation of

ErrorHandling.updateAlive

Defined in

src/handler/contracts/errorHandling.ts:28

- + \ No newline at end of file diff --git a/tr/docs/api/classes/DefaultLogging.html b/tr/docs/api/classes/DefaultLogging.html index 998f3eb23..9b7f51427 100644 --- a/tr/docs/api/classes/DefaultLogging.html +++ b/tr/docs/api/classes/DefaultLogging.html @@ -6,13 +6,13 @@ Class: DefaultLogging | sern - Handlers. Redefined. - +

Class: DefaultLogging

Implements

Constructors

constructor

new DefaultLogging()

Methods

date

Private date(): Date

Returns

Date

Defined in

src/handler/contracts/logging.ts:11


debug

debug(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.debug

Defined in

src/handler/contracts/logging.ts:12


error

error(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.error

Defined in

src/handler/contracts/logging.ts:16


info

info(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.info

Defined in

src/handler/contracts/logging.ts:20


warning

warning(payload): void

Parameters

NameType
payloadLogPayload<unknown>

Returns

void

Implementation of

Logging.warning

Defined in

src/handler/contracts/logging.ts:24

- + \ No newline at end of file diff --git a/tr/docs/api/classes/DefaultModuleManager.html b/tr/docs/api/classes/DefaultModuleManager.html index 3eddd2a10..dd5ac8d82 100644 --- a/tr/docs/api/classes/DefaultModuleManager.html +++ b/tr/docs/api/classes/DefaultModuleManager.html @@ -6,13 +6,13 @@ Class: DefaultModuleManager | sern - Handlers. Redefined. - +

Class: DefaultModuleManager

Implements

Constructors

constructor

new DefaultModuleManager(moduleStore)

Parameters

NameType
moduleStoreModuleStore

Defined in

src/handler/contracts/moduleManager.ts:13

Methods

get

get<T>(strat): undefined | Processed<CommandModuleDefs[T]>

Type parameters

NameType
Textends CommandType

Parameters

NameType
strat(ms: ModuleStore) => undefined | Processed<CommandModuleDefs[T]>

Returns

undefined | Processed<CommandModuleDefs[T]>

Implementation of

ModuleManager.get

Defined in

src/handler/contracts/moduleManager.ts:14


set

set(strat): void

Parameters

NameType
strat(ms: ModuleStore) => void

Returns

void

Implementation of

ModuleManager.set

Defined in

src/handler/contracts/moduleManager.ts:20

- + \ No newline at end of file diff --git a/tr/docs/api/classes/EventExecutable.html b/tr/docs/api/classes/EventExecutable.html index 451068b04..064a174e9 100644 --- a/tr/docs/api/classes/EventExecutable.html +++ b/tr/docs/api/classes/EventExecutable.html @@ -6,13 +6,13 @@ Class: EventExecutable<Type> | sern - Handlers. Redefined. - +

Class: EventExecutable<Type>

Experimental

Will be refactored in future

Type parameters

NameType
Typeextends EventType

Constructors

constructor

new EventExecutable<Type>()

Type parameters

NameType
Typeextends EventType

Properties

execute

Abstract execute: EventModuleDefs[Type][``"execute"``]

Defined in

src/handler/sern.ts:130


onEvent

onEvent: ControlPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:129


plugins

plugins: InitPlugin<any[]>[] = []

Defined in

src/handler/sern.ts:128


type

Abstract type: Type

Defined in

src/handler/sern.ts:127

- + \ No newline at end of file diff --git a/tr/docs/api/classes/ModuleStore.html b/tr/docs/api/classes/ModuleStore.html index af0eac5a7..3b3d3cee9 100644 --- a/tr/docs/api/classes/ModuleStore.html +++ b/tr/docs/api/classes/ModuleStore.html @@ -6,14 +6,14 @@ Class: ModuleStore | sern - Handlers. Redefined. - +

Class: ModuleStore

Storing all command modules This dependency is usually injected into ModuleManager

Constructors

constructor

new ModuleStore()

Properties

ApplicationCommands

Readonly ApplicationCommands: Object

Type declaration

NameType
1Map<string, Processed<CommandModule>>
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:11


BothCommands

Readonly BothCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:10


InteractionHandlers

Readonly InteractionHandlers: Object

Type declaration

NameType
2Map<string, Processed<CommandModule>>
3Map<string, Processed<CommandModule>>
5Map<string, Processed<CommandModule>>
6Map<string, Processed<CommandModule>>
7Map<string, Processed<CommandModule>>
8Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:18


ModalSubmit

Readonly ModalSubmit: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:16


TextCommands

Readonly TextCommands: Map<string, Processed<CommandModule>>

Defined in

src/handler/structures/moduleStore.ts:17

- + \ No newline at end of file diff --git a/tr/docs/api/classes/SernEmitter.html b/tr/docs/api/classes/SernEmitter.html index 2af137f07..fff74ac43 100644 --- a/tr/docs/api/classes/SernEmitter.html +++ b/tr/docs/api/classes/SernEmitter.html @@ -6,7 +6,7 @@ Class: SernEmitter | sern - Handlers. Redefined. - + @@ -50,7 +50,7 @@ given event.

This method is intentionally generic and works with the web p semantics and does not listen to the 'error' event.

const { once, EventEmitter } = require('events');

async function run() {
const ee = new EventEmitter();

process.nextTick(() => {
ee.emit('myevent', 42);
});

const [value] = await once(ee, 'myevent');
console.log(value);

const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});

try {
await once(ee, 'myevent');
} catch (err) {
console.log('error happened', err);
}
}

run();

The special handling of the 'error' event is only used when events.once()is used to wait for another event. If events.once() is used to wait for the 'error' event itself, then it is treated as any other kind of event without special handling:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();

once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.log('error', err.message));

ee.emit('error', new Error('boom'));

// Prints: ok boom

An AbortSignal can be used to cancel waiting for the event:

const { EventEmitter, once } = require('events');

const ee = new EventEmitter();
const ac = new AbortController();

async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}

foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!

Since

v11.13.0, v10.16.0

Parameters

NameType
emitter_NodeEventTarget
eventNamestring | symbol
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:194

Static once(emitter, eventName, options?): Promise<any[]>

Parameters

NameType
emitter_DOMEventTarget
eventNamestring
options?StaticEventEmitterOptions

Returns

Promise<any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:195

Static once<E, K>(eventEmitter, eventName): Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Type parameters

NameType
Eextends __module
Kextends keyof ClientEvents

Parameters

NameType
eventEmitterE
eventNameE extends Client<boolean> ? K : string

Returns

Promise<E extends Client<boolean> ? ClientEvents[K] : any[]>

Inherited from

EventEmitter.once

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:218


payload

Static Private payload<T>(type, module?, reason?): T

Type parameters

NameType
Textends Payload

Parameters

NameType
typePayloadType
module?Module
reason?unknown

Returns

T

Defined in

src/handler/sernEmitter.ts:40


setMaxListeners

Static setMaxListeners(n?, ...eventTargets): void

const {
setMaxListeners,
EventEmitter
} = require('events');

const target = new EventTarget();
const emitter = new EventEmitter();

setMaxListeners(5, target, emitter);

Since

v15.4.0

Parameters

NameTypeDescription
n?numberA non-negative number. The maximum number of listeners per EventTarget event.
...eventTargets(EventEmitter | _DOMEventTarget)[]-

Returns

void

Inherited from

EventEmitter.setMaxListeners

Defined in

node_modules/.pnpm/@types+node@18.11.18/node_modules/@types/node/ts4.8/events.d.ts:317


success

Static success(module): { module: AnyModule ; type: Success } & { type: Success } & never & never

Creates a compliant SernEmitter module success payload

Parameters

NameType
moduleModule

Returns

{ module: AnyModule ; type: Success } & { type: Success } & never & never

Defined in

src/handler/sernEmitter.ts:66


warning

Static warning(reason): never & never & { reason: string ; type: Warning } & { type: Warning }

Creates a compliant SernEmitter module warning payload

Parameters

NameType
reasonunknown

Returns

never & never & { reason: string ; type: Warning } & { type: Warning }

Defined in

src/handler/sernEmitter.ts:76

- + \ No newline at end of file diff --git a/tr/docs/api/enums/CommandType.html b/tr/docs/api/enums/CommandType.html index 4dcb90517..472e5be1b 100644 --- a/tr/docs/api/enums/CommandType.html +++ b/tr/docs/api/enums/CommandType.html @@ -6,13 +6,13 @@ Enumeration: CommandType | sern - Handlers. Redefined. - +

Enumeration: CommandType

A bitfield that discriminates command modules

Example

export default commandModule({
type : CommandType.Text,
name : 'a text command'
execute(message) {
console.log(message.content)
}
})

Enumeration Members

Both

Both = 3

The CommandType for hybrid commands, text and slash

Defined in

src/handler/structures/enums.ts:28


Button

Button = 16

The CommandType for ButtonInteraction commands

Defined in

src/handler/structures/enums.ts:40


ChannelSelect

ChannelSelect = 256

The CommandType for the other SelectMenuInteractions

Defined in

src/handler/structures/enums.ts:52


CtxMsg

CtxMsg = 8

The CommandType for MessageContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:36


CtxUser

CtxUser = 4

The CommandType for UserContextMenuInteraction commands

Defined in

src/handler/structures/enums.ts:32


MentionableSelect

MentionableSelect = 512

Defined in

src/handler/structures/enums.ts:53


Modal = 64

The CommandType for ModalSubmitInteraction commands

Defined in

src/handler/structures/enums.ts:48


RoleSelect

RoleSelect = 1024

Defined in

src/handler/structures/enums.ts:54


Slash

Slash = 2

The CommandType for slash commands

Defined in

src/handler/structures/enums.ts:24


StringSelect

StringSelect = 32

The CommandType for StringSelectMenuInteraction commands

Defined in

src/handler/structures/enums.ts:44


Text

Text = 1

The CommandType for text commands

Defined in

src/handler/structures/enums.ts:20


UserSelect

UserSelect = 2048

Defined in

src/handler/structures/enums.ts:55

- + \ No newline at end of file diff --git a/tr/docs/api/enums/EventType.html b/tr/docs/api/enums/EventType.html index 8d4d0c8f1..088cdf17e 100644 --- a/tr/docs/api/enums/EventType.html +++ b/tr/docs/api/enums/EventType.html @@ -6,14 +6,14 @@ Enumeration: EventType | sern - Handlers. Redefined. - +

Enumeration: EventType

A bitfield that discriminates event modules

Example

export default eventModule({
type : EventType.Discord,
name : 'guildMemberAdd'
execute(member : GuildMember) {
console.log(member)
}
})

Enumeration Members

Discord

Discord = 1

The EventType for handling discord events

Defined in

src/handler/structures/enums.ts:77


External

External = 3

The EventType for handling external events. Could be for example, process events, database events

Defined in

src/handler/structures/enums.ts:86


Sern

Sern = 2

The EventType for handling sern events

Defined in

src/handler/structures/enums.ts:81

- + \ No newline at end of file diff --git a/tr/docs/api/enums/PayloadType.html b/tr/docs/api/enums/PayloadType.html index cd34a7707..27b9f4fb5 100644 --- a/tr/docs/api/enums/PayloadType.html +++ b/tr/docs/api/enums/PayloadType.html @@ -6,13 +6,13 @@ Enumeration: PayloadType | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/enums/PluginType.html b/tr/docs/api/enums/PluginType.html index c0a218c3c..b8c322b60 100644 --- a/tr/docs/api/enums/PluginType.html +++ b/tr/docs/api/enums/PluginType.html @@ -6,13 +6,13 @@ Enumeration: PluginType | sern - Handlers. Redefined. - +

Enumeration: PluginType

A bitfield that discriminates plugins

Example

export default function myPlugin() : EventPlugin<CommandType.Text> {
type : PluginType.Event,
execute([ctx, args], controller) {
return controller.next();
}
}

Enumeration Members

Command

Command = 1

Deprecated

Use PluginType.Init instead

Defined in

src/handler/structures/enums.ts:112


Control

Control = 2

The PluginType for EventPlugins

Defined in

src/handler/structures/enums.ts:121


Event

Event = 2

Deprecated

Use PluginType.Control instead

Defined in

src/handler/structures/enums.ts:117


Init

Init = 1

The PluginType for InitPlugins

Defined in

src/handler/structures/enums.ts:107

- + \ No newline at end of file diff --git a/tr/docs/api/enums/SernError.html b/tr/docs/api/enums/SernError.html index f97d5faaa..b3c727f67 100644 --- a/tr/docs/api/enums/SernError.html +++ b/tr/docs/api/enums/SernError.html @@ -6,14 +6,14 @@ Enumeration: SernError | sern - Handlers. Redefined. - +

Enumeration: SernError

Enumeration Members

InvalidModuleType

InvalidModuleType = "Detected an unknown module type"

Throws when registering an invalid module. This means it is undefined or an invalid command type was provided

Defined in

src/handler/structures/errors.ts:9


MismatchEvent

MismatchEvent = "You cannot use message when an interaction fired or vice versa"

A crash that occurs when accessing an invalid property of Context

Defined in

src/handler/structures/errors.ts:29


MismatchModule

MismatchModule = "A module type mismatched with event emitted!"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:17


MissingRequired

MissingRequired = "@sern/client is required but was not found"

Required Dependency not found

Defined in

src/handler/structures/errors.ts:37


NotSupportedInteraction

NotSupportedInteraction = "This interaction is not supported."

Unsupported interaction at this moment.

Defined in

src/handler/structures/errors.ts:21


NotSupportedYet

NotSupportedYet = "This feature is not supported yet"

Unsupported feature attempted to access at this time

Defined in

src/handler/structures/errors.ts:33


PluginFailure

PluginFailure = "A plugin failed to call controller.next()"

One plugin called controller.stop() (end command execution / loading)

Defined in

src/handler/structures/errors.ts:25


UndefinedModule

UndefinedModule = "A module could not be detected"

Attempted to lookup module in command module store. Nothing was found!

Defined in

src/handler/structures/errors.ts:13

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/AutocompleteCommand.html b/tr/docs/api/interfaces/AutocompleteCommand.html index 179a64377..f7371383b 100644 --- a/tr/docs/api/interfaces/AutocompleteCommand.html +++ b/tr/docs/api/interfaces/AutocompleteCommand.html @@ -6,13 +6,13 @@ Interface: AutocompleteCommand | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/AutocompletePlugin.html b/tr/docs/api/interfaces/AutocompletePlugin.html index b4e1bf700..5db02aad7 100644 --- a/tr/docs/api/interfaces/AutocompletePlugin.html +++ b/tr/docs/api/interfaces/AutocompletePlugin.html @@ -6,13 +6,13 @@ Interface: AutocompletePlugin | sern - Handlers. Redefined. - +

Interface: AutocompletePlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (autocmp: AutocompleteInteraction<CacheType>, controlller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (autocmp, controlller): Awaitable<Result<void, void>>

Parameters
NameType
autocmpAutocompleteInteraction<CacheType>
controlllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:73


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:72

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/BothCommand.html b/tr/docs/api/interfaces/BothCommand.html index b294a1039..bc5c1935c 100644 --- a/tr/docs/api/interfaces/BothCommand.html +++ b/tr/docs/api/interfaces/BothCommand.html @@ -6,13 +6,13 @@ Interface: BothCommand | sern - Handlers. Redefined. - +

Interface: BothCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:57


description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:58


execute

execute: (ctx: Context, args: Args) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
argsArgs
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:60


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:59


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Both

Overrides

Module.type

Defined in

src/types/module.ts:56

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ButtonCommand.html b/tr/docs/api/interfaces/ButtonCommand.html index 423bb19c5..4d5e2dd07 100644 --- a/tr/docs/api/interfaces/ButtonCommand.html +++ b/tr/docs/api/interfaces/ButtonCommand.html @@ -6,13 +6,13 @@ Interface: ButtonCommand | sern - Handlers. Redefined. - +

Interface: ButtonCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ButtonInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxButtonInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:75


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Button

Overrides

Module.type

Defined in

src/types/module.ts:74

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ChannelSelectCommand.html b/tr/docs/api/interfaces/ChannelSelectCommand.html index b166d49e7..f690aeece 100644 --- a/tr/docs/api/interfaces/ChannelSelectCommand.html +++ b/tr/docs/api/interfaces/ChannelSelectCommand.html @@ -6,13 +6,13 @@ Interface: ChannelSelectCommand | sern - Handlers. Redefined. - +

Interface: ChannelSelectCommand

Hierarchy

  • Module

    ChannelSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ChannelSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxChannelSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:85


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: ChannelSelect

Overrides

Module.type

Defined in

src/types/module.ts:84

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/CommandPlugin.html b/tr/docs/api/interfaces/CommandPlugin.html index c87b15176..b18f4e5fd 100644 --- a/tr/docs/api/interfaces/CommandPlugin.html +++ b/tr/docs/api/interfaces/CommandPlugin.html @@ -6,13 +6,13 @@ Interface: CommandPlugin<T> | sern - Handlers. Redefined. - +

Interface: CommandPlugin<T>

Deprecated

Use the newer helper functions and import { controller } from '@sern/handler'

Type parameters

NameType
Textends CommandType = CommandType

Properties

description

Optional description: string

Defined in

src/types/plugin.ts:51


execute

execute: (m: InitArgs<Processed<CommandModule>>, controller?: Deprecated<"Please import controller instead">) => PluginResult

Type declaration

▸ (m, controller?): PluginResult

Parameters
NameType
mInitArgs<Processed<CommandModule>>
controller?Deprecated<"Please import controller instead">
Returns

PluginResult

Defined in

src/types/plugin.ts:53


name

Optional name: string

Defined in

src/types/plugin.ts:50


type

type: Init

Defined in

src/types/plugin.ts:52

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ContextMenuMsg.html b/tr/docs/api/interfaces/ContextMenuMsg.html index 8163ffced..867966da1 100644 --- a/tr/docs/api/interfaces/ContextMenuMsg.html +++ b/tr/docs/api/interfaces/ContextMenuMsg.html @@ -6,13 +6,13 @@ Interface: ContextMenuMsg | sern - Handlers. Redefined. - +

Interface: ContextMenuMsg

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MessageContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMessageContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:70


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxMsg

Overrides

Module.type

Defined in

src/types/module.ts:69

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ContextMenuUser.html b/tr/docs/api/interfaces/ContextMenuUser.html index 038e90c42..c6aed6a6f 100644 --- a/tr/docs/api/interfaces/ContextMenuUser.html +++ b/tr/docs/api/interfaces/ContextMenuUser.html @@ -6,13 +6,13 @@ Interface: ContextMenuUser | sern - Handlers. Redefined. - +

Interface: ContextMenuUser

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserContextMenuCommandInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserContextMenuCommandInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:65


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: CtxUser

Overrides

Module.type

Defined in

src/types/module.ts:64

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ControlPlugin.html b/tr/docs/api/interfaces/ControlPlugin.html index e3163686d..4648d624f 100644 --- a/tr/docs/api/interfaces/ControlPlugin.html +++ b/tr/docs/api/interfaces/ControlPlugin.html @@ -6,13 +6,13 @@ Interface: ControlPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Controller.html b/tr/docs/api/interfaces/Controller.html index d2e8b0ebf..6abfd6154 100644 --- a/tr/docs/api/interfaces/Controller.html +++ b/tr/docs/api/interfaces/Controller.html @@ -6,13 +6,13 @@ Interface: Controller | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Dependencies.html b/tr/docs/api/interfaces/Dependencies.html index cc38e2cde..6bb0749d5 100644 --- a/tr/docs/api/interfaces/Dependencies.html +++ b/tr/docs/api/interfaces/Dependencies.html @@ -6,13 +6,13 @@ Interface: Dependencies | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/DependencyConfiguration.html b/tr/docs/api/interfaces/DependencyConfiguration.html index 35977b04f..dd5d28f84 100644 --- a/tr/docs/api/interfaces/DependencyConfiguration.html +++ b/tr/docs/api/interfaces/DependencyConfiguration.html @@ -6,13 +6,13 @@ Interface: DependencyConfiguration<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/DiscordEmitterPlugin.html b/tr/docs/api/interfaces/DiscordEmitterPlugin.html index ce62f0957..fa43f0850 100644 --- a/tr/docs/api/interfaces/DiscordEmitterPlugin.html +++ b/tr/docs/api/interfaces/DiscordEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEmitterPlugin | sern - Handlers. Redefined. - +

Interface: DiscordEmitterPlugin

Hierarchy

  • Plugin

    DiscordEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: DiscordEventCommand<keyof ClientEvents> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modDiscordEventCommand<keyof ClientEvents> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:49


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:48

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/DiscordEventCommand.html b/tr/docs/api/interfaces/DiscordEventCommand.html index eee05791c..a21a22fd9 100644 --- a/tr/docs/api/interfaces/DiscordEventCommand.html +++ b/tr/docs/api/interfaces/DiscordEventCommand.html @@ -6,13 +6,13 @@ Interface: DiscordEventCommand<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventCommand<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:123


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Discord

Overrides

Module.type

Defined in

src/types/module.ts:124

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsClientEvents[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:125

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/DiscordEventPlugin.html b/tr/docs/api/interfaces/DiscordEventPlugin.html index f61e7d238..d35f88dd8 100644 --- a/tr/docs/api/interfaces/DiscordEventPlugin.html +++ b/tr/docs/api/interfaces/DiscordEventPlugin.html @@ -6,13 +6,13 @@ Interface: DiscordEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: DiscordEventPlugin<T>

Type parameters

NameType
Textends keyof ClientEvents = keyof ClientEvents

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: ClientEvents[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsClientEvents[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:105


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:103


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:104

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ErrorHandling.html b/tr/docs/api/interfaces/ErrorHandling.html index bcf355f15..a3f0d1688 100644 --- a/tr/docs/api/interfaces/ErrorHandling.html +++ b/tr/docs/api/interfaces/ErrorHandling.html @@ -6,13 +6,13 @@ Interface: ErrorHandling | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/EventPlugin.html b/tr/docs/api/interfaces/EventPlugin.html index 58721bd84..ddd29b771 100644 --- a/tr/docs/api/interfaces/EventPlugin.html +++ b/tr/docs/api/interfaces/EventPlugin.html @@ -6,13 +6,13 @@ Interface: EventPlugin<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ExternalEmitterPlugin.html b/tr/docs/api/interfaces/ExternalEmitterPlugin.html index b8e58f466..2aef42c87 100644 --- a/tr/docs/api/interfaces/ExternalEmitterPlugin.html +++ b/tr/docs/api/interfaces/ExternalEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEmitterPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEmitterPlugin

Hierarchy

  • Plugin

    ExternalEmitterPlugin

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: ExternalEventCommand & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modExternalEventCommand & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:57


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:56

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ExternalEventCommand.html b/tr/docs/api/interfaces/ExternalEventCommand.html index a82b91bf9..78b9e4a6a 100644 --- a/tr/docs/api/interfaces/ExternalEventCommand.html +++ b/tr/docs/api/interfaces/ExternalEventCommand.html @@ -6,13 +6,13 @@ Interface: ExternalEventCommand | sern - Handlers. Redefined. - +

Interface: ExternalEventCommand

Hierarchy

  • Module

    ExternalEventCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


emitter

emitter: string

Defined in

src/types/module.ts:130


name

Optional name: string

Overrides

Module.name

Defined in

src/types/module.ts:129


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: External

Overrides

Module.type

Defined in

src/types/module.ts:131

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsunknown[]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:132

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ExternalEventPlugin.html b/tr/docs/api/interfaces/ExternalEventPlugin.html index 628e453af..9edee1036 100644 --- a/tr/docs/api/interfaces/ExternalEventPlugin.html +++ b/tr/docs/api/interfaces/ExternalEventPlugin.html @@ -6,13 +6,13 @@ Interface: ExternalEventPlugin | sern - Handlers. Redefined. - +

Interface: ExternalEventPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: unknown[], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsunknown[]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:99


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:98

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/InitArgs.html b/tr/docs/api/interfaces/InitArgs.html index aa7c83158..2a0d09c26 100644 --- a/tr/docs/api/interfaces/InitArgs.html +++ b/tr/docs/api/interfaces/InitArgs.html @@ -6,13 +6,13 @@ Interface: InitArgs<T> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/InitPlugin.html b/tr/docs/api/interfaces/InitPlugin.html index d893b7c54..ae9324bc2 100644 --- a/tr/docs/api/interfaces/InitPlugin.html +++ b/tr/docs/api/interfaces/InitPlugin.html @@ -6,13 +6,13 @@ Interface: InitPlugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Logging.html b/tr/docs/api/interfaces/Logging.html index 01c9b034c..d6560bfbc 100644 --- a/tr/docs/api/interfaces/Logging.html +++ b/tr/docs/api/interfaces/Logging.html @@ -6,13 +6,13 @@ Interface: Logging<T> | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/MentionableSelectCommand.html b/tr/docs/api/interfaces/MentionableSelectCommand.html index 66dd68f7f..3126f5764 100644 --- a/tr/docs/api/interfaces/MentionableSelectCommand.html +++ b/tr/docs/api/interfaces/MentionableSelectCommand.html @@ -6,13 +6,13 @@ Interface: MentionableSelectCommand | sern - Handlers. Redefined. - +

Interface: MentionableSelectCommand

Hierarchy

  • Module

    MentionableSelectCommand

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: MentionableSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxMentionableSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:95


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: MentionableSelect

Overrides

Module.type

Defined in

src/types/module.ts:94

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ModalSubmitCommand.html b/tr/docs/api/interfaces/ModalSubmitCommand.html index abf23e94f..07efa32cc 100644 --- a/tr/docs/api/interfaces/ModalSubmitCommand.html +++ b/tr/docs/api/interfaces/ModalSubmitCommand.html @@ -6,13 +6,13 @@ Interface: ModalSubmitCommand | sern - Handlers. Redefined. - +

Interface: ModalSubmitCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: ModalSubmitInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxModalSubmitInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:105


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Modal

Overrides

Module.type

Defined in

src/types/module.ts:104

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Module.html b/tr/docs/api/interfaces/Module.html index 842540ced..34eb4ecc7 100644 --- a/tr/docs/api/interfaces/Module.html +++ b/tr/docs/api/interfaces/Module.html @@ -6,13 +6,13 @@ Interface: Module | sern - Handlers. Redefined. - +

Interface: Module

Hierarchy

Properties

description

Optional description: string

Defined in

src/types/module.ts:38


execute

execute: (...args: any[]) => any

Type declaration

▸ (...args): any

Parameters
NameType
...argsany[]
Returns

any

Defined in

src/types/module.ts:39


name

Optional name: string

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Defined in

src/types/module.ts:37


type

type: CommandType | EventType

Defined in

src/types/module.ts:34

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/ModuleManager.html b/tr/docs/api/interfaces/ModuleManager.html index 8481dfc2b..343368c19 100644 --- a/tr/docs/api/interfaces/ModuleManager.html +++ b/tr/docs/api/interfaces/ModuleManager.html @@ -6,13 +6,13 @@ Interface: ModuleManager | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Plugin.html b/tr/docs/api/interfaces/Plugin.html index 0fcda804a..6bd8909ab 100644 --- a/tr/docs/api/interfaces/Plugin.html +++ b/tr/docs/api/interfaces/Plugin.html @@ -6,13 +6,13 @@ Interface: Plugin<Args> | sern - Handlers. Redefined. - + - + \ No newline at end of file diff --git a/tr/docs/api/interfaces/RoleSelectCommand.html b/tr/docs/api/interfaces/RoleSelectCommand.html index 169cfda07..fb7ec028c 100644 --- a/tr/docs/api/interfaces/RoleSelectCommand.html +++ b/tr/docs/api/interfaces/RoleSelectCommand.html @@ -6,13 +6,13 @@ Interface: RoleSelectCommand | sern - Handlers. Redefined. - +

Interface: RoleSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: RoleSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxRoleSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:90


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: RoleSelect

Overrides

Module.type

Defined in

src/types/module.ts:89

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernAutocompleteData.html b/tr/docs/api/interfaces/SernAutocompleteData.html index c36af3886..11363a203 100644 --- a/tr/docs/api/interfaces/SernAutocompleteData.html +++ b/tr/docs/api/interfaces/SernAutocompleteData.html @@ -6,13 +6,13 @@ Interface: SernAutocompleteData | sern - Handlers. Redefined. - +

Interface: SernAutocompleteData

Hierarchy

  • Omit<BaseApplicationCommandOptionsData, "autocomplete">

    SernAutocompleteData

Properties

autocomplete

autocomplete: true

Defined in

src/types/module.ts:177


command

command: AutocompleteCommand

Defined in

src/types/module.ts:182


description

description: string

Inherited from

Omit.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

Omit.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

Omit.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


required

Optional required: boolean

Inherited from

Omit.required

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4202


type

type: String | Integer | Number

Defined in

src/types/module.ts:178

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernEmitterPlugin.html b/tr/docs/api/interfaces/SernEmitterPlugin.html index 708b5e160..a78e0c75d 100644 --- a/tr/docs/api/interfaces/SernEmitterPlugin.html +++ b/tr/docs/api/interfaces/SernEmitterPlugin.html @@ -6,13 +6,13 @@ Interface: SernEmitterPlugin | sern - Handlers. Redefined. - +

Interface: SernEmitterPlugin

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (payload: { absPath: string ; mod: SernEventCommand<keyof SernEventsMapping> & { name: string } }, controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (payload, controller): Awaitable<Result<void, void>>

Parameters
NameType
payloadObject
payload.absPathstring
payload.modSernEventCommand<keyof SernEventsMapping> & { name: string }
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:65


name

Optional name: string

Deprecated

will be removed in the next update

Inherited from

Plugin.name

Defined in

src/handler/plugins/plugin.ts:31


type

type: Command

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:64

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernEventCommand.html b/tr/docs/api/interfaces/SernEventCommand.html index 12112e6b3..6058d14b7 100644 --- a/tr/docs/api/interfaces/SernEventCommand.html +++ b/tr/docs/api/interfaces/SernEventCommand.html @@ -6,13 +6,13 @@ Interface: SernEventCommand<T> | sern - Handlers. Redefined. - +

Interface: SernEventCommand<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


name

Optional name: T

Overrides

Module.name

Defined in

src/types/module.ts:116


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Sern

Overrides

Module.type

Defined in

src/types/module.ts:117

Methods

execute

execute(...args): unknown

Parameters

NameType
...argsSernEventsMapping[T]

Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:118

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernEventPlugin.html b/tr/docs/api/interfaces/SernEventPlugin.html index 65a4035a6..1fd62c55e 100644 --- a/tr/docs/api/interfaces/SernEventPlugin.html +++ b/tr/docs/api/interfaces/SernEventPlugin.html @@ -6,13 +6,13 @@ Interface: SernEventPlugin<T> | sern - Handlers. Redefined. - +

Interface: SernEventPlugin<T>

Type parameters

NameType
Textends keyof SernEventsMapping = keyof SernEventsMapping

Hierarchy

Properties

description

Optional description: string

Deprecated

will be removed in the next update

Inherited from

Plugin.description

Defined in

src/handler/plugins/plugin.ts:33


execute

execute: (args: SernEventsMapping[T], controller: Controller) => Awaitable<Result<void, void>>

Type declaration

▸ (args, controller): Awaitable<Result<void, void>>

Parameters
NameType
argsSernEventsMapping[T]
controllerController
Returns

Awaitable<Result<void, void>>

Defined in

src/handler/plugins/plugin.ts:91


name

Optional name: T

Deprecated

will be removed in the next update

Overrides

Plugin.name

Defined in

src/handler/plugins/plugin.ts:89


type

type: Event

Overrides

Plugin.type

Defined in

src/handler/plugins/plugin.ts:90

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernSubCommandData.html b/tr/docs/api/interfaces/SernSubCommandData.html index d21abca21..8d6d020cb 100644 --- a/tr/docs/api/interfaces/SernSubCommandData.html +++ b/tr/docs/api/interfaces/SernSubCommandData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandData | sern - Handlers. Redefined. - +

Interface: SernSubCommandData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: BaseOptions[]

Defined in

src/types/module.ts:214


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:213


type

type: Subcommand

Defined in

src/types/module.ts:212

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SernSubCommandGroupData.html b/tr/docs/api/interfaces/SernSubCommandGroupData.html index 3737efa53..8df70ffa8 100644 --- a/tr/docs/api/interfaces/SernSubCommandGroupData.html +++ b/tr/docs/api/interfaces/SernSubCommandGroupData.html @@ -6,13 +6,13 @@ Interface: SernSubCommandGroupData | sern - Handlers. Redefined. - +

Interface: SernSubCommandGroupData

Hierarchy

  • BaseApplicationCommandOptionsData

    SernSubCommandGroupData

Properties

autocomplete

Optional autocomplete: undefined

Inherited from

BaseApplicationCommandOptionsData.autocomplete

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4203


description

description: string

Inherited from

BaseApplicationCommandOptionsData.description

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4200


descriptionLocalizations

Optional descriptionLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.descriptionLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4201


name

name: string

Inherited from

BaseApplicationCommandOptionsData.name

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4198


nameLocalizations

Optional nameLocalizations: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

Inherited from

BaseApplicationCommandOptionsData.nameLocalizations

Defined in

node_modules/.pnpm/discord.js@14.7.1/node_modules/discord.js/typings/index.d.ts:4199


options

Optional options: SernSubCommandData[]

Defined in

src/types/module.ts:220


required

Optional required: undefined

Overrides

BaseApplicationCommandOptionsData.required

Defined in

src/types/module.ts:219


type

type: SubcommandGroup

Defined in

src/types/module.ts:218

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/SlashCommand.html b/tr/docs/api/interfaces/SlashCommand.html index e996621f2..dcd80f112 100644 --- a/tr/docs/api/interfaces/SlashCommand.html +++ b/tr/docs/api/interfaces/SlashCommand.html @@ -6,13 +6,13 @@ Interface: SlashCommand | sern - Handlers. Redefined. - +

Interface: SlashCommand

Hierarchy

Properties

description

description: string

Overrides

Module.description

Defined in

src/types/module.ts:50


execute

execute: (ctx: Context, args: ["slash", SlashOptions]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["slash", SlashOptions]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:52


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


options

Optional options: (SernSubCommandData | SernSubCommandGroupData | BaseOptions)[]

Defined in

src/types/module.ts:51


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Slash

Overrides

Module.type

Defined in

src/types/module.ts:49

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/StringSelectCommand.html b/tr/docs/api/interfaces/StringSelectCommand.html index 44b803ab6..e4dd85bb7 100644 --- a/tr/docs/api/interfaces/StringSelectCommand.html +++ b/tr/docs/api/interfaces/StringSelectCommand.html @@ -6,13 +6,13 @@ Interface: StringSelectCommand | sern - Handlers. Redefined. - +

Interface: StringSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: StringSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxStringSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:80


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: StringSelect

Overrides

Module.type

Defined in

src/types/module.ts:79

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/TextCommand.html b/tr/docs/api/interfaces/TextCommand.html index defd52671..9d5a3e5c5 100644 --- a/tr/docs/api/interfaces/TextCommand.html +++ b/tr/docs/api/interfaces/TextCommand.html @@ -6,13 +6,13 @@ Interface: TextCommand | sern - Handlers. Redefined. - +

Interface: TextCommand

Hierarchy

Properties

alias

Optional alias: string[]

Defined in

src/types/module.ts:44


description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: Context, args: ["text", string[]]) => unknown

Type declaration

▸ (ctx, args): unknown

Parameters
NameType
ctxContext
args["text", string[]]
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:45


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: Text

Overrides

Module.type

Defined in

src/types/module.ts:43

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/UserSelectCommand.html b/tr/docs/api/interfaces/UserSelectCommand.html index 620ab7d5e..7baec5f74 100644 --- a/tr/docs/api/interfaces/UserSelectCommand.html +++ b/tr/docs/api/interfaces/UserSelectCommand.html @@ -6,13 +6,13 @@ Interface: UserSelectCommand | sern - Handlers. Redefined. - +

Interface: UserSelectCommand

Hierarchy

Properties

description

Optional description: string

Inherited from

Module.description

Defined in

src/types/module.ts:38


execute

execute: (ctx: UserSelectMenuInteraction<CacheType>) => unknown

Type declaration

▸ (ctx): unknown

Parameters
NameType
ctxUserSelectMenuInteraction<CacheType>
Returns

unknown

Overrides

Module.execute

Defined in

src/types/module.ts:100


name

Optional name: string

Inherited from

Module.name

Defined in

src/types/module.ts:35


onEvent

onEvent: ControlPlugin<any[]>[]

Inherited from

Module.onEvent

Defined in

src/types/module.ts:36


plugins

plugins: InitPlugin<any[]>[]

Inherited from

Module.plugins

Defined in

src/types/module.ts:37


type

type: UserSelect

Overrides

Module.type

Defined in

src/types/module.ts:99

- + \ No newline at end of file diff --git a/tr/docs/api/interfaces/Wrapper.html b/tr/docs/api/interfaces/Wrapper.html index 2c2e25bee..1ce879dbe 100644 --- a/tr/docs/api/interfaces/Wrapper.html +++ b/tr/docs/api/interfaces/Wrapper.html @@ -6,13 +6,13 @@ Interface: Wrapper | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/api/modules.html b/tr/docs/api/modules.html index ad50f0c43..4a8af096b 100644 --- a/tr/docs/api/modules.html +++ b/tr/docs/api/modules.html @@ -6,7 +6,7 @@ @sern/handler | sern - Handlers. Redefined. - + @@ -19,7 +19,7 @@ where typings can be very bad.

Type parameters

NameType
Textends () => () => unknown

Parameters

NameType
cbT

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:33


useContainerRaw

useContainerRaw<T>(): Container<T, {}>

Returns the underlying data structure holding all dependencies. Please be careful as this only gets the client's current state. Exposes some methods from iti

Type parameters

NameType
Textends Dependencies

Returns

Container<T, {}>

Defined in

src/handler/dependencies/provider.ts:54

- + \ No newline at end of file diff --git a/tr/docs/api/namespaces/Sern.html b/tr/docs/api/namespaces/Sern.html index 81b4f1f3f..b9129b3ef 100644 --- a/tr/docs/api/namespaces/Sern.html +++ b/tr/docs/api/namespaces/Sern.html @@ -6,13 +6,13 @@ Namespace: Sern | sern - Handlers. Redefined. - +

Namespace: Sern

References

CommandExecutable

Re-exports CommandExecutable


EventExecutable

Re-exports EventExecutable


commandModule

Re-exports commandModule


controller

Re-exports controller


discordEvent

Re-exports discordEvent


eventModule

Re-exports eventModule

Functions

init

init(wrapper): void

Example

src/index.ts
Sern.init({
defaultPrefix: '!',
commands: 'dist/commands',
events: 'dist/events',
containerConfig : {
get: useContainer
}
})

Parameters

NameTypeDescription
wrapperWrapperOptions to pass into sern. Function to start the handler up

Returns

void

Defined in

src/handler/sern.ts:38


makeDependencies

makeDependencies<T>(conf): <V>(...keys: [...V[]]) => MapDeps<T, V>

Type parameters

NameType
Textends Dependencies

Parameters

NameTypeDescription
confDependencyConfiguration<T>a configuration for creating your project dependencies

Returns

fn

▸ <V>(...keys): MapDeps<T, V>

Type parameters
NameType
Vextends keyof T[]
Parameters
NameType
...keys[...V[]]
Returns

MapDeps<T, V>

Defined in

src/handler/sern.ts:107

- + \ No newline at end of file diff --git a/tr/docs/guide.html b/tr/docs/guide.html index d6a9b5a9c..7cc559884 100644 --- a/tr/docs/guide.html +++ b/tr/docs/guide.html @@ -6,13 +6,13 @@ Introduction | sern - Handlers. Redefined. - +

Introduction

Welcome to our official guide. This guide will go through all the core features of the framework.

  • 💖 Thank you for choosing sern to be your framework!

  • Teaching the discord.js library and / or Javascript / Typescript is out of scope of this project, so the documentation assumes you already know these elements.

  • discord.js v14 is the only supported library at the moment

You will learn

Working with plugins

Events

Good to know

- + \ No newline at end of file diff --git a/tr/docs/guide/getting-started/choose-ide.html b/tr/docs/guide/getting-started/choose-ide.html index e593d7579..2ff83376f 100644 --- a/tr/docs/guide/getting-started/choose-ide.html +++ b/tr/docs/guide/getting-started/choose-ide.html @@ -6,14 +6,14 @@ Choosing an IDE | sern - Handlers. Redefined. - +
- + \ No newline at end of file diff --git a/tr/docs/guide/getting-started/preparing.html b/tr/docs/guide/getting-started/preparing.html index 899afcdf9..65fe3a35c 100644 --- a/tr/docs/guide/getting-started/preparing.html +++ b/tr/docs/guide/getting-started/preparing.html @@ -6,13 +6,13 @@ Preparing to Code | sern - Handlers. Redefined. - +

Preparing to Code

After installing and IDE you need to install node.

Click to download the LTS version of node right here.

After you downloaded node, you can start using us

Running this will install our CLI, which allows you to create a template project without writing a single line of code.

npm install -g @sern/cli

If you want to do more with our CLI, continue reading our guides.

- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/cli.html b/tr/docs/guide/walkthrough/cli.html index 6a1d39dfb..e0786a0aa 100644 --- a/tr/docs/guide/walkthrough/cli.html +++ b/tr/docs/guide/walkthrough/cli.html @@ -6,7 +6,7 @@ CLI | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

CLI

Setting up the CLI is easy.

  • To start a brand-new project, run :
sern init (-y)
tip

It creates a directory for you so you don't need to!

Include the -y flag if you want to set up defaults. The default langauge is Typescript

sern plugins
info

Make sure to have a correct sern.config.json

This will display a menu selection of all installable plugins.
Note: You must have a sern.config.json to use this command. If you want to view plugins, visit the repository linked above.

  • To install extra utilities into your project
sern extra
- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/conclusion.html b/tr/docs/guide/walkthrough/conclusion.html index c649b2c79..d8614fccf 100644 --- a/tr/docs/guide/walkthrough/conclusion.html +++ b/tr/docs/guide/walkthrough/conclusion.html @@ -6,7 +6,7 @@ Conclusion | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Conclusion

If you reached this far, thank you for reading! We hope you have learned the necessities you need to create a bot with the sern framework. If you have any other questions, bugs, feature requests, concerns, please join our community server, and we'll be glad to answer your questions.

- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/first-command.html b/tr/docs/guide/walkthrough/first-command.html index 4eb97a212..48d21577c 100644 --- a/tr/docs/guide/walkthrough/first-command.html +++ b/tr/docs/guide/walkthrough/first-command.html @@ -6,7 +6,7 @@ First Command | sern - Handlers. Redefined. - + @@ -15,7 +15,7 @@ If you installed a new project via the cli, This is the ping command located in src/commands folder.

Typescript

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript

const { CommandType, commandModule } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
// alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
})

To view what each of these properties mean in depth, visit the official documentation.

Types of command modules

Every command module type is part of an enum. This field allows type inference for the rest of a module's fields.
All the command types can be found in the official documentation!

So, lets say you want to make a command module that listens to modals.

Note: Keep in mind you'll need to send a modal with a custom id dm-me. This example below is the response to a modal being sent.


Typescript:

import { commandModule, CommandType } from '@sern/handler';
export default commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Javascript:

const { CommandType, commandModule } = require('@sern/handler');
exports.default = commandModule({
name: 'dm-me',
type: CommandType.Modal,
async execute (modal) {
const value = modal.fields.getTextInputValue('message');
modal.client.users.fetch('182326315813306368').then( u =>
u.send(value + ` from ${modal.user}`)
);
modal.reply( { ephemeral:true, content: 'Sent' })
}
});

Commands are straight forward. Keep in mind, every other property on the commandModule object is optional except the type and execute function.

Context class

The provided Context class helps with modules of CommandType.Both (A mixture of slash / legacy commands).

The Context class is passed into modules with type:

  • CommandType.Both
  • CommandType.Slash
  • CommandType.Text

This data structure helps interop between legacy commands and slash commands with ease.

note

View the docs

Typescript:

export default commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx: Context) {
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});

Javascript:

exports.default = commandModule({
name: 'ping',
type: CommandType.Both,
async execute(ctx) { //ctx is a Context instance
await ctx.reply(`pong ${ctx.user}`)
// .reply is shared between both message and interaction!
// So is an User object!
}
});
- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/first-event.html b/tr/docs/guide/walkthrough/first-event.html index 205eaec29..ff16891c5 100644 --- a/tr/docs/guide/walkthrough/first-event.html +++ b/tr/docs/guide/walkthrough/first-event.html @@ -6,7 +6,7 @@ First Event Module | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

First Event Module

We will dissect a basic event module.
Typescript:

export default eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate', //name of event.
execute(event) {
console.log(event);
}
})

Javascript:

exports.default = eventModule({
type: EventType.Sern,
plugins : [], //NOT SUPPORTED YET!!
name: 'module.activate',
execute(event) {
console.log(event);
}
})

Like command modules, the type property denotes what kind of event it is, which can be found here.

To view what each of these properties mean in depth, visit the official documentation.


Event modules are laid out similarly to command modules. These listen to any and all event you provide. In the current version 1.1.0-beta, plugins are not supported.

Another example of an event module

Typescript:

export default eventModule({
type: EventType.Discord,
plugins : [],
name: 'guildMemberAdd', //name of event.
async execute(member: GuildMember) {
(await member.guild.channels.fetch('channel-id') as TextChannel).send(`Welcome, ${member}`);
}
})

Javascript:


exports.default = eventModule({
type: EventType.Discord,
plugins : [], //NOT SUPPORTED YET!!
name: 'guildMemberAdd', //name of event.
async execute(member) {
(await member.guild.channels.fetch('channel-id')).send(`Welcome, ${member}`);
}
})
- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/goal.html b/tr/docs/guide/walkthrough/goal.html index 88392d2af..7edf90532 100644 --- a/tr/docs/guide/walkthrough/goal.html +++ b/tr/docs/guide/walkthrough/goal.html @@ -6,7 +6,7 @@ Goal | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Goal

sern strives to be minimalist, but with all batteries included. Meaning, this framework provides the necessary tools to start up a bot in minutes, and leaves plenty room space to customize your experience and create an amazing project. It should include all the tools for any bot at any scale.

- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/good-to-know.html b/tr/docs/guide/walkthrough/good-to-know.html index 8a3370807..10a96799d 100644 --- a/tr/docs/guide/walkthrough/good-to-know.html +++ b/tr/docs/guide/walkthrough/good-to-know.html @@ -6,7 +6,7 @@ Good to know | sern - Handlers. Redefined. - + @@ -14,7 +14,7 @@

Good to know

sern.config.json

A sern.config.json, although not necessary, allows your project to communicate with our cli.

For example, when installing typescript plugins, the language property is necessary to install from our open source repository.

Using the cli and running sern init --sync on pre-existing projects should install this json file in the root directory given. Or, if this is a brand-new project, sern init automatically installs it.

{
"language": "typescript",
"paths": {
"base": "src",
"commands": "commands"
}
}
- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/plugins.html b/tr/docs/guide/walkthrough/plugins.html index 7040e41b5..8b5d490b3 100644 --- a/tr/docs/guide/walkthrough/plugins.html +++ b/tr/docs/guide/walkthrough/plugins.html @@ -6,7 +6,7 @@ Plugins | sern - Handlers. Redefined. - + @@ -17,7 +17,7 @@ This controls whether a module is stored into sern.
Typescript:

export function inDir(dir : string) : CommandPlugin<CommandType.Both> {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Javascript:

export function inDir(dir : string) {
return {
type: PluginType.Command,
async execute(wrapper, { absPath, module }, controller) {
if(path.dirname(absPath) !== dir) {
console.log(+new Date(), `${module.name} is not in the correct directory!`);
return controller.stop()
}
console.log(+new Date(), `${module.name} is in the correct directory!`);
return controller.next(); //continue
}
}
}

Above, this simple plugin logs that the module has been loaded along with a timestamp.
Again, it is up to you to define plugin logic! The possibilities to customize your bots are endless.

tip

Command Plugins are good for ensuring the shape, location, and preprocessing of your commands.

Event Plugins

event-plugins

  • An event is emitted by discord.js.
  • This event is passed to all plugins (in order!!),
  • If all are successful,

The command is executed. Calling controller.stop() notifies sern that this command should not be run, and this event is ignored.

So, what does a command module look like with plugins?

Typescript:

import { commandModule, CommandType } from '@sern/handler';

export default commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly()
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Javascript:

const { commandModule, CommandType } = require('@sern/handler');

exports.default = commandModule({
type: CommandType.Both,
plugins: [
inDir("other"),
serenOnly() //The plugins in this section applied to this module!
],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply({ content: 'Pong 🏓' });
},
});

Can you predict the behavior of this command?

  • Before loading into sern, this command module will check if this module is in the correct directory other.
  • Before an event occurs, this command module will check if the user has the id 182326315813306368.
tip

Event Plugins are good for filtering, preconditions, parsing.

If all plugins return controller.next(), this command replies Pong 🏓

- + \ No newline at end of file diff --git a/tr/docs/guide/walkthrough/sern-emitter.html b/tr/docs/guide/walkthrough/sern-emitter.html index 62bc444b3..ee1f4f8f1 100644 --- a/tr/docs/guide/walkthrough/sern-emitter.html +++ b/tr/docs/guide/walkthrough/sern-emitter.html @@ -6,13 +6,13 @@ The SernEmitter class | sern - Handlers. Redefined. - +

The SernEmitter class

You're shipped with the SernEmitter. This EventEmitter listens to

  • command modules executing and its status, the module.activate event
  • command modules registered and its status, the module.register event
  • On default, sern creates a single SernEmitter for your bot process.
  • any error that occurs, the error event
  • warn events, where it is possible to throw errors

You can put these and other event listeners into event modules!


View all events
- + \ No newline at end of file diff --git a/tr/docs/intro.html b/tr/docs/intro.html index a7e136e7f..2819a09da 100644 --- a/tr/docs/intro.html +++ b/tr/docs/intro.html @@ -6,13 +6,13 @@ Welcome! | sern - Handlers. Redefined. - +

Welcome!

Content

  • /docs/api contains autogenerated documentation of our codebase using typedoc
  • /docs/guide contains a basic startup guide and details to get started with sern faster!
tip

This site is open source! Please do contribute if you find any bugs, typos, or sections in need of improvements.

tip

If you have problems, join the discord server here

- + \ No newline at end of file diff --git a/tr/index.html b/tr/index.html index acb3b8f91..4751ac78c 100644 --- a/tr/index.html +++ b/tr/index.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. | sern - Handlers. Redefined. - +

Handlers. Redefined.

With the support of the community made plugins and a powerful CLI, it's more than just a handler.

sern init
logo

Batteries included

Start or integrate a new project in minutes.

Customizable

Extend or customize with community-based plugins to provide utilities, filters, and more.

Modern

Uses modern and powerful tooling such as swc, tsup, typescript, and rxjs to future-proof and ensure project quality.

- + \ No newline at end of file diff --git a/tr/markdown-page.html b/tr/markdown-page.html index 810596a31..67bb967c2 100644 --- a/tr/markdown-page.html +++ b/tr/markdown-page.html @@ -6,13 +6,13 @@ Markdown page example | sern - Handlers. Redefined. - +

Markdown page example

You don't need React to write simple standalone pages.

- + \ No newline at end of file diff --git a/tr/plugins.html b/tr/plugins.html index dd5c6861b..95bbb3ac4 100644 --- a/tr/plugins.html +++ b/tr/plugins.html @@ -6,13 +6,13 @@ sern - Handlers. Redefined. - +

Coming soon

- + \ No newline at end of file