Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

65 changes: 38 additions & 27 deletions events/onReady.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
const { ActivityType } = require('discord.js');
const { ActivityType } = require("discord.js");

module.exports = {
name: 'ready',
once: true,
execute(client) {
console.log(`[CLIENT] Logged in as ${client.user.tag}!`);
status(client);
name: "ready",
once: true,
execute(client) {
console.log(`[CLIENT] Logged in as ${client.user.tag}!`);
status(client);

client.guilds.fetch(process.env.GUILD).then(guild => {
guild.channels
.fetch('1006080822215966741')
.then(channel => {
channel.setName(`User Count: ${guild.memberCount - guild.members.cache.filter(m => m.user.bot).size}`).catch(e => console.error(`[ERROR]: ${e}`));
})
.catch(e => console.error(`[ERROR]: ${e}`));
});
}
client.guilds.fetch(process.env.GUILD).then((guild) => {
guild.channels
.fetch("1006080822215966741")
.then((channel) => {
channel
.setName(
`User Count: ${guild.memberCount - guild.members.cache.filter((m) => m.user.bot).size}`,
)
.catch((e) => console.error(`[ERROR]: ${e}`));
})
.catch((e) => console.error(`[ERROR]: ${e}`));
});
},
};

function status(client) {
setInterval(() => {
let key = [
{ type: ActivityType.Watching, data: 'people not read FAQ' },
{ type: ActivityType.Watching, data: 'devs push back releases' },
{ type: ActivityType.Playing, data: 'PlayCover' },
{ type: ActivityType.Playing, data: 'with roeegh' },
{ type: ActivityType.Playing, data: 'with depression' }
];
let rand = key[Math.floor(Math.random() * key.length)];
setInterval(() => {
let key = [
{ type: ActivityType.Watching, data: "people not read FAQ" },
{ type: ActivityType.Watching, data: "devs push back releases" },
{ type: ActivityType.Playing, data: "PlayCover" },
{ type: ActivityType.Playing, data: "gacha games" },
];
let rand = key[Math.floor(Math.random() * key.length)];

client.user.setPresence({ activities: [{ name: rand.data, type: rand.type }] });
}, 5 * 60000);
setTimeout(() => client.user.setPresence({ activities: [{ name: '/help', type: ActivityType.Watching }] }), 60000);
client.user.setPresence({
activities: [{ name: rand.data, type: rand.type }],
});
}, 5 * 60000);
setTimeout(
() =>
client.user.setPresence({
activities: [{ name: "/help", type: ActivityType.Watching }],
}),
60000,
);
}
54 changes: 40 additions & 14 deletions events/threadCreate.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
const { EmbedBuilder } = require("discord.js");

module.exports = {
name: 'threadCreate',
async execute(channel) {
if (channel.parentId != '1019859452352020540') return;
name: "threadCreate",
async execute(channel) {
if (channel.parentId != "1019859452352020540") return;

try {
const templateCheckFalse = new EmbedBuilder()
.setDescription(
`You have created a post without using the required template. Support to your issue might be delayed.`,
)
.setTimestamp()
.setFooter({
text: `Post template not used.`,
iconURL: `https://i.imgur.com/ZdGKYWh.png`,
})
.setColor("#e6ce1c");

const useSolveCommand = new EmbedBuilder()
.setDescription(
`Please use \`/solved\` to delete this post when your issue has been resolved.`,
)
.setTimestamp()
.setColor("#78D7A3");

try {
let templateCheck = await channel.messages
.fetch()
.then(messages => messages.filter(message => message.author.id === channel.ownerId))
.then(msg => {
return msg.first().content;
});
!templateCheck.includes('I have read the documentation and searched for previously created posts about this') ? channel.send('You have created a post without using the required template.') : null;
channel.send("Please use `/solved` to delete this post when you're done.");
} catch (e) {}
}
let templateCheck = await channel.messages
.fetch()
.then((messages) =>
messages.filter((message) => message.author.id === channel.ownerId),
)
.then((msg) => {
return msg.first().content;
});
!templateCheck.includes(
"I have read the documentation and searched for previously created posts about this",
)
? channel.send({ embeds: [templateCheckFalse] })
: null;
channel.send({ embeds: [useSolveCommand] });
} catch (e) {}
},
};
39 changes: 0 additions & 39 deletions interactions/slash/users/clt.js

This file was deleted.

72 changes: 44 additions & 28 deletions interactions/slash/users/docs.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,50 @@
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder, SlashCommandBuilder } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName('docs')
.setDescription('Get the link to the PlayCover Documentation (PlayBook)')
.addStringOption(option => option.setName('page').setDescription('Specify a Doc page').setAutocomplete(true))
.addUserOption(option => option.setName('user').setDescription('User to ping in reply')),
data: new SlashCommandBuilder()
.setName("docs")
.setDescription("Get the link to the PlayCover Documentation (PlayBook)")
.addStringOption((option) =>
option
.setName("page")
.setDescription("Specify a Doc page")
.setAutocomplete(true),
)
.addUserOption((option) =>
option.setName("user").setDescription("User to ping in reply"),
),

async execute(interaction) {
let specified = interaction.options.getString('page');
let user = interaction.options.getUser('user');
let embed = new EmbedBuilder();
async execute(interaction) {
let specified = interaction.options.getString("page");
let user = interaction.options.getUser("user");
let embed = new EmbedBuilder();

if (specified) {
embed
.setTitle(`${specified}`)
.setDescription(`[Click here to open this page on PlayBook](https://${require('../../../resources/pages.json').find(page => page.name == specified).url})`)
.setAuthor({ name: 'PlayCover Documentation' })
.setThumbnail(interaction.guild.iconURL());
} else {
embed.setTitle('Click here to open PlayBook').setURL('https://docs.playcover.io/').setAuthor({ name: 'PlayCover Documentation' }).setThumbnail(interaction.guild.iconURL()).setColor('Random');
}
if (specified) {
embed
.setTitle(`${specified}`)
.setDescription(
`[Click here to open this page on PlayBook](https://${require("../../../resources/pages.json").find((page) => page.name == specified).url})`,
)
.setAuthor({ name: "PlayCover Documentation" })
.setThumbnail(interaction.guild.iconURL());
} else {
embed
.setTitle("Click here to open PlayBook")
.setURL("https://docs.playcover.io/")
.setAuthor({ name: "PlayCover Documentation" })
.setThumbnail(interaction.guild.iconURL())
.setColor("Random");
}

return interaction
.reply({
content: user ? `${user.toString()}, ${interaction.member.toString()} wanted you to see this command` : null,
allowedMentions: { users: [user ? user.id : null] },
embeds: [embed],
ephemeral: user ? false : true
})
.catch(error => console.error(`[ERROR]: ${error}`));
}
return interaction
.reply({
content: user
? `${user.toString()}, ${interaction.member.toString()} wanted you to see the documentation`
: null,
allowedMentions: { users: [user ? user.id : null] },
embeds: [embed],
ephemeral: user ? false : true,
})
.catch((error) => console.error(`[ERROR]: ${error}`));
},
};
133 changes: 90 additions & 43 deletions interactions/slash/users/download.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,96 @@
const { EmbedBuilder, SlashCommandBuilder, AttachmentBuilder } = require('discord.js');
const stableAndPre = new AttachmentBuilder('./resources/stable.png');
const nightly = new AttachmentBuilder('./resources/nightly.png');
const {
EmbedBuilder,
SlashCommandBuilder,
AttachmentBuilder,
} = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName('download')
.setDescription('Get the download link for PlayCover')
.addStringOption(option => option.setName('release').setDescription('The release of PlayCover you want to download').setRequired(true).addChoices({ name: 'Stable', value: 'stable' }, { name: 'Pre-Release', value: 'pre-release' }, { name: 'Nightly', value: 'nightly' }))
.addUserOption(option => option.setName('user').setDescription('User to ping in reply')),
data: new SlashCommandBuilder()
.setName("download")
.setDescription("Get the download link for PlayCover")
.addStringOption((option) =>
option
.setName("release")
.setDescription("The release of PlayCover you want to download")
.setRequired(true)
.addChoices(
{ name: "Stable", value: "stable" },
{ name: "Nightly", value: "nightly" },
),
)
.addUserOption((option) =>
option.setName("user").setDescription("User to ping in reply"),
),

async execute(interaction) {
var title, description, thumbnail, file;
const release = interaction.options.getString('release');
const user = interaction.options.getUser('user');
const releaseData = await fetch('https://api.github.com/repos/playcover/playcover/releases').then(res => res.json());
async execute(interaction) {
var title, url, author, color, description, icon;
const release = interaction.options.getString("release");
const user = interaction.options.getUser("user");
const releaseData = await fetch(
"https://api.github.com/repos/playcover/playcover/releases",
).then((res) => res.json());

switch (release) {
case 'stable':
title = 'Stable';
description = `[Click here to download](${releaseData.filter(release => release.prerelease === false)[0].assets[0].browser_download_url})`;
thumbnail = 'attachment://stable.png';
file = stableAndPre;
break;
case 'pre-release':
title = 'Pre-Release';
description = `[Click here to download](${releaseData.filter(release => release.prerelease === true)[0].assets[0].browser_download_url})`;
thumbnail = 'attachment://stable.png';
file = stableAndPre;
break;
case 'nightly':
title = 'Nightly';
description = `[Click here to download](https://nightly.link/playcover/playcover/workflows/2.nightly_release/develop)`;
thumbnail = 'attachment://nightly.png';
file = nightly;
break;
}
switch (release) {
case "stable":
title = `**Click here to download**`;
url = `${releaseData.filter((release) => release.prerelease === false)[0].assets[0].browser_download_url}`;
author = `PlayCover - Stable`;
description = `**Common errors:**`;
color = `#78D7A3`;
icon = `https://i.imgur.com/yaDJci8.png`;
break;

return interaction
.reply({
content: user ? `${user.toString()}, ${interaction.member.toString()} wanted you to see this command` : null,
allowedMentions: { users: [user ? user.id : null] },
embeds: [new EmbedBuilder().setTitle(title).setDescription(description).setThumbnail(thumbnail).setColor('Random')],
ephemeral: user ? false : true,
files: [file]
})
.catch(error => console.error(`[ERROR]: ${error}`));
}
case "nightly":
title = `**Click here to download**`;
url = `https://nightly.link/playcover/playcover/workflows/2.nightly_release/develop`;
author = `PlayCover - Nightly`;
description = `**What is nightly build?**\nA build of PlayCover created every night(hence the word nightly). It is the most up-to-date version of PlayCover with the latest features, however it may have severe game-breaking bugs. It is recommended that you use nightly builds only if you know what you are doing.\n\n**Common errors:**`;
color = `#F0C44B`;
icon = `https://i.imgur.com/V7lY78f.png`;
break;
}

return interaction
.reply({
content: user
? `${user.toString()}, ${interaction.member.toString()} wanted you to see this command`
: null,
allowedMentions: { users: [user ? user.id : null] },
embeds: [
new EmbedBuilder()
.setTitle(title)
.setURL(url)
.setAuthor({
name: author,
iconURL: icon,
})
.setDescription(description)
.addFields(
{
name: "Apple can't check app for malicious software",
value: `
This error occours because PlayCover is not signed.
To override this warning:
1. Open \`System Settings\` on your Mac\n2. Open \`Privacy & Security\` tab in System Settings\n3. Scroll down and click \`Open Anyway\``,
inline: true,
},
{
name: "PlayCover Damaged and Can\’t Be Opened",
value: `
To fix this error:
1. Press \`Command + Space\` on your keyboard\n2. Type \`Terminal\` and press return\n3. Enter the following command: \`xattr -c /Applications/PlayCover.app\``,
inline: true,
},
)
.setTimestamp()
.setFooter({
text: "macOS Beta builds are not supported by PlayCover",
iconURL: "https://i.imgur.com/ZdGKYWh.png",
})
.setColor(color),
],
ephemeral: user ? false : true,
})
.catch((error) => console.error(`[ERROR]: ${error}`));
},
};
Loading