Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Szedann committed Dec 27, 2023
1 parent e057450 commit d39eddc
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions src/webserver/banshare.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { Request, Response } from 'express';
import { ActionRow, ButtonStyle, Client, Colors, EmbedBuilder } from 'discord.js';
import { ButtonStyle, Client, Colors, EmbedBuilder } from 'discord.js';
import { Button } from '../handlers/button.handler';
import { string, object } from 'valibot'
import { string, object } from 'valibot';
import { ActionRowBuilder, ButtonBuilder } from '@discordjs/builders';

const banButton = new Button('Ban', object({userId: string()}), (interaction, data) => {
const reason = "aero banshare: " + (interaction.message.embeds[0].fields[3].value ?? "no reason provided")
interaction.guild?.bans.create(data.userId, { reason: reason });
interaction.reply(`<@${data.userId}> (\`${data.userId}\`) was banned.`)
});
const banButton = new Button(
'Ban',
object({ userId: string() }),
(interaction, data) => {
const reason =
'aero banshare: ' +
(interaction.message.embeds[0].fields[3].value ??
'no reason provided');
interaction.guild?.bans.create(data.userId, { reason: reason });
interaction.reply(`<@${data.userId}> (\`${data.userId}\`) was banned.`);
}
);

export const handleBanShare = (client: Client, req: Request, res: Response) => {
if (!verify_signature(req)) {
Expand Down Expand Up @@ -53,12 +60,21 @@ const handleBan = async (client: Client, req: Request) => {
)
.setColor(Colors.Red)
.setTimestamp();
channel?.isTextBased() && (await channel.send({ embeds: [embed], components: [
new ActionRowBuilder<ButtonBuilder>().addComponents(banButton.button({
label: "Ban",
style: ButtonStyle.Danger
}, {userId}))
] }));
channel?.isTextBased() &&
(await channel.send({
embeds: [embed],
components: [
new ActionRowBuilder<ButtonBuilder>().addComponents(
banButton.button(
{
label: 'Ban',
style: ButtonStyle.Danger,
},
{ userId }
)
),
],
}));
};

const verify_signature = (req: Request) => {
Expand Down

0 comments on commit d39eddc

Please sign in to comment.