Skip to content

Commit

Permalink
help command dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjanacheerla committed Sep 14, 2022
1 parent 58f0673 commit dc544e1
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
//do not delete needed for env
require('dotenv').config()
require("dotenv").config();

const { Client, GatewayIntentBits } = require('discord.js');
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

const { REST, Routes } = require('discord.js');
const clientId = '1017062749538361474';
const guildId = '1011989055736660061';
const { REST, Routes } = require("discord.js");
const clientId = "1017062749538361474";
const guildId = "1011989055736660061";

// slash commands
const commands = [
{
name: 'ping',
description: 'Replies with Pong!',
name: "ping",
description: "Replies with Pong!",
},
{
name: "help",
description: "help function for bot, lists commands",
},
];


//register slash commands
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
const rest = new REST({ version: "10" }).setToken(process.env.TOKEN);

(async () => {
try {
console.log('Started refreshing application (/) commands.');
console.log("Started refreshing application (/) commands.");

await rest.put(Routes.applicationCommands(clientId), { body: commands });

console.log('Successfully reloaded application (/) commands.');
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();


// run bot
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
})

client.login(process.env.TOKEN)
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on("interactionCreate", async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === "ping") {
await interaction.reply("Pong!");
}

if (interaction.commandName === "help") {
await interaction.reply("not yet");
}
});

client.login(process.env.TOKEN);

0 comments on commit dc544e1

Please sign in to comment.