Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev with main #102

Merged
merged 39 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
972855f
Fix help
mezotv Apr 22, 2023
eede901
feat: wwyd replay button
mezotv Apr 23, 2023
288e035
Resolve minor bigs
mezotv Apr 23, 2023
985a623
Error Catch
forgetfulskybro Apr 26, 2023
6e1e7e3
Remove some questions
mezotv Apr 28, 2023
356c22b
Delete replay.js
mezotv Apr 30, 2023
ad1cbd0
Remove vote buttons to cooldown
mezotv May 1, 2023
4eb646d
Change leave color
mezotv May 1, 2023
5e34ce1
Add truth or dare template
mezotv May 4, 2023
844cbb8
Added Replay Channels
forgetfulskybro May 4, 2023
f84482a
Added Replay Channels
forgetfulskybro May 4, 2023
ad8bc83
Fixed wording
forgetfulskybro May 4, 2023
7e45cf3
Update interactionCreate.js
mezotv May 5, 2023
2652c90
remove nhie from dailymessage
mezotv May 6, 2023
44b4210
Switch to d.js v14.11
mezotv May 6, 2023
f913835
Fixed wyCustom
forgetfulskybro May 18, 2023
bdd3ec3
Delete Daily Role
forgetfulskybro May 19, 2023
d5a7c0e
Fixed button display
forgetfulskybro May 20, 2023
5512bb5
edit: info cmd
mezotv Jun 15, 2023
09bf60f
update: names info cmd
WouldYouGG Jun 15, 2023
0cc7f52
Merge pull request #72 from WouldYouGG/dev
WouldYouGG Jun 15, 2023
dacb70b
fix: dailyMessage
Jun 20, 2023
4f6dad7
fix: dailyMsg regular
Jun 23, 2023
192b2d4
rem: dare command
Jun 25, 2023
9a15e88
feat: welcome message translatio n
Jun 25, 2023
8725fd2
remove: truth command
Jun 25, 2023
41cafe9
rename: custom
Jun 25, 2023
41bc212
feat: type command (Unfinished)
Jun 25, 2023
38a007a
fix: missing example img
Jun 26, 2023
370241e
add: missing devs
Jun 26, 2023
28cd8a1
Added guide image
forgetfulskybro Jun 26, 2023
69c24bc
Merge branch 'dev' of https://github.com/Would-You-Bot/client into dev
forgetfulskybro Jun 26, 2023
ff5fafa
impr: cache system
Jul 1, 2023
cadd552
Added welcome tests & types
forgetfulskybro Jul 10, 2023
4a9b944
Merge branch 'main' into dev
mezotv Jul 16, 2023
2e95f48
Fixed default cooldown
forgetfulskybro Jul 16, 2023
63855b8
Merge branch 'dev' of https://github.com/Would-You-Bot/client into dev
forgetfulskybro Jul 16, 2023
9853d6b
Fixed bypassed buttons
forgetfulskybro Jul 29, 2023
2947136
Fixed merge errors
forgetfulskybro Jul 29, 2023
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
44 changes: 37 additions & 7 deletions src/events/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = async (client, member) => {

const guildDb = await client.database.getGuild(member.guild.id, false);
if (guildDb && guildDb?.welcome) {
const channel = await member.guild.channels.fetch(guildguildDb.welcomeChannel).catch(err => {
const channel = await member.guild.channels.fetch(guildDb.welcomeChannel).catch(err => {
});

if (!channel?.id) return;
Expand Down Expand Up @@ -51,17 +51,47 @@ module.exports = async (client, member) => {
randomDaily = guildDb.customMessages.filter(c => c.type !== "nsfw")[Math.floor(Math.random() * guildDb.customMessages.filter(c => c.type !== "nsfw").length)].msg;
}

if (guildDb.customTypes === "regular") {
let array = [];
array.push(...General, ...WhatYouDo)
randomDaily = array[Math.floor(Math.random() * array.length)]
} else if (guildDb.customTypes === "mixed") {
let array = [];
if (guildDb.customMessages.filter(c => c.type !== "nsfw").length != 0) {
array.push(guildDb.customMessages.filter(c => c.type !== "nsfw")[Math.floor(Math.random() * guildDb.customMessages.filter(c => c.type !== "nsfw").length)].msg);
} else {
randomDaily = [...General, ...WhatYouDo]
}
array.push(...General, ...WhatYouDo)
randomDaily = array[Math.floor(Math.random() * array.length)]
} else if (guildDb.customTypes === "custom") {
if (guildDb.customMessages.filter(c => c.type !== "nsfw").length === 0) {
return this.client.webhookHandler.sendWebhook(
channel,
guildDb.dailyChannel,
{
content: 'There\'s currently no custom Would You messages to be displayed for daily messages! Either make new ones or turn off daily messages.',
},
guildDb.dailyThread
).catch(err => {
console.log(err);
});
}

randomDaily = guildDb.customMessages.filter(c => c.type !== "nsfw")[Math.floor(Math.random() * guildDb.customMessages.filter(c => c.type !== "nsfw").length)].msg;
}

let mention = null
if (guildDb.welcomePing) {mention = `<@${member.user.id}>`}
if (guildDb.welcomePing) { mention = `<@${member.user.id}>` }

let welcomeEmbed = new EmbedBuilder()
.setTitle(`${client.translation.get(guildDb?.language, 'Welcome.embed.title')} ${member.user.username}!`)
.setColor("#0598F6")
.setThumbnail(member.user.avatarURL())
.setDescription(randomDaily);
.setTitle(`${client.translation.get(guildDb?.language, 'Welcome.embed.title')} ${member.user.username}!`)
.setColor("#0598F6")
.setThumbnail(member.user.avatarURL())
.setDescription(randomDaily);


return channel.send({content: mention, embeds: [welcomeEmbed]}).catch((err) => {
return channel.send({ content: mention, embeds: [welcomeEmbed] }).catch((err) => {
console.log(err)
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = async (client, interaction) => {
ephemeral: true,
});
}
} else if (interaction.isButton()) {
} else if (interaction.isButton() && !restrict.includes(interaction.customId)) {
if (guildDb.replayType === "Guild" && client.used.has(interaction.user.id)) {
return interaction.reply({
ephemeral: true,
Expand All @@ -58,7 +58,7 @@ module.exports = async (client, interaction) => {
}).catch(() => { });

try {
if (!restrict.includes(interaction.customId) && !interaction.customId.startsWith("voting_") && !interaction.customId.startsWith("result_")) {
if (!interaction.customId.startsWith("voting_") && !interaction.customId.startsWith("result_")) {
if (guildDb.replayType === "Channels" && guildDb.replayChannels.find(x => x.id === interaction.channel.id)) {
client.used.set(`${interaction.user.id}-${interaction.channel.id}`, Date.now() + guildDb.replayChannels.find(x => x.id === interaction.channel.id).cooldown)
setTimeout(() => client.used.delete(`${interaction.user.id}-${interaction.channel.id}`), guildDb.replayChannels.find(x => x.id === interaction.channel.id).cooldown)
Expand Down