Escolar Documentos
Profissional Documentos
Cultura Documentos
Typescript Bot
Typescript Bot
Typescript Bot
await interaction.deferReply({
ephemeral: true,
})
setTimeout(() => {
interaction.editReply({
content: "Ficar sem botão, testando funções!"
})
}, 3500)
-----------------------------------------------------------------------------------
----------------------------
DEFININDO BOTÃO E SUA FUNÇÃO EM NEW COLLECTION
},
buttons: new Collection([
["test-button", async (interaction) => {
interaction.update({components: []})
}]
])
})
-----------------------------------------------------------------------------------
-----------------------------
INTERAÇÕES DE COMANDOS DE BARRA
-----------------------------------------------------------------------------------
-------------------
OPÇÕES DE COMANDOS
OPÇÃO NO SLASH COMMAND, TIPO UM PLACEHOLDER COLHENDO ALGO ESPECICO, COMO USUARIO,
CARGO, NÚMERO E ETC.
options: [
{
name: "texto", (LABEL)
description: "Digite um texto!", (PLACE HOLDER)
type: ApplicationCommandOptionType.String, (TIPO)
required: true, (SE VAI SER OBRIGATÓRIO OU NÃO)
DEFINE DENTRO DA FUNÇÃO ASSINCRONA, CRIA UM VARIAVEL PARA ELA COM CONST (NOME, true
caso seja obrigatório) - assim vai retornar só string
APÓS CRIAR A CONST EU REPLICO A MENSAGEM PELO BOT
await interaction.reply({
content: `${text}`});
if (text){
await interaction.reply({ content: `Você disse ${text}`})
} else {
await interaction.reply('Você não disse nada')
}
setTimeout(() => {
interaction.deleteReply()
}, 2000)
},
})
EU FAÇO UMA VERIFCAÇÃO IF SE TEM TEXTO, SE NÃO TIVER ELE RETORNAR UM TEXTO PRE
DEFINIDO, SE TIVER O PLACEHOLDER ELE REPLICA O IF
============================
SUB COMMANDO
options: [
{
name: "texto"
description: "Digite um texto!"
type: ApplicationCommandOptionType.SubCommand, (TIPO)
}
===========================
CRIANDO INTERAÇÃO EM APPS
name: "mencionar",
type: ApplicationCommandType.User,
async run({interaction, options}){
if (!interaction.isUserContextMenuCommand()) return;