<commit_before>// Initialize **or load** the server configurations
const PersistentCollection = require("djs-collection-persistent");
// const guildSettings = new PersistentCollection({name: 'guildSettings'});

const Discord = require('discord.js');
// const client = new Discord.Client();
// const guildSettings = client.guildSettings;

module.exports = member => {
    // This executes when a member joins, so let's welcome them!
    const guildSettings = member.client.guildSettings;
    const guildConf = guildSettings.get(member.guild.id);
    // console.log(`Member joined, name is ${member.displayName}, to the guild ${member.guild.id}`);

    // Our welcome message has a bit of a placeholder, let's fix
    if(guildConf.welcomeMessageOn && guildConf.welcomeMessage !== "") { // If they have it turned on, and it's not empty
        const welcomeMessage = guildConf.welcomeMessage.toString();
        console.log(`New member joined, welcome message should be "${welcomeMessage}" before the replalce.`)
        if(welcomeMessage.includes("{{user}}")) {  // So id doesn't crash if it's not there
            welcomeMessage.replace("{{user}}", member.user.tag);
            console.log(`And welcome message should be "${welcomeMessage}" after the replalce.`)
        }
        // We'll send to the default channel - not the best practice, but whatever
        member.guild.defaultChannel.send(welcomeMessage).catch(console.error);
    }

};<commit_msg>Fixed the welcome message so it should replace {{user}} with the user now<commit_after>// Initialize **or load** the server configurations
const PersistentCollection = require("djs-collection-persistent");
// const guildSettings = new PersistentCollection({name: 'guildSettings'});

const Discord = require('discord.js');
// const client = new Discord.Client();
// const guildSettings = client.guildSettings;

module.exports = member => {
    // This executes when a member joins, so let's welcome them!
    const guildSettings = member.client.guildSettings;
    const guildConf = guildSettings.get(member.guild.id);
    // console.log(`Member joined, name is ${member.displayName}, to the guild ${member.guild.id}`);

    // Our welcome message has a bit of a placeholder, let's fix
    if(guildConf.welcomeMessageOn && guildConf.welcomeMessage !== "") { // If they have it turned on, and it's not empty
        const welcomeMessage = guildConf.welcomeMessage.toString();
        console.log(`New member joined, welcome message should be "${welcomeMessage}" before the replalce.`)
        if(welcomeMessage.includes("{{user}}")) {  // So id doesn't crash if it's not there
            welcomeMessage = welcomeMessage.replace("{{user}}", member.user.tag);
            console.log(`And welcome message should be "${welcomeMessage}" after the replalce.`)
        }
        // We'll send to the default channel - not the best practice, but whatever
        member.guild.defaultChannel.send(welcomeMessage).catch(console.error);
    }

};
{'fraction_non_alphanumeric': 0.12470745570043464, 'fraction_numerical': 0.0, 'mean_word_length': 3.7416798732171155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4086621', 'n_tokens_mistral': 818, 'n_tokens_neox': 787, 'n_words': 257}