Kod Terminal komutlarını çalıştırın

!Edip#0170
Katılım
1 Eyl 2021
Mesajlar
170
Tepkime puanı
106
Şehir
İzmir
JavaScript:
const {
    MessageEmbed
} = require('discord.js')
const { SlashCommandBuilder } = require('@discordjs/builders')
const process = require('child_process')

module.exports = {
    data: new SlashCommandBuilder()
    .setName('cmd')
    .setDescription('Terminal komutlarını çalıştırın')
    .addStringOption(option => option.setName('command').setDescription('Yürütmek istediğiniz komut!').setRequired(true)),
    async execute(interaction, client) {
        if(!client.config.settings.owners.includes(interaction.user.id)) return interaction.reply({content: 'Bu komutu kullanmanıza izin yok!', ephemeral: true})

        const command = interaction.options.getString('command')
        
        const msg = await interaction.reply({content: 'Running Shell'})

        process.exec(command, (error, stdout) => {
            let result = (stdout || error)
            interaction.editReply(`\`\`\`asciidoc\n${result}\n\`\`\``, {split: '\n'}).catch(err => {
                const errbed = new MessageEmbed()
                .setTitle('Hata')
                .setDescription(`${err}`)
                .setColor('RED')

                interaction.channel.send({embeds: [errbed]})
            })
        })
    }
}
 

Konuyu 1 kişi okuyor. (0 kayıtlı üye ve 1 ziyaretçi)

  • Bilgi