--- title: 20220813網頁組第三次BOT討論 tags : 網頁組, BOT image: --- # 網頁組BOT討論 ## 今日討論內容 - Slash commands Option - Slash commands Choices - Slash commands Subcommands ### 張恩齊 OptionType 可接受型態: - String (字串) - Integer (整數) - Number (浮點數) - Boolean (TRUE or FALSE) - User (使用者) - Channel (頻道) - Role (身分組) - Mentionable (使用者, 身分組) - Attachment (附件) 其他設置 Required 標示必填選項 預設為False Max(Min)Value 如果option為INTEGERorNUMBER 標示最大(小)值 預設為 Max(Min)Length 如果option為STRING 標示最大(小)長度 預設為0~6000 Autocomplete 待補 ```javascript .setRequired(TRUE) .setMaxValue(size) .setMinValue(size) .setMaxLength(size) .setMinLength(size) ``` --- ### 黃俊翔 #### option respond ```javascript= const focusedOption = interaction.options.getFocused(true); interaction.respond({ neme: focusedOption.name, value: focusedOption.value, }); ``` #### auto complete ```javascript= .addStringOption((option) => option .setName("type") .setDescription("Enter the type") .setAutocomplete(true)//<==set autocomplete .setRequired(true) ) ``` ```javascript= let types; types = ["button", "select_menu"]; const filtered = types.filter((type) => type.startsWith(focusedOption.value) ); await interaction.respond( filtered.map((type) => ({ name: type, value: type })) ); ``` --- ## 下週主題 待週日專案會議後另作決議 --- ## 其他
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up