diff --git a/README.md b/README.md index 4bf5f04..f42a024 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Discord-Linux Discord.JS v14 Base Template +# WTTR BOT Only 3 dependencies required to run this bot! diff --git a/commands/Info/modalExample.js b/commands/Info/modalExample.js deleted file mode 100644 index 9b136c7..0000000 --- a/commands/Info/modalExample.js +++ /dev/null @@ -1,66 +0,0 @@ -const { EmbedBuilder } = require('discord.js'); -const { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); - -module.exports = { - name: "modal-example", - description: "Show a demo modal!", - - run: async (client, interaction) => { - - // Declare a random var for the main modal - Each Session - let rand = Math.floor(Math.random() * 99999999999999).toString(); - - // Check if this is a chatInput - if (!interaction.isChatInputCommand()) return; - - // await interaction.deferReply(); - const modal = new ModalBuilder() - .setCustomId(rand) - .setTitle('This is an example modal'); - - // TODO: Add components to modal... - const modalInputData = new TextInputBuilder() - .setCustomId('modalInput') - // The label is the prompt the user sees for this input - .setLabel("What text do you want to send?") - // Short means only a single line of text - .setStyle(TextInputStyle.Paragraph); - - // An action row only holds one text input, - // so you need one action row per text input. - const modalInputRow = new ActionRowBuilder().addComponents([modalInputData]); - - // Add inputs to the modal - modal.addComponents([modalInputRow]); - - await interaction.showModal(modal); - - client.on('interactionCreate', interaction => { - - // Do not continue if its a modal - if (interaction.type == "modal") return - // Interaction type is 5 == Modal - if (interaction.type === 5) { - - // Make sure we are working with our users modal only - if (interaction.customId === rand) { - - // Get the data entered by the user - let modalInputDataString = interaction.fields.getTextInputValue('modalInput'); - - console.log(modalInputDataString) - - const embed = new EmbedBuilder() - // Set color to blue - .setColor("#FF0000") - .setTitle("Your input!") - .setDescription(`You said: ${modalInputDataString}`) - .setTimestamp() - .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); - interaction.reply({ embeds: [embed] }); - } - } - }) - - } -} diff --git a/commands/Info/ping.js b/commands/Info/ping.js index 9a6b3d6..4cb692b 100644 --- a/commands/Info/ping.js +++ b/commands/Info/ping.js @@ -1,17 +1,25 @@ const { EmbedBuilder } = require('discord.js'); module.exports = { - name: "ping", - private: true, - description: "Returns websocket latency", - + name: "weather", + description: "Get the weather for a location", + private: false, + options: [{ + name: "location", + description: "The data you would like inside of the QR", + required: true, + type: 3 // 6 is type USER + }], run: async (client, interaction) => { + let encodedLocation = encodeURIComponent(interaction.options._hoistedOptions[0].value); + let location = interaction.options._hoistedOptions[0].value; + const embed = new EmbedBuilder() .setColor("#FF0000") - .setTitle("🏓 Pong!") - .setDescription(`Latency : ${client.ws.ping}ms`) + .setTitle(`The weather for: ${location}`) .setTimestamp() + .setImage(`https://wttr.in/${encodedLocation}.png`) .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); - interaction.followUp({ embeds: [embed] }); + await interaction.editReply({ embeds: [embed] }); }, }; diff --git a/commands/context/ping.js b/commands/context/ping.js deleted file mode 100644 index ed946c5..0000000 --- a/commands/context/ping.js +++ /dev/null @@ -1,16 +0,0 @@ -const { EmbedBuilder } = require('discord.js'); -const {ApplicationCommandType } = require('discord.js'); - -module.exports = { - name: "ping-test", - type: ApplicationCommandType.Message, - run: async (client, interaction) => { - const embed = new EmbedBuilder() - .setColor("#FF0000") - .setTitle("🏓 Pong!") - .setDescription(`Latency : ${client.ws.ping}ms`) - .setTimestamp() - .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); - interaction.followUp({ embeds: [embed] }); - }, -};