Added Eslint GitHub Action and Prettier

This commit is contained in:
Ahmad 2024-12-21 18:13:18 -05:00
parent d8df48438d
commit 512b7526ab
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
21 changed files with 480 additions and 293 deletions

View file

@ -18,7 +18,7 @@ const rulesEmbed = new EmbedBuilder()
'https://cdn.discordapp.com/avatars/1052017329376071781/922947c726d7866d313744186c42ef49.webp',
})
.setDescription(
'These are the rules for the server. Please read and follow them carefully.'
'These are the rules for the server. Please read and follow them carefully.',
)
.addFields(
{
@ -77,9 +77,9 @@ const rulesEmbed = new EmbedBuilder()
'Post content in the right channels. Off-topic content may be moved or deleted.',
},
{
name: '**Rule #12: Follow Discord\'s ToS and Community Guidelines**',
name: '**Rule #12: Follow the Discord Terms of Service and Community Guidelines**',
value:
'All members must adhere to Discords Terms of Service and Community Guidelines.',
'All members must adhere to the Discord Terms of Service and Community Guidelines.',
},
{
name: '**Rule #13: Moderator Discretion**',
@ -90,7 +90,7 @@ const rulesEmbed = new EmbedBuilder()
name: '**Disclaimer:**',
value:
'**These rules may be updated at any time. It is your responsibility to review them regularly. Moderators and admins have the authority to enforce these rules and take appropriate action.**',
}
},
)
.setTimestamp()
.setFooter({

View file

@ -10,7 +10,9 @@ const command: Command = {
.setName('ping')
.setDescription('Check the latency from you to the bot'),
execute: async (interaction) => {
await interaction.reply(`Pong! Latency: ${Date.now() - interaction.createdTimestamp}ms`);
await interaction.reply(
`Pong! Latency: ${Date.now() - interaction.createdTimestamp}ms`,
);
},
};

View file

@ -11,7 +11,7 @@ const command: Command = {
.setDescription('Provides information about the server.'),
execute: async (interaction) => {
await interaction.reply(
`The server ${interaction!.guild!.name} has ${interaction!.guild!.memberCount} members and was created on ${interaction!.guild!.createdAt}. It is ${new Date().getFullYear() - interaction!.guild!.createdAt.getFullYear()!} years old.`
`The server ${interaction!.guild!.name} has ${interaction!.guild!.memberCount} members and was created on ${interaction!.guild!.createdAt}. It is ${new Date().getFullYear() - interaction!.guild!.createdAt.getFullYear()!} years old.`,
);
},
};

View file

@ -19,7 +19,7 @@ const command: Command = {
option
.setName('user')
.setDescription('The user whose information you want to retrieve.')
.setRequired(true)
.setRequired(true),
),
execute: async (interaction) => {
const userOption = interaction.options.get('user');
@ -60,7 +60,7 @@ const command: Command = {
{
name: 'Number of Bans',
value: memberData?.numberOfBans.toString() || '0',
}
},
);
await interaction.reply({ embeds: [embed] });
},

View file

@ -1,5 +1,11 @@
import fs from 'node:fs';
import { Client, Collection, Events, GatewayIntentBits, GuildMember } from 'discord.js';
import {
Client,
Collection,
Events,
GatewayIntentBits,
GuildMember,
} from 'discord.js';
import { deployCommands } from './util/deployCommand.js';
import { removeMember, setMembers } from './util/db.js';
@ -82,7 +88,9 @@ client.on(Events.GuildMemberAdd, async (member: GuildMember) => {
try {
await setMembers(nonBotMembers);
// TODO: Move this to config file
await welcomeChannel.send(`Welcome to the server, ${member.user.username}!`);
await welcomeChannel.send(
`Welcome to the server, ${member.user.username}!`,
);
await member.user.send('Welcome to the Poixpixel Discord server!');
}
catch (error: any) {

View file

@ -45,5 +45,8 @@ export async function removeMember(discordId: string) {
}
export async function getMember(discordId: string) {
return await db.select().from(memberTable).where(eq(memberTable.discordId, discordId));
}
return await db
.select()
.from(memberTable)
.where(eq(memberTable.discordId, discordId));
}

View file

@ -27,7 +27,7 @@ const commandFiles = getFilesRecursively(commandsPath);
export const deployCommands = async () => {
try {
console.log(
`Started refreshing ${commandFiles.length} application (/) commands.`
`Started refreshing ${commandFiles.length} application (/) commands.`,
);
const commands = commandFiles.map(async (file) => {
@ -43,14 +43,14 @@ export const deployCommands = async () => {
}
else {
console.warn(
`[WARNING] The command at ${file} is missing a required "data" or "execute" property.`
`[WARNING] The command at ${file} is missing a required "data" or "execute" property.`,
);
return null;
}
});
const validCommands = await Promise.all(
commands.filter((command) => command !== null)
commands.filter((command) => command !== null),
);
return validCommands;