|
|
|
@ -215,7 +215,10 @@ exports.updateRule = (bot)=>
|
|
|
|
|
var roleEmoji = args.emojiid;
|
|
|
|
|
var gID = args.gid;
|
|
|
|
|
var roleName;
|
|
|
|
|
if(!(mID && roleID && roleEmoji && gID)) return mID?(roleID?(roleEmoji? false: {error:'Emoji ID'}):{error:'Role ID'}):{error:'Message ID'};
|
|
|
|
|
if(!mID) return {error:'Message ID'}
|
|
|
|
|
if(!roleID) return {error:'Role ID'}
|
|
|
|
|
if(!roleEmoji) return {error:'Emoji ID'}
|
|
|
|
|
if(!gID) return {error:'Guild ID'}
|
|
|
|
|
var m = await (async ()=>
|
|
|
|
|
{
|
|
|
|
|
for(const [id, channel] of bot.channels.cache)
|
|
|
|
@ -230,7 +233,12 @@ exports.updateRule = (bot)=>
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
const r = bot.guilds.cache.get(gID).roles.cache.get(roleID);
|
|
|
|
|
const e = bot.guilds.cache.get(gID).emojis.cache.get(roleEmoji);
|
|
|
|
|
const e = bot.guilds.cache.get(gID).emojis.cache.get(roleEmoji);
|
|
|
|
|
bot.guilds.cache.get(gID).emojis.cache.forEach(emoji=>
|
|
|
|
|
{
|
|
|
|
|
if(emoji.name == 'tuturu') console.log(emoji)
|
|
|
|
|
})
|
|
|
|
|
console.log('Emoji', roleEmoji, e)
|
|
|
|
|
if(!m || !r || !e) return m?(r?(e?false:{error:'Emoji ID'}):{error:'Role ID'}):{error:'Message ID'}
|
|
|
|
|
roleName = r.name;
|
|
|
|
|
return {mID, roleID, roleEmoji, roleName, gID}
|
|
|
|
@ -450,9 +458,13 @@ exports.registerGame = async (req, res)=>
|
|
|
|
|
return false
|
|
|
|
|
})
|
|
|
|
|
if(!updated) return res.json({Error:'The game failed to register.'})
|
|
|
|
|
var _PA = update.PA;
|
|
|
|
|
_PA.extraData= update.PA.Name == GameData.info.PlayerA.summonerName? GameData.info.PlayerA: GameData.info.PlayerB;
|
|
|
|
|
var _PB = update.PB;
|
|
|
|
|
_PB.extraData = update.PA.Name == GameData.info.PlayerA.summonerName? GameData.info.PlayerA: GameData.info.PlayerB;
|
|
|
|
|
Game[0] = {
|
|
|
|
|
PA:update.PA,
|
|
|
|
|
PB:update.PB,
|
|
|
|
|
PA:_PA,
|
|
|
|
|
PB:_PB,
|
|
|
|
|
Winner:update.Winner,
|
|
|
|
|
WinCondition:update.WinCondition,
|
|
|
|
|
Played:true,
|
|
|
|
@ -671,7 +683,15 @@ exports.createLeaguePage = (req, res)=>
|
|
|
|
|
}
|
|
|
|
|
exports.createLeaguePage = (req, res)=>
|
|
|
|
|
{
|
|
|
|
|
//TODO: Render page;
|
|
|
|
|
res.render('createLeague');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.getGame = (req, res)=>
|
|
|
|
|
{
|
|
|
|
|
return res.render('game')
|
|
|
|
|
}
|
|
|
|
|
exports.getGameData = (req, res)=>
|
|
|
|
|
{
|
|
|
|
|
//TODO: getGameData
|
|
|
|
|
//TODO: send as json
|
|
|
|
|
}
|