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

Main #67

Merged
merged 77 commits into from
Apr 22, 2023
Merged

Main #67

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
1030655
Add questions
mezotv Feb 9, 2023
6eba6c2
Rather.js update
mezotv Feb 11, 2023
38e1dee
Add images and canvas command
mezotv Feb 13, 2023
310cb47
Fix bug + language support
mezotv Feb 13, 2023
da62c74
- Added debug command
fb-sean Feb 14, 2023
d4f2e8d
Add more questions
mezotv Feb 15, 2023
0aebea1
Added text resize
mezotv Feb 15, 2023
4854293
Add custom strings
mezotv Feb 15, 2023
7f3846d
Update3 days (#59)
mezotv Feb 17, 2023
66d8be2
Add translations
mezotv Feb 17, 2023
47387fb
Fix spanish translation
mezotv Feb 17, 2023
cb86695
Update help.js
mezotv Feb 17, 2023
ad01fa6
Fix debug string twist
mezotv Feb 18, 2023
a4373f2
Fixed debug check
mezotv Feb 18, 2023
c7e6cba
Update webhookHandler.js
mezotv Feb 18, 2023
22305b6
Adds testing debug
mezotv Feb 20, 2023
ce7afd4
Add debug mode
mezotv Feb 21, 2023
70b08fc
Finish new rather command
mezotv Feb 21, 2023
4b2a278
Created settings.js
forgetfulskybro Feb 23, 2023
091d2a9
Fix settings command and translation
mezotv Feb 23, 2023
c764547
Fixed emojis
forgetfulskybro Feb 23, 2023
6750bec
Merge branch 'quality-of-life-update' of https://github.com/Would-You…
forgetfulskybro Feb 23, 2023
c5fe522
Adds never have I ever mode
mezotv Feb 23, 2023
8b951c5
Deleted translations for welcome and dailyMsgs
forgetfulskybro Feb 23, 2023
f77ded4
Merge branch 'quality-of-life-update' of https://github.com/Would-You…
forgetfulskybro Feb 23, 2023
4efeace
More settings (unfinished)
mezotv Feb 23, 2023
4fc9435
Fixed embed
forgetfulskybro Feb 24, 2023
7e74dd3
Feat: emit command, user ping
mezotv Feb 24, 2023
61f1f04
Fix daily message
mezotv Feb 26, 2023
63e02a5
Fix ratelimit logs
mezotv Feb 26, 2023
0b1b11b
I hope?
fb-sean Feb 26, 2023
836ee8b
Added it to .filter() should be better
fb-sean Feb 26, 2023
62af0b1
Added it to .filter() should be better
fb-sean Feb 26, 2023
12fc5c6
Add more wwyd questions
mezotv Mar 1, 2023
22ed1cb
Improve either.js
mezotv Mar 4, 2023
c0a8c74
Merge branch 'main' of https://github.com/Would-You-Bot/Would-You int…
mezotv Mar 4, 2023
fa9630a
Resolve conflicts
mezotv Mar 4, 2023
f45ec24
Add either.js class
mezotv Mar 10, 2023
f0fc19f
Add replay and vote cooldown
mezotv Mar 11, 2023
0102b49
String + Either update
mezotv Mar 11, 2023
2e7d843
Update info.js
mezotv Mar 12, 2023
9fa3562
Merge branch 'quality-of-life-update' of https://github.com/Would-You…
fb-sean Mar 12, 2023
a7023a4
yeah... I'm sick of this
fb-sean Mar 12, 2023
ab62f74
yeah... I'm sick of this
mezotv Mar 17, 2023
e392435
feat: dailymsg Interval
mezotv Mar 17, 2023
1f35bfc
Added buttons to cooldown bypass
forgetfulskybro Mar 17, 2023
032fcf0
Change interval strings
mezotv Mar 18, 2023
72c4dc4
remove await
mezotv Mar 19, 2023
560c7ca
Formatting
mezotv Mar 22, 2023
42d079c
Added additional categories
forgetfulskybro Mar 23, 2023
2f91fd6
Removed old categories
forgetfulskybro Mar 23, 2023
6c72481
Removed old categories
forgetfulskybro Mar 23, 2023
2aad675
Finish dailymessage
mezotv Mar 24, 2023
e75143c
No clue what I was doing here
mezotv Mar 26, 2023
61b625d
Added dailyType
forgetfulskybro Mar 26, 2023
a91772d
Deleted wytype
forgetfulskybro Mar 26, 2023
9a64dba
Merge branch 'votingSystem' of https://github.com/Would-You-Bot/clien…
forgetfulskybro Mar 26, 2023
84fa0b3
Added types and ids
forgetfulskybro Mar 27, 2023
b061f22
Added toUpperCase
forgetfulskybro Mar 27, 2023
d5e9144
New language system
mezotv Apr 6, 2023
fb0971c
fix a blaring issue with mentions (#64)
DanPlayz0 Apr 8, 2023
84c0d12
Added not added translations but only at english bcs imagine I would …
fb-sean Apr 8, 2023
7edb5e8
Make full pie
mezotv Apr 8, 2023
5eb4277
Revert "Make full pie"
mezotv Apr 9, 2023
2de0ae0
thread on dailymsg
mezotv Apr 14, 2023
b58ec6c
Update discord and rest
mezotv Apr 14, 2023
8997994
Fix rest.post
mezotv Apr 15, 2023
2d49b14
Add thread support
mezotv Apr 15, 2023
6e3f493
Fix thread setting
mezotv Apr 15, 2023
7e12312
Update dailymsg
mezotv Apr 15, 2023
db360bf
Rework voting
mezotv Apr 16, 2023
d9380ab
Remove some old stuff
mezotv Apr 16, 2023
1650d6f
Linting
mezotv Apr 16, 2023
bfb6e22
Clean up files
mezotv Apr 17, 2023
0aa194d
Work on voting
mezotv Apr 21, 2023
30dd212
Finish update
mezotv Apr 22, 2023
cc40ef7
Merge branch 'main' of https://github.com/Would-You-Bot/client
mezotv Apr 22, 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
13 changes: 0 additions & 13 deletions Todo.md

This file was deleted.

131 changes: 131 additions & 0 deletions src/buttons/dailyInterval.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
const { ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require("discord.js");
const modalObject = {
title: "Daily Messages Interval",
custom_id: "dailyInterval",
components: [
{
type: 1,
components: [
{
type: 4,
style: 1,
custom_id: "input",
label: "Enter a 24 hour dailymsg interval (HH:MM).",
},
],
},
],
};

function isFormat(str) {
return /^(?:[01]\d|2[0-3]):(?:00|30)$/.test(str);
}

module.exports = {
data: {
name: "dailyInterval",
description: "Daily Interval customization",
},
async execute(interaction, client, guildDb) {
interaction.showModal(modalObject).catch(() => { })
interaction.awaitModalSubmit({
filter: (mInter) => mInter.customId === modalObject.custom_id,
time: 60000,
})
.then(async (modalInteraction) => {
const value = modalInteraction.components[0].components[0].value;

if (guildDb.dailyInterval === value)
return modalInteraction.reply({
ephemeral: true,
content: client.translation.get(guildDb?.language, 'Settings.intervalSame'),
});
if (isFormat(value) === false)
return modalInteraction.reply({
ephemeral: true,
content: client.translation.get(guildDb?.language, 'Settings.intervalInvalid'),
});

const dailyMsgs = new EmbedBuilder()
.setTitle(client.translation.get(guildDb?.language, 'Settings.embed.dailyTitle'))
.setDescription(
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyMsg')}: ${
guildDb.dailyMsg
? `<:check:1077962440815411241>`
: `<:x_:1077962443013238814>`
}\n` +
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyChannel')}: ${
guildDb.dailyChannel
? `<#${guildDb.dailyChannel}>`
: `<:x_:1077962443013238814>`
}\n` +
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyRole')}: ${
guildDb.dailyRole
? `<@&${guildDb.dailyRole}>`
: `<:x_:1077962443013238814>`
}\n` +
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyTimezone')}: ${guildDb.dailyTimezone}\n`
+
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyInterval')}: ${value}\n`
+
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyType')}: ${guildDb.customTypes}\n`+
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyThread')}: ${
guildDb.dailyThread
? `<:check:1077962440815411241>`
: `<:x_:1077962443013238814>`
}`
)
.setColor("#0598F6")

const dailyButtons = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyMsg")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyMsg'))
.setStyle(guildDb.dailyMsg ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyChannel")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyChannel'))
.setStyle(guildDb.dailyChannel ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyType")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyType'))
.setStyle("Primary")
.setEmoji("📝"),
),
dailyButtons2 = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyTimezone")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyTimezone'))
.setStyle("Primary")
.setEmoji("🌍"),
new ButtonBuilder()
.setCustomId("dailyRole")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyRole'))
.setStyle(guildDb.dailyRole ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyInterval")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyInterval'))
.setStyle('Primary')
.setEmoji("⏰"),
),
dailyButtons3 = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyThread")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyThread'))
.setStyle(guildDb.dailyThread ? "Success" : "Secondary"),
)


await client.database.updateGuild(interaction.guild.id, {
dailyInterval: value,
});

return modalInteraction.update({
content: null,
embeds: [dailyMsgs],
components: [dailyButtons, dailyButtons2, dailyButtons3],
ephemeral: true,
});
});
},
};
85 changes: 85 additions & 0 deletions src/buttons/dailyThread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const { ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require("discord.js");
module.exports = {
data: {
name: "dailyThread",
description: "Daily Message Thread Toggle",
},
async execute(interaction, client, guildDb) {
const check = guildDb.dailyThread;
const dailyThreads = new EmbedBuilder()
.setTitle(client.translation.get(guildDb?.language, 'Settings.embed.dailyTitle'))
.setDescription(
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyMsg')}: ${
guildDb.dailyMsg ? `<:check:1077962440815411241>` : `<:x_:1077962443013238814>`
}\n${client.translation.get(guildDb?.language, 'Settings.embed.dailyChannel')}: ${
guildDb.dailyChannel
? `<#${guildDb.dailyChannel}>`
: `<:x_:1077962443013238814>`
}\n${client.translation.get(guildDb?.language, 'Settings.embed.dailyRole')}: ${
guildDb.dailyRole
? `<@&${guildDb.dailyRole}>`
: `<:x_:1077962443013238814>`
}\n${client.translation.get(guildDb?.language, 'Settings.embed.dailyTimezone')}: ${guildDb.dailyTimezone}\n${
client.translation.get(guildDb?.language, 'Settings.embed.dailyInterval')
}: ${guildDb.dailyInterval}\n${client.translation.get(guildDb?.language, 'Settings.embed.dailyType')}: ${
guildDb.customTypes
}\n`+
`${client.translation.get(guildDb?.language, 'Settings.embed.dailyThread')}: ${
check
? `<:x_:1077962443013238814>`
: `<:check:1077962440815411241>`
}`
)
.setColor("#0598F6");

const dailyButtons = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyMsg")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyMsg'))
.setStyle(guildDb.dailyMsg ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyChannel")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyChannel'))
.setStyle(guildDb.dailyChannel ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyType")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyType'))
.setStyle("Primary")
.setEmoji("📝")
),
dailyButtons2 = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyTimezone")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyTimezone'))
.setStyle("Primary")
.setEmoji("🌍"),
new ButtonBuilder()
.setCustomId("dailyRole")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyRole'))
.setStyle(guildDb.dailyRole ? "Success" : "Secondary"),
new ButtonBuilder()
.setCustomId("dailyInterval")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyInterval'))
.setStyle("Primary")
.setEmoji("⏰")
),
dailyButtons3 = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("dailyThread")
.setLabel(client.translation.get(guildDb?.language, 'Settings.button.dailyThread'))
.setStyle(check ? "Secondary" : "Success"),
)


await client.database.updateGuild(interaction.guild.id, {
dailyThread: check ? false : true,
});

return interaction.update({
content: null,
embeds: [dailyThreads],
components: [dailyButtons, dailyButtons2, dailyButtons3],
ephemeral: true,
});
},
};
34 changes: 34 additions & 0 deletions src/buttons/dailyType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js');
module.exports = {
data: {
name: 'dailyType',
description: 'Daily Type',
},
async execute(interaction, client, guildDb) {
const inter = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('selectMenuType')
.setPlaceholder('Select a type')
.addOptions([
{
label: 'Regular',
value: 'regular',
description: 'This changes it to use only default messages.',
},
{
label: 'Mixed',
value: 'mixed',
description: 'This changes it to use both custom & default messages.',
},
{
label: 'Custom',
value: 'custom',
description: 'This changes it to use only custom messages.',
},
])
)

interaction.update({ content: null, embeds: [], content: client.translation.get(guildDb?.language, 'Settings.dailyType'), components: [inter], ephemeral: true })
},
};
58 changes: 58 additions & 0 deletions src/buttons/neverhaveiever.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');

module.exports = {
data: {
name: 'neverhaveiever',
description: 'never have i ever',
},
async execute(interaction, client, guildDb) {
const { Funny, Basic, Young, Food, RuleBreak } = await require(`../data/nhie-${guildDb.language}.json`);
const neverArray = [...Funny, ...Basic, ...Young, ...Food, ...RuleBreak]
const randomNever = Math.floor(Math.random() * neverArray.length)

let ratherembed = new EmbedBuilder()
.setColor("#0598F6")
.setFooter({ text: `Requested by ${interaction.user.username} | Type: Random | ID: ${randomNever}`, iconURL: interaction.user.avatarURL() })
.setFooter({
text: `Requested by ${interaction.user.username} | Type: General | ID: ${randomNever}`,
iconURL: interaction.user.avatarURL(),
})
.setDescription(neverArray[randomNever]);

const mainRow = new ActionRowBuilder();
if (Math.round(Math.random() * 15) < 3) {
mainRow.addComponents([
new ButtonBuilder()
.setLabel('Invite')
.setStyle(5)
.setEmoji('1009964111045607525')
.setURL(
'https://discord.com/oauth2/authorize?client_id=981649513427111957&permissions=275415247936&scope=bot%20applications.commands',
)
]);
}
mainRow.addComponents([
new ButtonBuilder()
.setLabel('New Question')
.setStyle(1)
.setEmoji('1073954835533156402')
.setCustomId(`neverhaveiever`)
]);

const time = guildDb?.voteCooldown ?? 60_000;
const three_minutes = 3 * 60 * 1e3;


const {
row,
id
} = await client.voting.generateVoting(interaction.guildId, interaction.channelId, time < three_minutes ? 0 : ~~((Date.now() + time) / 1000), 1);

return interaction.reply({
embeds: [ratherembed],
components: [row, mainRow],
}).catch((err) => {
return console.log(err)
});
},
};
20 changes: 20 additions & 0 deletions src/buttons/result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { EmbedBuilder, ActionRowBuilder, ChannelType, ChannelSelectMenuBuilder } = require('discord.js');
module.exports = {
data: {
name: 'result',
description: 'The voting result',
},
async execute(interaction, client, guildDb) {
const customId = interaction.customId.split('_');

const votingResults = await client.voting.getVotingResults(customId[1])

const resultEmbed = new EmbedBuilder()
.setImage(votingResults.chart)

interaction.reply({
embeds: [resultEmbed],
ephemeral: true
})
},
};
Loading