Skip to content

Commit 17e4d18

Browse files
committed
Merge branch 'dev'
2 parents 46fcd77 + 00bc4ce commit 17e4d18

File tree

8 files changed

+221
-265
lines changed

8 files changed

+221
-265
lines changed

.yarn/releases/yarn-3.8.0.cjs .yarn/releases/yarn-3.8.7.cjs

+83-83
Large diffs are not rendered by default.

.yarnrc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ enableGlobalCache: true
22

33
nodeLinker: node-modules
44

5-
yarnPath: .yarn/releases/yarn-3.8.0.cjs
5+
yarnPath: .yarn/releases/yarn-3.8.7.cjs

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"@discordjs/collection": "2.0.0",
13-
"@octokit/rest": "20.0.2",
14-
"@sapphire/decorators": "6.0.4",
13+
"@octokit/rest": "20.1.2",
14+
"@sapphire/decorators": "6.1.1",
1515
"@sapphire/discord-utilities": "3.2.2",
1616
"@sapphire/discord.js-utilities": "7.1.6",
1717
"@sapphire/fetch": "2.4.2",
@@ -21,11 +21,11 @@
2121
"@sapphire/plugin-logger": "3.0.7",
2222
"@sapphire/plugin-subcommands": "^5.0.0",
2323
"@sapphire/stopwatch": "1.5.2",
24-
"@sapphire/time-utilities": "1.7.12",
24+
"@sapphire/time-utilities": "1.7.14",
2525
"@sapphire/type": "^2.6.0",
26-
"@sapphire/utilities": "3.15.3",
26+
"@sapphire/utilities": "3.18.2",
2727
"@skyra/env-utilities": "^1.2.1",
28-
"axios": "1.6.7",
28+
"axios": "1.8.1",
2929
"canvas": "2.11.2",
3030
"chart.js": "3.9.1",
3131
"chartjs-node-canvas": "4.1.6",
@@ -41,7 +41,7 @@
4141
"parse-duration": "1.1.0",
4242
"pdf2json": "^3.0.3",
4343
"pretty-ms": "7.0.1",
44-
"reflect-metadata": "0.1.13"
44+
"reflect-metadata": "0.2.2"
4545
},
4646
"_moduleAliases": {
4747
"@root": "dist",
@@ -50,17 +50,17 @@
5050
"devDependencies": {
5151
"@sapphire/ts-config": "^5.0.0",
5252
"@types/common-tags": "1.8.4",
53-
"@types/node": "20.10.5",
53+
"@types/node": "20.17.19",
5454
"@types/node-cron": "3.0.11",
55-
"@types/ws": "8.5.10",
55+
"@types/ws": "8.5.14",
5656
"@typescript-eslint/eslint-plugin": "6.21.0",
5757
"@typescript-eslint/parser": "6.21.0",
58-
"eslint": "8.56.0",
58+
"eslint": "8.57.1",
5959
"eslint-plugin-deprecation": "1.5.0",
6060
"npm-run-all": "4.1.5",
6161
"rimraf": "4.4.1",
62-
"tsc-watch": "6.0.4",
63-
"tslib": "2.6.2",
62+
"tsc-watch": "6.2.1",
63+
"tslib": "2.8.1",
6464
"typescript": "^5.7.3"
6565
},
6666
"scripts": {
@@ -77,5 +77,5 @@
7777
"clean:purge": "rimraf node_modules dist yarn.lock package-lock.json",
7878
"updeps": "yarn clean:purge && yarn install"
7979
},
80-
"packageManager": "yarn@3.8.0"
80+
"packageManager": "yarn@3.8.7"
8181
}

src/commands/Admin/makeButton.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { ApplyOptions } from '@sapphire/decorators';
22
import type { CommandOptions } from '@sapphire/framework';
3-
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, type Message } from 'discord.js';
3+
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionFlagsBits, type Message } from 'discord.js';
44
import { SteveCommand } from '@lib/extensions/SteveCommand';
55
import { send } from '@sapphire/plugin-editable-commands';
66
import { oneLine } from 'common-tags';
77

88
@ApplyOptions<CommandOptions>({
99
description: 'Creates **The Button**',
10-
preconditions: ['OwnerOnly']
10+
requiredUserPermissions: PermissionFlagsBits.Administrator
1111
})
1212
export class UserCommand extends SteveCommand {
1313

1414
public async messageRun(msg: Message) {
1515
await send(msg, {
16-
content: `# The Button\n${oneLine(`Below is **The Button**. Clicking it will immediately notify Ben. You can choose
17-
to add context or not.`)}`,
16+
content: `# The Button\n${oneLine(`Below is **The Button**. Clicking it will immediately notify ${msg.author.displayName}.
17+
You can choose to add context or not.`)}`,
1818
components: [
1919
new ActionRowBuilder<ButtonBuilder>()
2020
.addComponents(new ButtonBuilder()
21-
.setCustomId('SafetyButton')
21+
.setCustomId(`SafetyButton|${msg.author.id}`)
2222
.setLabel('The Button')
2323
.setStyle(ButtonStyle.Primary)
2424
)

src/commands/Info/p4a.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class UserCommand extends SteveCommand {
4343
const currentSlot = schedule.find(slot => slot.end > now && slot.start < now);
4444

4545
if (!currentSlot) {
46-
return embed.setTitle('The Project for Awesome is almost here! See you soon!');
46+
return embed.setTitle('The Project for Awesome is over. See you next year!');
4747
}
4848

4949
const nextSlotTime = new Date(currentSlot.end);

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const main = async () => {
5151
client.user?.setPresence({
5252
activities: [
5353
{
54-
type: ActivityType.Playing,
54+
type: ActivityType.Custom,
5555
name: `${prefix}help`
5656
}
5757
]

src/interaction-handlers/theButton.ts

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ApplyOptions } from '@sapphire/decorators';
22
import { InteractionHandler, type InteractionHandlerOptions, InteractionHandlerTypes } from '@sapphire/framework';
3-
import { ActionRowBuilder, ButtonInteraction, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } from 'discord.js';
3+
import { ActionRowBuilder, ButtonInteraction, MessageFlags, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } from 'discord.js';
44

55
@ApplyOptions<InteractionHandlerOptions>({
66
interactionHandlerType: InteractionHandlerTypes.Button,
@@ -9,25 +9,23 @@ import { ActionRowBuilder, ButtonInteraction, ModalBuilder, ModalSubmitInteracti
99
export class TheButtonClick extends InteractionHandler {
1010

1111
public async parse(interaction: ButtonInteraction) {
12-
if (interaction.customId !== 'SafetyButton') {
12+
if (!interaction.customId.startsWith('SafetyButton')) {
1313
return this.none();
1414
}
1515

16-
return this.some();
16+
const [, userId] = interaction.customId.split('|');
17+
return this.some(userId);
1718
}
1819

19-
public async run(interaction: ButtonInteraction) {
20-
if (!process.env.OWNERS) {
21-
throw new Error('No Owners defined');
22-
}
23-
await this.container.client.users.fetch(process.env.OWNERS).then(owner => owner.send('**The Button** was pressed'));
20+
public async run(interaction: ButtonInteraction, userId: InteractionHandler.ParseResult<this>) {
21+
await this.container.client.users.fetch(userId).then(user => user.send('**The Button** was pressed'));
2422

2523
interaction.showModal(new ModalBuilder()
26-
.setCustomId('SafetyModal')
24+
.setCustomId(`SafetyModal|${userId}`)
2725
.setTitle('You clicked The Button')
2826
.addComponents(new ActionRowBuilder<TextInputBuilder>().addComponents(
2927
new TextInputBuilder()
30-
.setCustomId('SafetyContext')
28+
.setCustomId(`SafetyContext`)
3129
.setLabel('Add context to your click?')
3230
.setStyle(TextInputStyle.Paragraph)
3331
.setPlaceholder('Please click submit with this box empty if you wish to not add context')
@@ -45,26 +43,23 @@ export class TheButtonClick extends InteractionHandler {
4543
export class TheButtonModal extends InteractionHandler {
4644

4745
public async parse(interaction: ModalSubmitInteraction) {
48-
if (interaction.customId !== 'SafetyModal') {
46+
if (!interaction.customId.startsWith('SafetyModal')) {
4947
return this.none();
5048
}
5149

52-
return this.some();
50+
const [, userId] = interaction.customId.split('|');
51+
return this.some(userId);
5352
}
5453

55-
public async run(interaction: ModalSubmitInteraction) {
56-
if (!process.env.OWNERS) {
57-
throw new Error('No Owners defined');
58-
}
59-
54+
public async run(interaction: ModalSubmitInteraction, userId: InteractionHandler.ParseResult<this>) {
6055
const input = interaction.fields.getTextInputValue('SafetyContext');
6156

62-
await this.container.client.users.fetch(process.env.OWNERS)
63-
.then(owner => owner.send(input === '' ? 'No context provided' : input));
57+
await this.container.client.users.fetch(userId)
58+
.then(user => user.send(input === '' ? 'No context provided' : input));
6459

6560
interaction.reply({
6661
content: `${input === '' ? 'No additional context was sent' : 'I\'ve sent that context'}`,
67-
ephemeral: true
62+
flags: MessageFlags.Ephemeral
6863
});
6964
}
7065

0 commit comments

Comments
 (0)