<commit_before>//Ties with the data "roles.json" and the other module "iam.js"
var roleManager = {};

roleManager.serverRoleDeleted = function(mod, client, role){
    logChannel = role.server.channels.find(function(x){return x.name=="logs"});
    for(var a = 0;a < mod.data[role.server.id].otherroles.length;a++){
        if(mod.data[role.server.id].otherroles[a] == role.id){
            mod.data[role.server.id].otherroles.splice(a,1);
            if(logChannel!=undefined)
                client.sendMessage(logChannel,`Removed ${role.name} from the list of assignable roles as it was deleted.`);
            break;
        }
    }
    for(var a = 0;a < mod.data[role.server.id].selfroles.length;a++){
        if(mod.data[role.server.id].selfroles[a] == role.id){
            mod.data[role.server.id].selfroles.splice(a,1);
            if(logChannel!=undefined)
                client.sendMessage(logChannel,`Removed ${role.name} from the list of self assignable roles as it was deleted.`);
            break;
        }
    }
}

roleManager.events = {
    "serverRoleDeleted" : roleManager.serverRoleDeleted
}

module.exports = roleManager;<commit_msg>Asserted server in rolemanager<commit_after>//Ties with the data "roles.json" and the other module "iam.js"
function assertServerExistance(server, data)//returns true if server existed in data and was the correct version prior to this call, otherwise ... false
{
    if(data[server.id] == undefined){
        data[server.id] = {selfroles:[],otherroles:[]};
        return false;
    }
    else{//if data is in old format
        if(!data[server.id].hasOwnProperty("selfroles")){
            data[server.id] = {selfroles:data[server.id],otherroles:[]};
            return false
        }
    }
    return true;
}

var roleManager = {};

roleManager.serverRoleDeleted = function(mod, client, role){
    assertServerExistance(role.server,mod.data);
    logChannel = role.server.channels.find(function(x){return x.name=="logs"});
    for(var a = 0;a < mod.data[role.server.id].otherroles.length;a++){
        if(mod.data[role.server.id].otherroles[a] == role.id){
            mod.data[role.server.id].otherroles.splice(a,1);
            if(logChannel!=undefined)
                client.sendMessage(logChannel,`Removed ${role.name} from the list of assignable roles as it was deleted.`);
            break;
        }
    }
    for(var a = 0;a < mod.data[role.server.id].selfroles.length;a++){
        if(mod.data[role.server.id].selfroles[a] == role.id){
            mod.data[role.server.id].selfroles.splice(a,1);
            if(logChannel!=undefined)
                client.sendMessage(logChannel,`Removed ${role.name} from the list of self assignable roles as it was deleted.`);
            break;
        }
    }
}

roleManager.events = {
    "serverRoleDeleted" : roleManager.serverRoleDeleted
}

module.exports = roleManager;
{'fraction_non_alphanumeric': 0.14370010413051024, 'fraction_numerical': 0.0027768136063866713, 'mean_word_length': 2.8788694481830417, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '623488', 'n_tokens_mistral': 914, 'n_tokens_neox': 913, 'n_words': 176}