src/events/messageCreate.js
/**
     * @memberof Events
     * @alias messageCreate
     * @description Executed when the Event was triggerd. 
     * <br>See DiscordJs: {@Link https://discord.js.org/#/docs/discord.js/stable/class/Client?scrollTo=e-messageCreate messageCreate}
     * @param {Message} message Represents a message on Discord.
     */
@memberof Events
@alias messageCreate
@description Executed when the Event was triggerd.
@memberof Events @alias messageCreate @description Executed when the Event was triggerd .
async execute(message) {
            console.log(`[messageCreate][${message.guildId}][${message.channelId}][${message.author.id}][${message.id}] Triggerd with: "${message.content}"`);
        if (message.author.bot) return;
        if(message.content === "") return;
        const guildID = message.guildId;
        const client = message.client;
        let guildConfig = client.guildConfigs.get(`${guildID}`);
        if(!guildConfig) noGuildConfigsFound(guildID, this.name);
        if(!guildConfig) {
            const dbConfigs = await GuildConfig.findAll({
                where: {
                    guild_id: guildID
                }
            });
            dbConfigs.every(config => config instanceof GuildConfig);
            dbConfigs.forEach(config => client.guildConfigs.set(config.guild_id, config.dataValues));
            guildConfig = client.guildConfigs.get(`${guildID}`);
            if(!guildConfig) {
                console.log(`Try Load Guild Config with ID [${guildID}] from Database FAILED!`);
                return;
            }
            console.log(`Loaded Guild Config with ID [${guildID}] from Database!`);
        }
        if(!message.content.startsWith(guildConfig.prefix)) return;
        const args = message.content.substring(guildConfig.prefix.length).split(/ +/);
        const command = message.client.commands.find(cmd => cmd.name == args[0]);
        if(!command) return message.reply({ content: "That is not a valid command!", ephemeral: true });
        try {
            await command.execute(message, args, message.client);
            console.log(`[messageCreate][${message.guildId}][${message.channelId}][${message.author.id}][${message.id}] Successfully Executed Command!`);
        } catch (error) {
            console.error(`[messageCreate][${message.guildId}][${message.channelId}][${message.author.id}][${message.id}] ${error}`);
            await message.reply({ content: 'There was an error while executing this command!', ephemeral: true });
        }
    }
async execute ( message ) { console . log ( ` ${ message . guildId } ${ message . channelId } ${ message . author . id } ${ message . id } ${ message . content } ` ) ; if ( message . author . bot ) return ; if ( message . content === "" ) return ; const guildID = message . guildId ; const client = message . client ; let guildConfig = client . guildConfigs . get ( ` ${ guildID } ` ) ; if ( ! guildConfig ) noGuildConfigsFound ( guildID , this . name ) ; if ( ! guildConfig ) { const dbConfigs = await GuildConfig . findAll ( { where : { guild_id : guildID } } ) ; dbConfigs . every ( config => config instanceof GuildConfig ) ; dbConfigs . forEach ( config => client . guildConfigs . set ( config . guild_id , config . dataValues ) ) ; guildConfig = client . guildConfigs . get ( ` ${ guildID } ` ) ; if ( ! guildConfig ) { console . log ( ` ${ guildID } ` ) ; return ; } console . log ( ` ${ guildID } ` ) ; } if ( ! message . content . startsWith ( guildConfig . prefix ) ) return ; const args = message . content . substring ( guildConfig . prefix . length ) . split ( /  + / ) ; const command = message . client . commands . find ( cmd => cmd . name == args [ 0 ] ) ; if ( ! command ) return message . reply ( { content : "That is not a valid command!" , ephemeral : true } ) ; try { await command . execute ( message , args , message . client ) ; console . log ( ` ${ message . guildId } ${ message . channelId } ${ message . author . id } ${ message . id } ` ) ; } catch ( error ) { console . error ( ` ${ message . guildId } ${ message . channelId } ${ message . author . id } ${ message . id } ${ error } ` ) ; await message . reply ( { content : 'There was an error while executing this command!' , ephemeral : true } ) ; } }
@memberof Events
 @alias messageCreate
 @description Executed when the Event was triggerd.
@memberof Events @alias messageCreate @description Executed when the Event was triggerd .
//Log //Ignor Bot Messages  //Ignor Empty Messages //Load Guild Config with GuildID from Memory //Check Guild exist in Memory //Check Guild exist in Database and assign if //Load Guild Configs to Memory from Database if exist //Check if Command with Prefix //Split in Args //Search in Commands Collection for Command //Check ifnot Valid Command //Execute Command