mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 01:53:17 +00:00
Updated messageCreate event
This commit is contained in:
parent
4ccace9450
commit
ba5b142bbe
@ -1,9 +1,9 @@
|
|||||||
import Discord from "discord.js";
|
import Discord from "discord.js";
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'messageCreate',
|
name: 'messageCreate',
|
||||||
async execute(client, msg) {
|
async execute(client, message) {
|
||||||
|
|
||||||
if (msg.author.bot || !msg.guild) return;
|
if (message.author.bot || !message.guild) return;
|
||||||
let prefix = "rx$";
|
let prefix = "rx$";
|
||||||
if(client.user.username == "RadioX"){
|
if(client.user.username == "RadioX"){
|
||||||
prefix = "rx>";
|
prefix = "rx>";
|
||||||
@ -11,41 +11,41 @@ module.exports = {
|
|||||||
prefix = "rx-";
|
prefix = "rx-";
|
||||||
} else if (client.user.username == "RadioX Dev"){
|
} else if (client.user.username == "RadioX Dev"){
|
||||||
prefix = "rx$";
|
prefix = "rx$";
|
||||||
} else if(msg.mentions.members.first() && msg.mentions.members.first().user.id === client.user.id){
|
} else if(message.mentions.members.first() && message.mentions.members.first().user.id === client.user.id){
|
||||||
prefix = "<@!" + client.user.id + "> ";
|
prefix = "<@!" + client.user.id + "> ";
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = msg.content.slice(prefix.length).split(' ');
|
const args = message.content.slice(prefix.length).split(' ');
|
||||||
if (!msg.content.startsWith(prefix)) return;
|
if (!message.content.startsWith(prefix)) return;
|
||||||
if (!args[0]) return;
|
if (!args[0]) return;
|
||||||
const commandName = args[0].toLowerCase();
|
const commandName = args[0].toLowerCase();
|
||||||
if (commandName === 'none') return;
|
if (commandName === 'none') return;
|
||||||
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
||||||
if (!command && msg.content !== `${prefix}`) return;
|
if (!command && message.content !== `${prefix}`) return;
|
||||||
const permissions = msg.channel.permissionsFor(msg.client.user);
|
const permissions = message.channel.permissionsFor(message.client.user);
|
||||||
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
|
if (!permissions.has('EMBED_LINKS')) return message.channel.send(client.messages.noPermsEmbed);
|
||||||
try {
|
try {
|
||||||
let message = {};
|
let newMessage = {};
|
||||||
|
|
||||||
message.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username);
|
newMessage.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username);
|
||||||
|
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle(message.messageCommandsDeprecatedTitle)
|
.setTitle(newMessage.messageCommandsDeprecatedTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.setDescription(client.messages.messageCommandsDeprecatedDescription)
|
.setDescription(client.messages.messageCommandsDeprecatedDescription)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||||
|
|
||||||
msg.channel.send({ embeds: [embed] });
|
let msg = await message.channel.send({ embeds: [embed] });
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
msg.delete();
|
msg.delete();
|
||||||
}, 30000);
|
}, 30000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
msg.reply({
|
message.reply({
|
||||||
content: client.messages.runningCommandFailed,
|
content: client.messages.runningCommandFailed,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user