Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js")
- require("dotenv").config()
- const generateImage = require("./generateImage")
- const TOKEN = "mytoken :)"
- const client = new Discord.Client({
- intents: [
- "Guilds",
- "GuildMessages",
- "GuildMembers"
- ]
- })
- let bot = {
- client
- }
- client.on("ready", () => {
- console.log(`Logged In As ${client.user.tag}`)
- })
- client.commands = new Discord.Collection()
- client.events = new Discord.Collection()
- module.exports = bot
- client.slashcmds = new Discord.Collection()
- client.loadSlashcommands = (bot, reload) => require("./handlers/slashcommands")(bot, reload)
- client.loadSlashcommands(bot, false)
- client.on("interactionCreate", (interaction) => {
- if (!interaction.isCommand()) return
- if (!interaction.inGuild()) return interaction.reply("This command can only be used in a server!")
- const slashcmd = client.slashcommands.get(interaction.commandName)
- if(!slashcmd) return interaction.reply("Invalid Slash Command")
- if (slashcmd.perms && !interaction.member.permissions.has(slashcmd.perm))
- return interaction.reply("You do not have permission for this command!")
- slashcmd.run(client, interaction)
- })
- client.login(process.env.TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment