Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetfulskybro committed Oct 7, 2023
2 parents 34beaf8 + f96c3a0 commit de682ba
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 170 deletions.
50 changes: 50 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
### Issue Description

## Bug Report:

# Description:
Report a problem or error in the software.
# Expected Behavior:
Describe what should happen.
# Actual Behavior:
Explain what is happening instead.
# Steps to Reproduce:
Provide steps to reproduce the issue.
# Screenshots:
Attach screenshots if applicable.
# Related Issues/PRs:
List any related issues or pull requests.

## Feature Request:

# Description:
Propose a new feature or enhancement to the software.
# Expected Behavior:
Describe how the new feature should work.
# Rationale:
Explain why this feature would be beneficial.
# Related Issues/PRs:
Link to related issues or pull requests.

## Documentation Issue:

# Description:
Report an issue with the documentation.
# Type:
Specify if it's a documentation error, missing documentation, or unclear documentation.
# Page/Section:
Mention the affected documentation page or section.
# Suggested Improvement:
Provide suggestions for improvement.

## Question / Support Request:

# Description:
Ask a question or request help with using the software.
# Context:
Provide context or details about the problem you're facing.
# Expected Answer:
Describe what you're expecting in response.
# Additional Information:
Include any relevant information.

24 changes: 24 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

## Description

**Link to the issue (if applicable)**:
Provide a link to the related issue (e.g., #[issue_number]).

**Description**:
Explain the purpose and context of this PR.

## Changes Made

List the changes you made in this PR.

## Testing

Describe the testing process you followed to ensure that the changes in this PR are effective and do not introduce new issues. Include information about the test cases you ran or any manual testing steps.

## Screenshots (if applicable)

Add screenshots or GIFs to showcase the changes visually.

## Additional Notes

Include any additional information or context that reviewers should be aware of.
6 changes: 4 additions & 2 deletions src/buttons/higher.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ module.exports = {
client.translation.get(guildDb?.language, "HigherLower.description", {
keyword: game.items.current.keyword,
history: game.items.history[game.items.history.length - 1].keyword,
source: game.items.current.link,
source2: game.items.history[game.items.history.length - 1].link,
source: game.items.current.link || "https://wouldyoubot.gg/nolink",
source2:
game.items.history[game.items.history.length - 1].link ||
"https://wouldyoubot.gg/nolink",
}),
)
.setColor("Green")
Expand Down
6 changes: 4 additions & 2 deletions src/buttons/lower.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ module.exports = {
client.translation.get(guildDb?.language, "HigherLower.description", {
keyword: game.items.current.keyword,
history: game.items.history[game.items.history.length - 1].keyword,
source: game.items.current.link,
source2: game.items.history[game.items.history.length - 1].link,
source: game.items.current.link || "https://wouldyoubot.gg/nolink",
source2:
game.items.history[game.items.history.length - 1].link ||
"https://wouldyoubot.gg/nolink",
}),
)
.setColor("Green")
Expand Down
85 changes: 7 additions & 78 deletions src/buttons/welcomeTest.js
Original file line number Diff line number Diff line change
@@ -1,88 +1,17 @@
const { EmbedBuilder } = require("discord.js");
const Sentry = require("@sentry/node");

module.exports = {
data: {
name: "welcomeTest",
description: "Welcome Test",
},
async execute(interaction, client, guildDb) {
const { General } = await require(
`../data/rather-${guildDb.language}.json`,
);
const { WhatYouDo } = await require(
`../data/wwyd-${guildDb.language}.json`,
);

let randomDaily = [];
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) => {
Sentry.captureException(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 = `<@${interaction.member.user.id}>`;
}

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

return interaction.reply({
content: `${client.translation.get(
guildDb.language,
"Settings.welcomeTestSuccess",
)}\n\n ${mention ? mention : ""}`,
embeds: [welcomeEmbed],
ephemeral: true,
});
interaction
.reply({ content: "Welcome test has been sent!", ephemeral: true })
.catch((err) => {
Sentry.captureException(err);
});
},
};
7 changes: 5 additions & 2 deletions src/commands/higherlower.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ module.exports = {
keyword: game.items.current.keyword,
history:
game.items.history[game.items.history.length - 1].keyword,
source: game.items.current.link,
source2: game.items.history[game.items.history.length - 1].link,
source:
game.items.current.link || "https://wouldyoubot.gg/nolink",
source2:
game.items.history[game.items.history.length - 1].link ||
"https://wouldyoubot.gg/nolink",
},
)}`,
)
Expand Down
106 changes: 20 additions & 86 deletions src/events/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ module.exports = async (client, member) => {
)
return;
const { General } = await require(
`../../data/rather-${guildDb.language}.json`,
`../data/rather-${guildDb.language}.json`,
);
const { WhatYouDo } = await require(
`../../data/wwyd-${guildDb.language}.json`,
`../data/wwyd-${guildDb.language}.json`,
);

let randomDaily = [];
if (guildDb.customTypes === "regular") {
let randomMessage = [];
if (guildDb.welcomeType === "regular") {
let array = [];
array.push(...General, ...WhatYouDo);
randomDaily = array[Math.floor(Math.random() * array.length)];
} else if (guildDb.customTypes === "mixed") {
randomMessage = array[Math.floor(Math.random() * array.length)];
} else if (guildDb.welcomeType === "mixed") {
let array = [];
if (guildDb.customMessages.filter((c) => c.type !== "nsfw").length != 0) {
array.push(
Expand All @@ -50,101 +50,35 @@ module.exports = async (client, member) => {
].msg,
);
} else {
randomDaily = [...General, ...WhatYouDo];
randomMessage = [...General, ...WhatYouDo];
}
array.push(...General, ...WhatYouDo);
randomDaily = array[Math.floor(Math.random() * array.length)];
} else if (guildDb.customTypes === "custom") {
randomMessage = array[Math.floor(Math.random() * array.length)];
} else if (guildDb.welcomeType === "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) => {
Sentry.captureException(err);
});
}

randomDaily = guildDb.customMessages.filter((c) => c.type !== "nsfw")[
randomMessage = 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) => {
Sentry.captureException(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}>`;
}

let welcomeEmbed = new EmbedBuilder()
.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] })
.send({
content: `${client.translation.get(
guildDb?.language,
"Welcome.embed.title",
)} ${
guildDb.welcomePing
? `<@${member.user.id}>`
: `${member.user.username}`
}! ${randomMessage}`,
})
.catch((err) => {
Sentry.captureException(err);
});
Expand Down

0 comments on commit de682ba

Please sign in to comment.