Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -229,7 +229,7 @@ client.once('ready', async () => {
|
|
| 229 |
const channel = await guild.channels.fetch(config.autoFriendlyChannel).catch(() => null);
|
| 230 |
if (channel && channel.isTextBased()) {
|
| 231 |
const needed = 7;
|
| 232 |
-
const content =
|
| 233 |
const msg = await channel.send({ content, allowedMentions: { parse: ['everyone'] } });
|
| 234 |
await msg.react('🟩');
|
| 235 |
await msg.react('🟥');
|
|
@@ -333,7 +333,7 @@ client.on('messageCreate', async (message) => {
|
|
| 333 |
if (commandName === 'friendly') {
|
| 334 |
if (!roleStorage.isWhitelisted(message.guildId, message.member)) return message.reply("❌ No Permission");
|
| 335 |
const needed = parseInt(args[0]) || 7;
|
| 336 |
-
const content =
|
| 337 |
const msg = await message.channel.send({ content, allowedMentions: { parse: ['everyone'] } });
|
| 338 |
await msg.react('🟩');
|
| 339 |
await msg.react('🟥');
|
|
@@ -805,7 +805,7 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 805 |
if (interaction.commandName === 'friendly') {
|
| 806 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|
| 807 |
const needed = interaction.options.getInteger('needed') || 7;
|
| 808 |
-
const content =
|
| 809 |
const msg = await safeReply(interaction, { content, fetchReply: true, allowedMentions: { parse: ['everyone'] } });
|
| 810 |
if (msg) {
|
| 811 |
await msg.react('🟩').catch(() => { });
|
|
@@ -1536,7 +1536,16 @@ function createLineupView(guildId) {
|
|
| 1536 |
new ButtonBuilder().setCustomId('lineup_clear').setLabel('Clear Board').setStyle(ButtonStyle.Danger)
|
| 1537 |
));
|
| 1538 |
|
| 1539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1540 |
}
|
| 1541 |
|
| 1542 |
|
|
|
|
| 229 |
const channel = await guild.channels.fetch(config.autoFriendlyChannel).catch(() => null);
|
| 230 |
if (channel && channel.isTextBased()) {
|
| 231 |
const needed = 7;
|
| 232 |
+
const content = getFriendlyText(guild.id, needed);
|
| 233 |
const msg = await channel.send({ content, allowedMentions: { parse: ['everyone'] } });
|
| 234 |
await msg.react('🟩');
|
| 235 |
await msg.react('🟥');
|
|
|
|
| 333 |
if (commandName === 'friendly') {
|
| 334 |
if (!roleStorage.isWhitelisted(message.guildId, message.member)) return message.reply("❌ No Permission");
|
| 335 |
const needed = parseInt(args[0]) || 7;
|
| 336 |
+
const content = getFriendlyText(message.guildId, needed);
|
| 337 |
const msg = await message.channel.send({ content, allowedMentions: { parse: ['everyone'] } });
|
| 338 |
await msg.react('🟩');
|
| 339 |
await msg.react('🟥');
|
|
|
|
| 805 |
if (interaction.commandName === 'friendly') {
|
| 806 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|
| 807 |
const needed = interaction.options.getInteger('needed') || 7;
|
| 808 |
+
const content = getFriendlyText(interaction.guildId, needed);
|
| 809 |
const msg = await safeReply(interaction, { content, fetchReply: true, allowedMentions: { parse: ['everyone'] } });
|
| 810 |
if (msg) {
|
| 811 |
await msg.react('🟩').catch(() => { });
|
|
|
|
| 1536 |
new ButtonBuilder().setCustomId('lineup_clear').setLabel('Clear Board').setStyle(ButtonStyle.Danger)
|
| 1537 |
));
|
| 1538 |
|
| 1539 |
+
const config = storage.data.config[guildId] || {};
|
| 1540 |
+
const content = config.lineupText || "@everyone\n**Lineup Session Active!**";
|
| 1541 |
+
|
| 1542 |
+
return { content, embeds: [embed], components: rows, allowedMentions: { parse: ['everyone'] } };
|
| 1543 |
+
}
|
| 1544 |
+
|
| 1545 |
+
function getFriendlyText(guildId, needed) {
|
| 1546 |
+
const config = storage.data.config[guildId] || {};
|
| 1547 |
+
let text = config.friendlyText || "⭐▬▬▬▬▬ **FRIENDLY** ▬▬▬▬▬⭐\n🤝 Session\n🟩 I'm In\n🟥 Busy\n⭐▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬⭐\n🗳️ Needed: {needed}\n@everyone";
|
| 1548 |
+
return text.replace('{needed}', needed);
|
| 1549 |
}
|
| 1550 |
|
| 1551 |
|