mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:40:19 +00:00
Restoring capability to use messageCreate event.
This commit is contained in:
parent
5e53a908e7
commit
f786abebe4
@ -11,6 +11,7 @@ const GatewayIntents = new Discord.Intents();
|
||||
GatewayIntents.add(
|
||||
1 << 0, // GUILDS
|
||||
1 << 7, // GUILD_VOICE_STATES
|
||||
1 << 9 // GUILD_MESSAGES
|
||||
);
|
||||
|
||||
class RadioClient extends Client {
|
||||
@ -46,12 +47,19 @@ class RadioClient extends Client {
|
||||
require(`${events}ready`).execute(this);
|
||||
this.datastore = new Datastore();
|
||||
});
|
||||
|
||||
this.on("messageCreate", msg => {
|
||||
require(`${events}messageCreate`).execute(this, msg);
|
||||
});
|
||||
|
||||
this.on("interactionCreate", interaction => {
|
||||
require(`${events}interactionCreate`).execute(this, interaction);
|
||||
});
|
||||
|
||||
this.on("voiceStateUpdate", (oldState, newState) => {
|
||||
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
||||
});
|
||||
|
||||
this.on("error", error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
37
src/client/events/messageCreate.js
Normal file
37
src/client/events/messageCreate.js
Normal file
@ -0,0 +1,37 @@
|
||||
import Discord from "discord.js";
|
||||
module.exports = {
|
||||
name: 'messageCreate',
|
||||
async execute(client, msg) {
|
||||
|
||||
if (msg.author.bot || !msg.guild) return;
|
||||
let prefix = "rx$";
|
||||
if(client.user.username == "RadioX"){
|
||||
prefix = "rx>";
|
||||
} else if (client.user.username == "RadioX Beta"){
|
||||
prefix = "rx-";
|
||||
} else if (client.user.username == "RadioX Dev"){
|
||||
prefix = "rx$";
|
||||
} else if(msg.mentions.members.first() && msg.mentions.members.first().user.id === client.user.id){
|
||||
prefix = "<@!" + client.user.id + "> ";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
const args = msg.content.slice(prefix.length).split(' ');
|
||||
if (!msg.content.startsWith(prefix)) return;
|
||||
if (!args[0]) return;
|
||||
const commandName = args[0].toLowerCase();
|
||||
if (commandName === 'none') return;
|
||||
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;
|
||||
const permissions = msg.channel.permissionsFor(msg.client.user);
|
||||
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
|
||||
try {
|
||||
|
||||
|
||||
} catch (error) {
|
||||
msg.reply(client.messages.runningCommandFailed);
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user