diff --git a/controller/api.js b/controller/api.js index 4f2a658..b109549 100644 --- a/controller/api.js +++ b/controller/api.js @@ -50,6 +50,8 @@ exports.guildData = (io,bot)=> var aux = await getSpecificGuildData(guild.id); var roleRules = aux ? await getRoleRules(guild.id):null; + var guildTextChannels = aux ? aux.TextChannels:null; + const dataObject = { id:guild.id, @@ -60,7 +62,8 @@ exports.guildData = (io,bot)=> features:guild.features, hasRem:aux.extra?true:false, memberCount:aux.extra?aux.extra.memberCount:null, - roleRules + roleRules, + guildTextChannels }; resolve(dataObject); @@ -80,9 +83,26 @@ exports.guildData = (io,bot)=> { if(err || guild.length==0) return; return {guild}; - }) - return {guild, extra}; + }); + var TextChannels = []; + if(extra) + { + for(channel of extra.channels.cache) + { + if(channel[1].type==0) + { + TextChannels.push( + { + 'id':channel[0], + 'name':channel[1].name + }); + } + } + } + + return {guild, extra, TextChannels}; } + async function getRoleRules(guildid) { return await roleRulesM.find({gID:guildid}).then((err, rules)=>