Spaces:
Runtime error
Runtime error
Update index.js
Browse files430 unmodified lines431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475430 unmodified lines return; }
if (commandName === 'friendly') { if (!roleStorage.isWhitelisted(message.guildId, message.member)) return sendNoPermission(message);
const mentionArg = args[0] ? args[0].toLowerCase().replace('@', '') : null; let needed = 6;
let pingType = 'everyone'; if (mentionArg === 'here' || mentionArg === 'everyone') { pingType = mentionArg; needed = parseInt(args[1]) || 6; } else if (parseInt(mentionArg)) { needed = parseInt(mentionArg); if (args[1] === 'here' || args[1] === 'everyone') { pingType = args[1]; } }
guildFriendlyPingType.set(message.guildId, pingType); saveLineup();
pollNeededCount.set(message.guildId, needed); let content = pingType === 'here' ? getFriendlyText(message.guildId, needed).replace('@everyone', '@here') : getFriendlyText(message.guildId, needed);
const msg = await message.channel.send({ content, allowedMentions: { parse: ['everyone'] } }); await msg.react('🟩').catch(() => {}); await msg.react('🟥').catch(() => {}); storage.data.active_polls[message.guildId] = msg.id; storage.save('active_polls');
const joined = new Set(); const filter = (reaction, user) => (reaction.emoji.name === '🟩' || reaction.emoji.name === "I'm In") && !user.bot; const collector = msg.createReactionCollector({ filter, time: 600000 }); collector.on('collect', (reaction, user) => { if (!joined.has(user.id)) { joined.add(user.id); msg.edit({ content: content + `\n\n${joined.size}/${needed} players joined. Waiting for more...` }); } if (joined.size >= needed) collector.stop('ready'); }); collector.on('end', async (col, reason) => { if (reason === 'ready') { const lineup = getGuildLineup(message.guildId);index.js+39