diff --git a/404.html b/404.html index 5c56e562f..336638176 100644 --- a/404.html +++ b/404.html @@ -11,7 +11,7 @@ - +
diff --git a/assets/js/7b758ddf.bebefb7e.js b/assets/js/7b758ddf.f6b10005.js similarity index 76% rename from assets/js/7b758ddf.bebefb7e.js rename to assets/js/7b758ddf.f6b10005.js index f0b915e3f..be9194304 100644 --- a/assets/js/7b758ddf.bebefb7e.js +++ b/assets/js/7b758ddf.f6b10005.js @@ -1 +1 @@ -"use strict";(self.webpackChunksern_website=self.webpackChunksern_website||[]).push([[5938],{6942:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var o=n(4848),i=n(8453);const s={sidebar_position:7},a="Autocomplete",c={id:"guide/walkthrough/autocomplete",title:"Autocomplete",description:"Autocomplete is a special interaction where it can happen on multiple options on a single command. We've handled this with a simple",source:"@site/docs/guide/walkthrough/autocomplete.md",sourceDirName:"guide/walkthrough",slug:"/guide/walkthrough/autocomplete",permalink:"/docs/guide/walkthrough/autocomplete",draft:!1,unlisted:!1,editUrl:"https://github.com/sern-handler/website/edit/main/docs/guide/walkthrough/autocomplete.md",tags:[],version:"current",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"tutorialSidebar",previous:{title:"Services",permalink:"/docs/guide/walkthrough/services"},next:{title:"Dependency Injection",permalink:"/docs/guide/walkthrough/dependency-injection"}},r={},l=[{value:"Example",id:"example",level:2}];function p(e){const t={code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.h1,{id:"autocomplete",children:"Autocomplete"}),"\n",(0,o.jsx)(t.p,{children:"Autocomplete is a special interaction where it can happen on multiple options on a single command. We've handled this with a simple\ntree search algorithm in a nested options tree."}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="src/commands/cheese.ts" {11-18}',children:"export default commandModule({ \n type: CommandType.Slash,\n description: \"show me cheese\",\n options: [\n { \n name: \"list\",\n\t type: ApplicationCommandOptionType.String,\n\t description: \"pick a cheese to show\",\n\t required: true,\n\t autocomplete: true,\n\t command: {\n onEvent: [],\n execute: (ctx) => {\n const focus = ctx.options.getFocused();\n ctx.respond(['gouda', 'parmesan', 'harvati']\n .map((cheese) => ({ name: cheese, value: cheese })));\n\t }\n\t}\n\t}\n ],\n execute: (ctx, [, args]) => {\n const cheese = args.getString('list', true); \n ctx.reply('selected cheese');\n }\n})\n\n\n"})}),"\n",(0,o.jsx)(t.p,{children:"Sern will handle autocomplete interactions at arbitrary depths and subcommand levels."})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var o=n(6540);const i={},s=o.createContext(i);function a(e){const t=o.useContext(s);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),o.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunksern_website=self.webpackChunksern_website||[]).push([[5938],{6942:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var o=n(4848),i=n(8453);const s={sidebar_position:7},a="Autocomplete",c={id:"guide/walkthrough/autocomplete",title:"Autocomplete",description:"Autocomplete is a special interaction where it can happen on multiple options on a single command. We've handled this with a simple",source:"@site/docs/guide/walkthrough/autocomplete.md",sourceDirName:"guide/walkthrough",slug:"/guide/walkthrough/autocomplete",permalink:"/docs/guide/walkthrough/autocomplete",draft:!1,unlisted:!1,editUrl:"https://github.com/sern-handler/website/edit/main/docs/guide/walkthrough/autocomplete.md",tags:[],version:"current",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"tutorialSidebar",previous:{title:"Services",permalink:"/docs/guide/walkthrough/services"},next:{title:"Dependency Injection",permalink:"/docs/guide/walkthrough/dependency-injection"}},r={},l=[{value:"Example",id:"example",level:2}];function p(e){const t={code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.h1,{id:"autocomplete",children:"Autocomplete"}),"\n",(0,o.jsx)(t.p,{children:"Autocomplete is a special interaction where it can happen on multiple options on a single command. We've handled this with a simple\ntree search algorithm in a nested options tree."}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="src/commands/cheese.ts" {11-18}',children:"export default commandModule({ \n type: CommandType.Slash,\n description: \"show me cheese\",\n options: [\n { \n name: \"list\",\n\t type: ApplicationCommandOptionType.String,\n\t description: \"pick a cheese to show\",\n\t required: true,\n\t autocomplete: true,\n\t command: {\n onEvent: [],\n execute: (ctx) => {\n const focus = ctx.options.getFocused();\n ctx.respond(['gouda', 'parmesan', 'harvati']\n .map((cheese) => ({ name: cheese, value: cheese })));\n\t }\n\t}\n\t}\n ],\n execute: (ctx, [, args]) => {\n const cheese = args.getString('list', true); \n ctx.reply('selected: ' + cheese);\n }\n})\n\n\n"})}),"\n",(0,o.jsx)(t.p,{children:"Sern will handle autocomplete interactions at arbitrary depths and subcommand levels."})]})}function d(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var o=n(6540);const i={},s=o.createContext(i);function a(e){const t=o.useContext(s);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),o.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.c95cd048.js b/assets/js/runtime~main.c4f65f90.js similarity index 98% rename from assets/js/runtime~main.c95cd048.js rename to assets/js/runtime~main.c4f65f90.js index acdc5fed3..b955933de 100644 --- a/assets/js/runtime~main.c95cd048.js +++ b/assets/js/runtime~main.c4f65f90.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;iAutocomplete is a special interaction where it can happen on multiple options on a single command. We've handled this with a simple tree search algorithm in a nested options tree.
export default commandModule({
type: CommandType.Slash,
description: "show me cheese",
options: [
{
name: "list",
type: ApplicationCommandOptionType.String,
description: "pick a cheese to show",
required: true,
autocomplete: true,
command: {
onEvent: [],
execute: (ctx) => {
const focus = ctx.options.getFocused();
ctx.respond(['gouda', 'parmesan', 'harvati']
.map((cheese) => ({ name: cheese, value: cheese })));
}
}
}
],
execute: (ctx, [, args]) => {
const cheese = args.getString('list', true);
ctx.reply('selected cheese');
}
})
export default commandModule({
type: CommandType.Slash,
description: "show me cheese",
options: [
{
name: "list",
type: ApplicationCommandOptionType.String,
description: "pick a cheese to show",
required: true,
autocomplete: true,
command: {
onEvent: [],
execute: (ctx) => {
const focus = ctx.options.getFocused();
ctx.respond(['gouda', 'parmesan', 'harvati']
.map((cheese) => ({ name: cheese, value: cheese })));
}
}
}
],
execute: (ctx, [, args]) => {
const cheese = args.getString('list', true);
ctx.reply('selected: ' + cheese);
}
})
Sern will handle autocomplete interactions at arbitrary depths and subcommand levels.