Copy saja script berikut;
const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.js');
client.on('message', (message) {
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === 'say') {
let text = args.join(' ');
if (!text) return message.channel.send('Please provide a text you want me to say.');
message.channel.send(text);
message.delete();
}
if (command === 'embed') {
let text = args.join(' ');
if (!text) return message.channel.send('You don\'t provide any arguments for me to say in embed message!');
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(client.user.tag, client.user.displayAvatarURL())
.setDescription(text) // Di sini argumen user yang diambil diletakkan
.setFooter(`By ${message.author.tag}`, message.author.displayAvatarURL())
.setTimestamp(new Date());
message.channel.send(embed);
message.delete();
}
}); // Di sini kode pengaktif (client.on) ditutup
client.login(config.token);
const client = new Discord.Client();
const config = require('./config.js');
client.on('message', (message) {
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === 'say') {
let text = args.join(' ');
if (!text) return message.channel.send('Please provide a text you want me to say.');
message.channel.send(text);
message.delete();
}
if (command === 'embed') {
let text = args.join(' ');
if (!text) return message.channel.send('You don\'t provide any arguments for me to say in embed message!');
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(client.user.tag, client.user.displayAvatarURL())
.setDescription(text) // Di sini argumen user yang diambil diletakkan
.setFooter(`By ${message.author.tag}`, message.author.displayAvatarURL())
.setTimestamp(new Date());
message.channel.send(embed);
message.delete();
}
}); // Di sini kode pengaktif (client.on) ditutup
client.login(config.token);
0 komentar
Post a Comment