style(norme/eslint): now edited the husky rules before commiting
This commit is contained in:
parent
439ddab587
commit
1c4c0f5872
16 changed files with 1883 additions and 1845 deletions
|
|
@ -1,55 +1,55 @@
|
||||||
import js from "@eslint/js";
|
import js from '@eslint/js';
|
||||||
import ts from "typescript-eslint";
|
import ts from 'typescript-eslint';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...ts.configs.recommended,
|
...ts.configs.recommended,
|
||||||
{
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: "latest",
|
ecmaVersion: 'latest',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"arrow-spacing": ["warn", { before: true, after: true }],
|
'arrow-spacing': ['warn', { before: true, after: true }],
|
||||||
"brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
||||||
"comma-dangle": ["error", "always-multiline"],
|
'comma-dangle': ['error', 'always-multiline'],
|
||||||
"comma-spacing": "error",
|
'comma-spacing': 'error',
|
||||||
"comma-style": "error",
|
'comma-style': 'error',
|
||||||
curly: ["error", "multi-line", "consistent"],
|
curly: ['error', 'multi-line', 'consistent'],
|
||||||
"dot-location": ["error", "property"],
|
'dot-location': ['error', 'property'],
|
||||||
"handle-callback-err": "off",
|
'handle-callback-err': 'off',
|
||||||
indent: ["error", "tab"],
|
indent: ['error', 'tab'],
|
||||||
"keyword-spacing": "error",
|
'keyword-spacing': 'error',
|
||||||
"max-nested-callbacks": ["error", { max: 4 }],
|
'max-nested-callbacks': ['error', { max: 4 }],
|
||||||
"max-statements-per-line": ["error", { max: 2 }],
|
'max-statements-per-line': ['error', { max: 2 }],
|
||||||
"no-console": "off",
|
'no-console': 'off',
|
||||||
"no-empty-function": "error",
|
'no-empty-function': 'error',
|
||||||
"no-floating-decimal": "error",
|
'no-floating-decimal': 'error',
|
||||||
"no-inline-comments": "error",
|
'no-inline-comments': 'error',
|
||||||
"no-lonely-if": "error",
|
'no-lonely-if': 'error',
|
||||||
"no-multi-spaces": "error",
|
'no-multi-spaces': 'error',
|
||||||
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }],
|
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
|
||||||
"no-shadow": ["error", { allow: ["err", "resolve", "reject"] }],
|
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
|
||||||
"no-trailing-spaces": ["error"],
|
'no-trailing-spaces': ['error'],
|
||||||
"no-var": "error",
|
'no-var': 'error',
|
||||||
"no-undef": "off",
|
'no-undef': 'off',
|
||||||
"object-curly-spacing": ["error", "always"],
|
'object-curly-spacing': ['error', 'always'],
|
||||||
"prefer-const": "error",
|
'prefer-const': 'error',
|
||||||
quotes: ["error", "single"],
|
quotes: ['error', 'single'],
|
||||||
semi: ["error", "always"],
|
semi: ['error', 'always'],
|
||||||
"space-before-blocks": "error",
|
'space-before-blocks': 'error',
|
||||||
"space-before-function-paren": [
|
'space-before-function-paren': [
|
||||||
"error",
|
'error',
|
||||||
{
|
{
|
||||||
anonymous: "never",
|
anonymous: 'never',
|
||||||
named: "never",
|
named: 'never',
|
||||||
asyncArrow: "always",
|
asyncArrow: 'always',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"space-in-parens": "error",
|
'space-in-parens': 'error',
|
||||||
"space-infix-ops": "error",
|
'space-infix-ops': 'error',
|
||||||
"space-unary-ops": "error",
|
'space-unary-ops': 'error',
|
||||||
"spaced-comment": "error",
|
'spaced-comment': 'error',
|
||||||
yoda: "error",
|
yoda: 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,8 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,js,cts,mts}": [
|
"*": [
|
||||||
"eslint --fix",
|
"eslint --fix"
|
||||||
"prettier --write"
|
|
||||||
],
|
|
||||||
"*.{json,md,yml,yaml}": [
|
|
||||||
"prettier --write"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import {
|
import {
|
||||||
ActionRowBuilder,
|
ActionRowBuilder,
|
||||||
ChannelType,
|
ChannelType,
|
||||||
|
|
@ -11,30 +11,30 @@ import {
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
} from "discord.js";
|
} from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("logs")
|
.setName('logs')
|
||||||
.setDescription("edit the logs configuration")
|
.setDescription('edit the logs configuration')
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("action")
|
.setName('action')
|
||||||
.setDescription("What is the action you to perform")
|
.setDescription('What is the action you to perform')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
{
|
{
|
||||||
name: "Show",
|
name: 'Show',
|
||||||
value: "logs_show",
|
value: 'logs_show',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Auto-configuration",
|
name: 'Auto-configuration',
|
||||||
value: "logs_auto",
|
value: 'logs_auto',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Configuration",
|
name: 'Configuration',
|
||||||
value: "logs_config",
|
value: 'logs_config',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -46,7 +46,8 @@ export default {
|
||||||
id: interaction.guild.id,
|
id: interaction.guild.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -63,7 +64,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
throw `\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`;
|
throw `\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`;
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.error} | Cannot connect to the database`,
|
content: `${emoji.answer.error} | Cannot connect to the database`,
|
||||||
|
|
@ -71,9 +73,9 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const choice: string = interaction.options.getString("action");
|
const choice: string = interaction.options.getString('action');
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case "logs_show": {
|
case 'logs_show': {
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -100,7 +102,8 @@ export default {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [logsData],
|
embeds: [logsData],
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | The log is disable on the server`,
|
content: `${emoji.answer.no} | The log is disable on the server`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
@ -108,7 +111,7 @@ export default {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "logs_auto": {
|
case 'logs_auto': {
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -129,8 +132,8 @@ export default {
|
||||||
.sort((a, b) => b.position - a.position);
|
.sort((a, b) => b.position - a.position);
|
||||||
|
|
||||||
const menu = new StringSelectMenuBuilder()
|
const menu = new StringSelectMenuBuilder()
|
||||||
.setCustomId("role_select")
|
.setCustomId('role_select')
|
||||||
.setPlaceholder("Choose the role that will have logs access")
|
.setPlaceholder('Choose the role that will have logs access')
|
||||||
.setMinValues(1)
|
.setMinValues(1)
|
||||||
.setMaxValues(Math.min(roles.size, 25))
|
.setMaxValues(Math.min(roles.size, 25))
|
||||||
.addOptions(
|
.addOptions(
|
||||||
|
|
@ -145,7 +148,7 @@ export default {
|
||||||
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(menu);
|
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(menu);
|
||||||
|
|
||||||
const permSelector: EmbedBuilder = new EmbedBuilder()
|
const permSelector: EmbedBuilder = new EmbedBuilder()
|
||||||
.setTitle("Which role will have access")
|
.setTitle('Which role will have access')
|
||||||
.setColor(`${guildData.color}`)
|
.setColor(`${guildData.color}`)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: guildData.footer,
|
text: guildData.footer,
|
||||||
|
|
@ -162,7 +165,7 @@ export default {
|
||||||
max: 25,
|
max: 25,
|
||||||
});
|
});
|
||||||
collector.on(
|
collector.on(
|
||||||
"collect",
|
'collect',
|
||||||
async (selectInteraction: StringSelectMenuInteraction) => {
|
async (selectInteraction: StringSelectMenuInteraction) => {
|
||||||
if (selectInteraction.user.id !== interaction.user.id) {
|
if (selectInteraction.user.id !== interaction.user.id) {
|
||||||
selectInteraction.reply({
|
selectInteraction.reply({
|
||||||
|
|
@ -187,48 +190,48 @@ export default {
|
||||||
];
|
];
|
||||||
|
|
||||||
const category = (await interaction.guild.channels.create({
|
const category = (await interaction.guild.channels.create({
|
||||||
name: "Logs",
|
name: 'Logs',
|
||||||
type: ChannelType.GuildCategory,
|
type: ChannelType.GuildCategory,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as CategoryChannel;
|
})) as CategoryChannel;
|
||||||
|
|
||||||
const logBot = (await interaction.guild.channels.create({
|
const logBot = (await interaction.guild.channels.create({
|
||||||
name: "bot-logs",
|
name: 'bot-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as TextChannel;
|
})) as TextChannel;
|
||||||
|
|
||||||
const logChannels = (await interaction.guild.channels.create({
|
const logChannels = (await interaction.guild.channels.create({
|
||||||
name: "channel-logs",
|
name: 'channel-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as TextChannel;
|
})) as TextChannel;
|
||||||
|
|
||||||
const logMember = (await interaction.guild.channels.create({
|
const logMember = (await interaction.guild.channels.create({
|
||||||
name: "member-logs",
|
name: 'member-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as TextChannel;
|
})) as TextChannel;
|
||||||
|
|
||||||
const logMod = (await interaction.guild.channels.create({
|
const logMod = (await interaction.guild.channels.create({
|
||||||
name: "mod-logs",
|
name: 'mod-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as TextChannel;
|
})) as TextChannel;
|
||||||
|
|
||||||
const logMsg = (await interaction.guild.channels.create({
|
const logMsg = (await interaction.guild.channels.create({
|
||||||
name: "message-logs",
|
name: 'message-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
})) as TextChannel;
|
})) as TextChannel;
|
||||||
|
|
||||||
const logServer = (await interaction.guild.channels.create({
|
const logServer = (await interaction.guild.channels.create({
|
||||||
name: "server-logs",
|
name: 'server-logs',
|
||||||
type: ChannelType.GuildText,
|
type: ChannelType.GuildText,
|
||||||
parent: category,
|
parent: category,
|
||||||
permissionOverwrites,
|
permissionOverwrites,
|
||||||
|
|
@ -251,9 +254,9 @@ export default {
|
||||||
});
|
});
|
||||||
const mentionList = selectedRoles
|
const mentionList = selectedRoles
|
||||||
.map((id) => `- <@&${id}>`)
|
.map((id) => `- <@&${id}>`)
|
||||||
.join("\n");
|
.join('\n');
|
||||||
const autoConfig = new EmbedBuilder()
|
const autoConfig = new EmbedBuilder()
|
||||||
.setTitle("The logs category is created")
|
.setTitle('The logs category is created')
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`
|
`
|
||||||
This following roles will have access to the logs.
|
This following roles will have access to the logs.
|
||||||
|
|
|
||||||
|
|
@ -1,108 +1,108 @@
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import {
|
import {
|
||||||
ActivityType,
|
ActivityType,
|
||||||
PresenceUpdateStatus,
|
PresenceUpdateStatus,
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
} from "discord.js";
|
} from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("set")
|
.setName('set')
|
||||||
.setDescription("edit the default behavour of the bot")
|
.setDescription('edit the default behavour of the bot')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("color")
|
.setName('color')
|
||||||
.setDescription("Change the default color for the embed")
|
.setDescription('Change the default color for the embed')
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("color")
|
.setName('color')
|
||||||
.setDescription("The new color by default")
|
.setDescription('The new color by default')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("footer")
|
.setName('footer')
|
||||||
.setDescription("Change the default footer for the embed")
|
.setDescription('Change the default footer for the embed')
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("text")
|
.setName('text')
|
||||||
.setDescription("The new text by default of the bot")
|
.setDescription('The new text by default of the bot')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("pp")
|
.setName('pp')
|
||||||
.setDescription("Change the bot profile picture")
|
.setDescription('Change the bot profile picture')
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("link")
|
.setName('link')
|
||||||
.setDescription("The new link to the new profile picture")
|
.setDescription('The new link to the new profile picture')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("status")
|
.setName('status')
|
||||||
.setDescription("Change the status of the bot")
|
.setDescription('Change the status of the bot')
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("status")
|
.setName('status')
|
||||||
.setDescription("The new status used by the bot")
|
.setDescription('The new status used by the bot')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("presence")
|
.setName('presence')
|
||||||
.setDescription("The new presence of the bot")
|
.setDescription('The new presence of the bot')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
{
|
{
|
||||||
name: "Online",
|
name: 'Online',
|
||||||
value: "online",
|
value: 'online',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Do not disturb",
|
name: 'Do not disturb',
|
||||||
value: "dnd",
|
value: 'dnd',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Idle",
|
name: 'Idle',
|
||||||
value: "idle",
|
value: 'idle',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Invisible",
|
name: 'Invisible',
|
||||||
value: "invisible",
|
value: 'invisible',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("type")
|
.setName('type')
|
||||||
.setDescription("The type of the new activity")
|
.setDescription('The type of the new activity')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
{
|
{
|
||||||
name: "Playing",
|
name: 'Playing',
|
||||||
value: "play",
|
value: 'play',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Watching",
|
name: 'Watching',
|
||||||
value: "watch",
|
value: 'watch',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Listening",
|
name: 'Listening',
|
||||||
value: "listen",
|
value: 'listen',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Competing",
|
name: 'Competing',
|
||||||
value: "competing",
|
value: 'competing',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Streaming",
|
name: 'Streaming',
|
||||||
value: "stream",
|
value: 'stream',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -115,7 +115,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -127,7 +128,7 @@ export default {
|
||||||
}
|
}
|
||||||
const subcommand: string = interaction.options.getSubcommand();
|
const subcommand: string = interaction.options.getSubcommand();
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "color": {
|
case 'color': {
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -135,7 +136,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newColor: string = interaction.options.getString("color");
|
const newColor: string = interaction.options.getString('color');
|
||||||
if (!/^#[0-9A-Fa-f]{6}$/.test(newColor)) {
|
if (!/^#[0-9A-Fa-f]{6}$/.test(newColor)) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | You have to give a color with the syntax: \`#000000\`.`,
|
content: `${emoji.answer.no} | You have to give a color with the syntax: \`#000000\`.`,
|
||||||
|
|
@ -161,7 +162,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "footer": {
|
case 'footer': {
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -169,7 +170,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newFooter: string = interaction.options.getString("text");
|
const newFooter: string = interaction.options.getString('text');
|
||||||
if (newFooter.length > 2048) {
|
if (newFooter.length > 2048) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | The maximum lenght for the footer is 2048`,
|
content: `${emoji.answer.no} | The maximum lenght for the footer is 2048`,
|
||||||
|
|
@ -195,7 +196,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "pp": {
|
case 'pp': {
|
||||||
if (!userData.isBuyer) {
|
if (!userData.isBuyer) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
|
|
@ -203,10 +204,11 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newPicture: string = interaction.options.getString("link");
|
const newPicture: string = interaction.options.getString('link');
|
||||||
try {
|
try {
|
||||||
interaction.client.user.setAvatar(newPicture);
|
interaction.client.user.setAvatar(newPicture);
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | Error during changing the bot profile picture`,
|
content: `${emoji.answer.no} | Error during changing the bot profile picture`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
@ -221,7 +223,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "status": {
|
case 'status': {
|
||||||
if (!userData.isBuyer) {
|
if (!userData.isBuyer) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
|
|
@ -229,39 +231,39 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newStatus: string = interaction.options.getString("status");
|
const newStatus: string = interaction.options.getString('status');
|
||||||
const tmpType: string = interaction.options.getString("type");
|
const tmpType: string = interaction.options.getString('type');
|
||||||
let newType: ActivityType;
|
let newType: ActivityType;
|
||||||
switch (tmpType) {
|
switch (tmpType) {
|
||||||
case "play":
|
case 'play':
|
||||||
newType = ActivityType.Playing;
|
newType = ActivityType.Playing;
|
||||||
break;
|
break;
|
||||||
case "listen":
|
case 'listen':
|
||||||
newType = ActivityType.Listening;
|
newType = ActivityType.Listening;
|
||||||
break;
|
break;
|
||||||
case "watch":
|
case 'watch':
|
||||||
newType = ActivityType.Watching;
|
newType = ActivityType.Watching;
|
||||||
break;
|
break;
|
||||||
case "stream":
|
case 'stream':
|
||||||
newType = ActivityType.Streaming;
|
newType = ActivityType.Streaming;
|
||||||
break;
|
break;
|
||||||
case "competing":
|
case 'competing':
|
||||||
newType = ActivityType.Competing;
|
newType = ActivityType.Competing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const tmpPresence: string = interaction.options.getString("presence");
|
const tmpPresence: string = interaction.options.getString('presence');
|
||||||
let newPresence: PresenceUpdateStatus;
|
let newPresence: PresenceUpdateStatus;
|
||||||
switch (tmpPresence) {
|
switch (tmpPresence) {
|
||||||
case "online":
|
case 'online':
|
||||||
newPresence = PresenceUpdateStatus.Online;
|
newPresence = PresenceUpdateStatus.Online;
|
||||||
break;
|
break;
|
||||||
case "idle":
|
case 'idle':
|
||||||
newPresence = PresenceUpdateStatus.Idle;
|
newPresence = PresenceUpdateStatus.Idle;
|
||||||
break;
|
break;
|
||||||
case "dnd":
|
case 'dnd':
|
||||||
newPresence = PresenceUpdateStatus.DoNotDisturb;
|
newPresence = PresenceUpdateStatus.DoNotDisturb;
|
||||||
break;
|
break;
|
||||||
case "invisible":
|
case 'invisible':
|
||||||
newPresence = PresenceUpdateStatus.Invisible;
|
newPresence = PresenceUpdateStatus.Invisible;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -282,18 +284,19 @@ export default {
|
||||||
presence: newPresence,
|
presence: newPresence,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (tmpType === "steam") {
|
if (tmpType === 'steam') {
|
||||||
interaction.client.user.setPresence({
|
interaction.client.user.setPresence({
|
||||||
status: newPresence,
|
status: newPresence,
|
||||||
activities: [
|
activities: [
|
||||||
{
|
{
|
||||||
name: newStatus,
|
name: newStatus,
|
||||||
type: newType,
|
type: newType,
|
||||||
url: "https://twitch.tv/EniumRaphael",
|
url: 'https://twitch.tv/EniumRaphael',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
interaction.client.user.setPresence({
|
interaction.client.user.setPresence({
|
||||||
status: newPresence,
|
status: newPresence,
|
||||||
activities: [
|
activities: [
|
||||||
|
|
@ -304,7 +307,8 @@ export default {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | Cannot change the status\n\n\t${err}`,
|
content: `${emoji.answer.no} | Cannot change the status\n\n\t${err}`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
|
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from 'discord.js';
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("buyer")
|
.setName('buyer')
|
||||||
.setDescription("Interact with the buyers")
|
.setDescription('Interact with the buyers')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("add")
|
.setName('add')
|
||||||
.setDescription("Add a user on the buyer list")
|
.setDescription('Add a user on the buyer list')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be added to the list")
|
.setDescription('The user who will be added to the list')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("delete")
|
.setName('delete')
|
||||||
.setDescription("Delete a user on the buyer list")
|
.setDescription('Delete a user on the buyer list')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be deleted to the list")
|
.setDescription('The user who will be deleted to the list')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName("list").setDescription("The list of the buyer"),
|
subcommand.setName('list').setDescription('The list of the buyer'),
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
const subcommand = interaction.options.getSubcommand();
|
const subcommand = interaction.options.getSubcommand();
|
||||||
|
|
@ -40,7 +40,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -57,7 +58,8 @@ export default {
|
||||||
id: interaction.guild.id,
|
id: interaction.guild.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -67,9 +69,9 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target: GuildMember = interaction.options.getUser("target");
|
const target: GuildMember = interaction.options.getUser('target');
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "add":
|
case 'add':
|
||||||
if (!userData.isDev) {
|
if (!userData.isDev) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for the developper of the bot`,
|
content: `${emoji.answer.no} | This command is only for the developper of the bot`,
|
||||||
|
|
@ -109,7 +111,8 @@ export default {
|
||||||
isOwner: true,
|
isOwner: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when adding ${target.username} to the buyer list\n\t${err}`,
|
`⚠️ | Error when adding ${target.username} to the buyer list\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -124,14 +127,15 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "delete":
|
case 'delete':
|
||||||
if (!userData.isDev) {
|
if (!userData.isDev) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (interaction.user.id === target.id) {
|
}
|
||||||
|
else if (interaction.user.id === target.id) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | You cannot removing yourself from the buyer list`,
|
content: `${emoji.answer.no} | You cannot removing yourself from the buyer list`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
@ -170,7 +174,8 @@ export default {
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when removing ${target.username} to the buyer list\n\t${err}`,
|
`⚠️ | Error when removing ${target.username} to the buyer list\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -181,7 +186,7 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "list":
|
case 'list':
|
||||||
if (!userData.isBuyer) {
|
if (!userData.isBuyer) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
|
|
@ -212,7 +217,8 @@ export default {
|
||||||
try {
|
try {
|
||||||
const user = await interaction.client.users.fetch(buyer.id);
|
const user = await interaction.client.users.fetch(buyer.id);
|
||||||
return `- ${user.username} (\`${user.id}\`)\n`;
|
return `- ${user.username} (\`${user.id}\`)\n`;
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.warn(`⚠️ | ${buyer.id} : ${err}`);
|
console.warn(`⚠️ | ${buyer.id} : ${err}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -225,12 +231,13 @@ export default {
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: guildData.footer,
|
text: guildData.footer,
|
||||||
})
|
})
|
||||||
.setDescription(buyerList.filter(Boolean).join(""));
|
.setDescription(buyerList.filter(Boolean).join(''));
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [toSend],
|
embeds: [toSend],
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | error when fetching infromation from the database: ${err}`,
|
`⚠️ | error when fetching infromation from the database: ${err}`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
|
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from 'discord.js';
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("owner")
|
.setName('owner')
|
||||||
.setDescription("Interact with the owners")
|
.setDescription('Interact with the owners')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("add")
|
.setName('add')
|
||||||
.setDescription("Add a user on the owner list")
|
.setDescription('Add a user on the owner list')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be added to the list")
|
.setDescription('The user who will be added to the list')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("delete")
|
.setName('delete')
|
||||||
.setDescription("Delete a user on the owner list")
|
.setDescription('Delete a user on the owner list')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be deleted to the list")
|
.setDescription('The user who will be deleted to the list')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName("list").setDescription("The list of the owner"),
|
subcommand.setName('list').setDescription('The list of the owner'),
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
const subcommand = interaction.options.getSubcommand();
|
const subcommand = interaction.options.getSubcommand();
|
||||||
|
|
@ -40,7 +40,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -57,7 +58,8 @@ export default {
|
||||||
id: interaction.guild.id,
|
id: interaction.guild.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -67,9 +69,9 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target: GuildMember = interaction.options.getUser("target");
|
const target: GuildMember = interaction.options.getUser('target');
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "add":
|
case 'add':
|
||||||
if (!userData.isBuyer) {
|
if (!userData.isBuyer) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
|
|
@ -102,7 +104,8 @@ export default {
|
||||||
isOwner: true,
|
isOwner: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when adding ${target.username} to the owner list\n\t${err}`,
|
`⚠️ | Error when adding ${target.username} to the owner list\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -117,14 +120,15 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "delete":
|
case 'delete':
|
||||||
if (!userData.isBuyer) {
|
if (!userData.isBuyer) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for buyer`,
|
content: `${emoji.answer.no} | This command is only for buyer`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (interaction.user.id === target.id) {
|
}
|
||||||
|
else if (interaction.user.id === target.id) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | You cannot removing yourself from the owner list`,
|
content: `${emoji.answer.no} | You cannot removing yourself from the owner list`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
@ -156,7 +160,8 @@ export default {
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when removing ${target.username} to the owner list\n\t${err}`,
|
`⚠️ | Error when removing ${target.username} to the owner list\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -171,7 +176,7 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "list":
|
case 'list':
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -202,7 +207,8 @@ export default {
|
||||||
try {
|
try {
|
||||||
const user = await interaction.client.users.fetch(owner.id);
|
const user = await interaction.client.users.fetch(owner.id);
|
||||||
return `- ${user.username} (\`${user.id}\`)\n`;
|
return `- ${user.username} (\`${user.id}\`)\n`;
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.warn(`⚠️ | ${owner.id} : ${err}`);
|
console.warn(`⚠️ | ${owner.id} : ${err}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -215,12 +221,13 @@ export default {
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: guildData.footer,
|
text: guildData.footer,
|
||||||
})
|
})
|
||||||
.setDescription(ownerList.filter(Boolean).join(""));
|
.setDescription(ownerList.filter(Boolean).join(''));
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [toSend],
|
embeds: [toSend],
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | error when fetching infromation from the database: ${err}`,
|
`⚠️ | error when fetching infromation from the database: ${err}`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from "discord.js";
|
import { EmbedBuilder, MessageFlags, SlashCommandBuilder } from 'discord.js';
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("whitelist")
|
.setName('whitelist')
|
||||||
.setDescription("Interact with the whitelist")
|
.setDescription('Interact with the whitelist')
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("add")
|
.setName('add')
|
||||||
.setDescription("Add a user on the whitelist")
|
.setDescription('Add a user on the whitelist')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be added to the whitelist")
|
.setDescription('The user who will be added to the whitelist')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("delete")
|
.setName('delete')
|
||||||
.setDescription("Delete a user on the whitelist")
|
.setDescription('Delete a user on the whitelist')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user who will be deleted to the whitelist")
|
.setDescription('The user who will be deleted to the whitelist')
|
||||||
.setRequired(true),
|
.setRequired(true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand.setName("list").setDescription("Show the whitelist"),
|
subcommand.setName('list').setDescription('Show the whitelist'),
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
const subcommand = interaction.options.getSubcommand();
|
const subcommand = interaction.options.getSubcommand();
|
||||||
|
|
@ -40,7 +40,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Whitelist => Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Whitelist => Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -57,7 +58,8 @@ export default {
|
||||||
id: interaction.guild.id,
|
id: interaction.guild.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -67,9 +69,9 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target: GuildMember = interaction.options.getUser("target");
|
const target: GuildMember = interaction.options.getUser('target');
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "add":
|
case 'add':
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -106,7 +108,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when adding ${target.username} to the whitelist\n\t${err}`,
|
`⚠️ | Error when adding ${target.username} to the whitelist\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -121,14 +124,15 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "delete":
|
case 'delete':
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (interaction.user.id === target.id) {
|
}
|
||||||
|
else if (interaction.user.id === target.id) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | You cannot removing yourself from the whitelist`,
|
content: `${emoji.answer.no} | You cannot removing yourself from the whitelist`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
@ -164,7 +168,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when removing ${target.username} to the username\n\t${err}`,
|
`⚠️ | Error when removing ${target.username} to the username\n\t${err}`,
|
||||||
);
|
);
|
||||||
|
|
@ -179,7 +184,7 @@ export default {
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "list":
|
case 'list':
|
||||||
if (!userData.isOwner) {
|
if (!userData.isOwner) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.no} | This command is only for owner`,
|
content: `${emoji.answer.no} | This command is only for owner`,
|
||||||
|
|
@ -210,7 +215,8 @@ export default {
|
||||||
try {
|
try {
|
||||||
const user = await interaction.client.users.fetch(whitelist.id);
|
const user = await interaction.client.users.fetch(whitelist.id);
|
||||||
return `- ${user.username} (\`${user.id}\`)\n`;
|
return `- ${user.username} (\`${user.id}\`)\n`;
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.warn(`⚠️ | ${whitelist.id} : ${err}`);
|
console.warn(`⚠️ | ${whitelist.id} : ${err}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -218,17 +224,18 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
const toSend: EmbedBuilder = new EmbedBuilder()
|
const toSend: EmbedBuilder = new EmbedBuilder()
|
||||||
.setTitle("🗞️ | Whitelist")
|
.setTitle('🗞️ | Whitelist')
|
||||||
.setColor(guildData.color)
|
.setColor(guildData.color)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: guildData.footer,
|
text: guildData.footer,
|
||||||
})
|
})
|
||||||
.setDescription(WlUsers.filter(Boolean).join(""));
|
.setDescription(WlUsers.filter(Boolean).join(''));
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [toSend],
|
embeds: [toSend],
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Whitelist => error when fetching infromation from the database: ${err}`,
|
`⚠️ | Whitelist => error when fetching infromation from the database: ${err}`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
import { MessageFlags, ChannelType, SlashCommandBuilder } from "discord.js";
|
import { MessageFlags, ChannelType, SlashCommandBuilder } from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("deletecat")
|
.setName('deletecat')
|
||||||
.setDescription("Delete the categorie given in parameter")
|
.setDescription('Delete the categorie given in parameter')
|
||||||
.addChannelOption((opt) =>
|
.addChannelOption((opt) =>
|
||||||
opt
|
opt
|
||||||
.setName("category")
|
.setName('category')
|
||||||
.setDescription("Choose the categorie you want to delete")
|
.setDescription('Choose the categorie you want to delete')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChannelTypes(ChannelType.GuildCategory),
|
.addChannelTypes(ChannelType.GuildCategory),
|
||||||
),
|
),
|
||||||
|
|
@ -21,7 +21,8 @@ export default {
|
||||||
id: interaction.user.id,
|
id: interaction.user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Whitelist => Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Whitelist => Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -40,7 +41,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const category: GuildCategory = interaction.options.getChannel(
|
const category: GuildCategory = interaction.options.getChannel(
|
||||||
"category",
|
'category',
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
|
@ -56,7 +57,8 @@ export default {
|
||||||
content: `${emoji.answer.yes} | Suppressed the ${category.name}`,
|
content: `${emoji.answer.yes} | Suppressed the ${category.name}`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.error} | Cannot suppress the category's channels`,
|
content: `${emoji.answer.error} | Cannot suppress the category's channels`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
import {
|
import {
|
||||||
userMention,
|
userMention,
|
||||||
roleMention,
|
roleMention,
|
||||||
MessageFlags,
|
MessageFlags,
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
} from "discord.js";
|
} from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
function getGuildRoles(guild: Guild): string {
|
function getGuildRoles(guild: Guild): string {
|
||||||
const roles = guild.roles.cache
|
const roles = guild.roles.cache
|
||||||
|
|
@ -14,7 +14,7 @@ function getGuildRoles(guild: Guild): string {
|
||||||
.sort((a, b) => b.position - a.position)
|
.sort((a, b) => b.position - a.position)
|
||||||
.map((role) => roleMention(role.id));
|
.map((role) => roleMention(role.id));
|
||||||
|
|
||||||
return roles.length > 0 ? roles.join(", ") : "No role";
|
return roles.length > 0 ? roles.join(', ') : 'No role';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserRoles(target: GuildMember): string {
|
function getUserRoles(target: GuildMember): string {
|
||||||
|
|
@ -23,7 +23,7 @@ function getUserRoles(target: GuildMember): string {
|
||||||
.sort((a, b) => b.position - a.position)
|
.sort((a, b) => b.position - a.position)
|
||||||
.map((role) => `${roleMention(role.id)}`);
|
.map((role) => `${roleMention(role.id)}`);
|
||||||
|
|
||||||
return roles.length > 0 ? roles.join(", ") : "No role";
|
return roles.length > 0 ? roles.join(', ') : 'No role';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserBadges(userData: {
|
function getUserBadges(userData: {
|
||||||
|
|
@ -40,29 +40,29 @@ function getUserBadges(userData: {
|
||||||
if (userData.isBuyer) badges.push(`${emoji.badge.buyer}`);
|
if (userData.isBuyer) badges.push(`${emoji.badge.buyer}`);
|
||||||
if (userData.isOwner) badges.push(`${emoji.badge.owner}`);
|
if (userData.isOwner) badges.push(`${emoji.badge.owner}`);
|
||||||
|
|
||||||
return badges.length > 0 ? badges.join(" ") : "Aucun badge";
|
return badges.length > 0 ? badges.join(' ') : 'Aucun badge';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("info")
|
.setName('info')
|
||||||
.setDescription(
|
.setDescription(
|
||||||
"Show the infromation of one of these categories (user, server, bot)",
|
'Show the infromation of one of these categories (user, server, bot)',
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("user")
|
.setName('user')
|
||||||
.setDescription("Show the infromation of one user")
|
.setDescription('Show the infromation of one user')
|
||||||
.addUserOption((option) =>
|
.addUserOption((option) =>
|
||||||
option
|
option
|
||||||
.setName("target")
|
.setName('target')
|
||||||
.setDescription("The user to show the infromation"),
|
.setDescription('The user to show the infromation'),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addSubcommand((subcommand) =>
|
.addSubcommand((subcommand) =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("server")
|
.setName('server')
|
||||||
.setDescription("Show the infromation of the server"),
|
.setDescription('Show the infromation of the server'),
|
||||||
),
|
),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
let guildData: Guild;
|
let guildData: Guild;
|
||||||
|
|
@ -72,7 +72,8 @@ export default {
|
||||||
id: interaction.guild.id,
|
id: interaction.guild.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -84,9 +85,9 @@ export default {
|
||||||
}
|
}
|
||||||
const subcommand: string = interaction.options.getSubcommand();
|
const subcommand: string = interaction.options.getSubcommand();
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case "user": {
|
case 'user': {
|
||||||
const targetGlobal: GuildMember =
|
const targetGlobal: GuildMember =
|
||||||
interaction.options.getUser("target") || interaction.user;
|
interaction.options.getUser('target') || interaction.user;
|
||||||
await targetGlobal.fetch();
|
await targetGlobal.fetch();
|
||||||
let userData: User;
|
let userData: User;
|
||||||
try {
|
try {
|
||||||
|
|
@ -95,7 +96,8 @@ export default {
|
||||||
id: targetGlobal.id,
|
id: targetGlobal.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
@ -108,7 +110,8 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
targetServer = await interaction.guild.members.fetch(targetGlobal.id);
|
targetServer = await interaction.guild.members.fetch(targetGlobal.id);
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(`\t⚠️ | Cannot get the targetServer!\n\t\t(${err}).`);
|
console.error(`\t⚠️ | Cannot get the targetServer!\n\t\t(${err}).`);
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.error} | Cannot get the guild profile of the user`,
|
content: `${emoji.answer.error} | Cannot get the guild profile of the user`,
|
||||||
|
|
@ -152,7 +155,7 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "server": {
|
case 'server': {
|
||||||
const guild: Guild = interaction.guild;
|
const guild: Guild = interaction.guild;
|
||||||
const serverResult: EmbedBuilder = new EmbedBuilder()
|
const serverResult: EmbedBuilder = new EmbedBuilder()
|
||||||
.setTitle(`${guild.name} Informations`)
|
.setTitle(`${guild.name} Informations`)
|
||||||
|
|
@ -167,9 +170,9 @@ export default {
|
||||||
${guild.id}
|
${guild.id}
|
||||||
|
|
||||||
**🖊️ | Description:**
|
**🖊️ | Description:**
|
||||||
${guild.description || "No description given."}
|
${guild.description || 'No description given.'}
|
||||||
**🔗 | VanityLink:**
|
**🔗 | VanityLink:**
|
||||||
${guild.vanityURLCode || "No custom link."}
|
${guild.vanityURLCode || 'No custom link.'}
|
||||||
|
|
||||||
**🆕 | Creation Date:**
|
**🆕 | Creation Date:**
|
||||||
<t:${parseInt(guild.createdTimestamp / 1000)}:R>
|
<t:${parseInt(guild.createdTimestamp / 1000)}:R>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { MessageFlags, SlashCommandBuilder } from "discord.js";
|
import { MessageFlags, SlashCommandBuilder } from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("ping")
|
.setName('ping')
|
||||||
.setDescription("Show your latency"),
|
.setDescription('Show your latency'),
|
||||||
async execute(interaction: CommandInteraction) {
|
async execute(interaction: CommandInteraction) {
|
||||||
const time: number = Date.now();
|
const time: number = Date.now();
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Events } from "discord.js";
|
import { Events } from 'discord.js';
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.GuildCreate,
|
name: Events.GuildCreate,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { ActivityType, PresenceUpdateStatus, Events } from "discord.js";
|
import { ActivityType, PresenceUpdateStatus, Events } from 'discord.js';
|
||||||
import { prisma } from "../../lib/prisma.ts";
|
import { prisma } from '../../lib/prisma.ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.ClientReady,
|
name: Events.ClientReady,
|
||||||
|
|
@ -15,50 +15,51 @@ export default {
|
||||||
const tmpType: string = botData.type;
|
const tmpType: string = botData.type;
|
||||||
let newType: ActivityType;
|
let newType: ActivityType;
|
||||||
switch (tmpType) {
|
switch (tmpType) {
|
||||||
case "play":
|
case 'play':
|
||||||
newType = ActivityType.Playing;
|
newType = ActivityType.Playing;
|
||||||
break;
|
break;
|
||||||
case "listen":
|
case 'listen':
|
||||||
newType = ActivityType.Listening;
|
newType = ActivityType.Listening;
|
||||||
break;
|
break;
|
||||||
case "watch":
|
case 'watch':
|
||||||
newType = ActivityType.Watching;
|
newType = ActivityType.Watching;
|
||||||
break;
|
break;
|
||||||
case "stream":
|
case 'stream':
|
||||||
newType = ActivityType.Streaming;
|
newType = ActivityType.Streaming;
|
||||||
break;
|
break;
|
||||||
case "comptet":
|
case 'comptet':
|
||||||
newType = ActivityType.Competing;
|
newType = ActivityType.Competing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const tmpPresence: string = botData.presence;
|
const tmpPresence: string = botData.presence;
|
||||||
let newPresence: PresenceUpdateStatus;
|
let newPresence: PresenceUpdateStatus;
|
||||||
switch (tmpPresence) {
|
switch (tmpPresence) {
|
||||||
case "online":
|
case 'online':
|
||||||
newPresence = PresenceUpdateStatus.Online;
|
newPresence = PresenceUpdateStatus.Online;
|
||||||
break;
|
break;
|
||||||
case "idle":
|
case 'idle':
|
||||||
newPresence = PresenceUpdateStatus.Idle;
|
newPresence = PresenceUpdateStatus.Idle;
|
||||||
break;
|
break;
|
||||||
case "dnd":
|
case 'dnd':
|
||||||
newPresence = PresenceUpdateStatus.DoNotDisturb;
|
newPresence = PresenceUpdateStatus.DoNotDisturb;
|
||||||
break;
|
break;
|
||||||
case "invisible":
|
case 'invisible':
|
||||||
newPresence = PresenceUpdateStatus.Invisible;
|
newPresence = PresenceUpdateStatus.Invisible;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (botData.type === "steam") {
|
if (botData.type === 'steam') {
|
||||||
client.user.setPresence({
|
client.user.setPresence({
|
||||||
status: newPresence,
|
status: newPresence,
|
||||||
activities: [
|
activities: [
|
||||||
{
|
{
|
||||||
name: newStatus,
|
name: newStatus,
|
||||||
type: newType,
|
type: newType,
|
||||||
url: "https://twich.tv/EniumRaphael",
|
url: 'https://twich.tv/EniumRaphael',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
client.user.setPresence({
|
client.user.setPresence({
|
||||||
status: newPresence,
|
status: newPresence,
|
||||||
activities: [
|
activities: [
|
||||||
|
|
@ -69,7 +70,8 @@ export default {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
`\t⚠️ | Cannot get the database connection!\n\t\t(${err}).`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Events, MessageFlags } from "discord.js";
|
import { Events, MessageFlags } from 'discord.js';
|
||||||
import emoji from "../../../assets/emoji.json" assert { type: "json" };
|
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
|
|
@ -16,7 +16,8 @@ export default {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await command.execute(interaction);
|
await command.execute(interaction);
|
||||||
} catch (error) {
|
}
|
||||||
|
catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`⚠️ | Error when occured this command ${interaction.commandName}\n\t${error}`,
|
`⚠️ | Error when occured this command ${interaction.commandName}\n\t${error}`,
|
||||||
);
|
);
|
||||||
|
|
@ -25,7 +26,8 @@ export default {
|
||||||
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (After Print)`,
|
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (After Print)`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (Before Print)`,
|
content: `${emoji.answer.error} | ${interaction.commandName} seems have a problem, thanks report that to the support (Before Print)`,
|
||||||
flags: MessageFlags.Ephemeral,
|
flags: MessageFlags.Ephemeral,
|
||||||
|
|
|
||||||
41
src/index.ts
41
src/index.ts
|
|
@ -1,8 +1,8 @@
|
||||||
import fs from "node:fs";
|
import fs from 'node:fs';
|
||||||
import path from "node:path";
|
import path from 'node:path';
|
||||||
import "dotenv/config";
|
import 'dotenv/config';
|
||||||
import { Client, Collection, GatewayIntentBits } from "discord.js";
|
import { Client, Collection, GatewayIntentBits } from 'discord.js';
|
||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
|
@ -19,61 +19,64 @@ client.login(process.env.DSC_TOKEN);
|
||||||
|
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
|
|
||||||
const commandFolderPath = path.join(__dirname, "commands");
|
const commandFolderPath = path.join(__dirname, 'commands');
|
||||||
const commandFolders = fs.readdirSync(commandFolderPath);
|
const commandFolders = fs.readdirSync(commandFolderPath);
|
||||||
|
|
||||||
console.log("\n🔍 | Commands search:");
|
console.log('\n🔍 | Commands search:');
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
const commandsPath = path.join(commandFolderPath, folder);
|
const commandsPath = path.join(commandFolderPath, folder);
|
||||||
const commandFiles = fs
|
const commandFiles = fs
|
||||||
.readdirSync(commandsPath)
|
.readdirSync(commandsPath)
|
||||||
.filter((file) => file.endsWith(".js") || file.endsWith(".ts"));
|
.filter((file) => file.endsWith('.js') || file.endsWith('.ts'));
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const fullCommandPath = path.join(commandsPath, file);
|
const fullCommandPath = path.join(commandsPath, file);
|
||||||
try {
|
try {
|
||||||
const commandModule = await import(fullCommandPath);
|
const commandModule = await import(fullCommandPath);
|
||||||
const command = commandModule.default || commandModule;
|
const command = commandModule.default || commandModule;
|
||||||
if ("data" in command && "execute" in command) {
|
if ('data' in command && 'execute' in command) {
|
||||||
client.commands.set(command.data.name, command);
|
client.commands.set(command.data.name, command);
|
||||||
console.log(`\t✅ | ${command.data.name}`);
|
console.log(`\t✅ | ${command.data.name}`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(`\t⚠️ | Command at ${file}\n\t\t(${err}).`);
|
console.error(`\t⚠️ | Command at ${file}\n\t\t(${err}).`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("\n\n");
|
console.log('\n\n');
|
||||||
|
|
||||||
const eventFolderPath = path.join(__dirname, "events");
|
const eventFolderPath = path.join(__dirname, 'events');
|
||||||
const eventFolders = fs.readdirSync(eventFolderPath);
|
const eventFolders = fs.readdirSync(eventFolderPath);
|
||||||
|
|
||||||
console.log("\n🔍 | Events search:");
|
console.log('\n🔍 | Events search:');
|
||||||
for (const folder of eventFolders) {
|
for (const folder of eventFolders) {
|
||||||
const eventsPath = path.join(eventFolderPath, folder);
|
const eventsPath = path.join(eventFolderPath, folder);
|
||||||
const eventFiles = fs
|
const eventFiles = fs
|
||||||
.readdirSync(eventsPath)
|
.readdirSync(eventsPath)
|
||||||
.filter((file) => file.endsWith(".js") || file.endsWith(".ts"));
|
.filter((file) => file.endsWith('.js') || file.endsWith('.ts'));
|
||||||
for (const file of eventFiles) {
|
for (const file of eventFiles) {
|
||||||
const fullEventPath = path.join(eventsPath, file);
|
const fullEventPath = path.join(eventsPath, file);
|
||||||
try {
|
try {
|
||||||
const eventModule = await import(fullEventPath);
|
const eventModule = await import(fullEventPath);
|
||||||
const event = eventModule.default || eventModule;
|
const event = eventModule.default || eventModule;
|
||||||
if ("name" in event && "execute" in event) {
|
if ('name' in event && 'execute' in event) {
|
||||||
if (event.once) {
|
if (event.once) {
|
||||||
client.once(event.name, (...args) => event.execute(...args));
|
client.once(event.name, (...args) => event.execute(...args));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
client.on(event.name, (...args) => event.execute(...args));
|
client.on(event.name, (...args) => event.execute(...args));
|
||||||
}
|
}
|
||||||
console.log(`\t✅ | ${event.name}`);
|
console.log(`\t✅ | ${event.name}`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err) {
|
||||||
console.error(`\t⚠️ | Event at ${file}\n\t\t(${err}).`);
|
console.error(`\t⚠️ | Event at ${file}\n\t\t(${err}).`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("\n\n");
|
console.log('\n\n');
|
||||||
|
|
||||||
client.once("ready", async () => {
|
client.once('ready', async () => {
|
||||||
console.log(`🤖 | Connecté en tant que ${client.user?.tag}`);
|
console.log(`🤖 | Connecté en tant que ${client.user?.tag}`);
|
||||||
|
|
||||||
await prisma.bot.upsert({
|
await prisma.bot.upsert({
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { REST, Routes } from "discord.js";
|
import { REST, Routes } from 'discord.js';
|
||||||
import { Client, Collection, GatewayIntentBits } from "discord.js";
|
import { Client, Collection, GatewayIntentBits } from 'discord.js';
|
||||||
import "dotenv/config";
|
import 'dotenv/config';
|
||||||
import fs from "node:fs";
|
import fs from 'node:fs';
|
||||||
import path from "node:path";
|
import path from 'node:path';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [GatewayIntentBits.Guilds],
|
intents: [GatewayIntentBits.Guilds],
|
||||||
|
|
@ -12,21 +12,22 @@ client.commands = new Collection();
|
||||||
|
|
||||||
const commands = [];
|
const commands = [];
|
||||||
|
|
||||||
const foldersPath = path.join(__dirname, "../commands");
|
const foldersPath = path.join(__dirname, '../commands');
|
||||||
const commandFolders = fs.readdirSync(foldersPath);
|
const commandFolders = fs.readdirSync(foldersPath);
|
||||||
|
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
const commandsPath = path.join(foldersPath, folder);
|
const commandsPath = path.join(foldersPath, folder);
|
||||||
const commandFiles = fs
|
const commandFiles = fs
|
||||||
.readdirSync(commandsPath)
|
.readdirSync(commandsPath)
|
||||||
.filter((file) => file.endsWith(".ts") || file.endsWith(".js"));
|
.filter((file) => file.endsWith('.ts') || file.endsWith('.js'));
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const filesPath = path.join(commandsPath, file);
|
const filesPath = path.join(commandsPath, file);
|
||||||
const commandModule = await import(filesPath);
|
const commandModule = await import(filesPath);
|
||||||
const command = commandModule.default || commandModule;
|
const command = commandModule.default || commandModule;
|
||||||
if ("data" in command && "execute" in command) {
|
if ('data' in command && 'execute' in command) {
|
||||||
commands.push(command.data.toJSON());
|
commands.push(command.data.toJSON());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
console.log(
|
console.log(
|
||||||
'⚠️ | A Command is missing a required "data" or "execute" property.',
|
'⚠️ | A Command is missing a required "data" or "execute" property.',
|
||||||
);
|
);
|
||||||
|
|
@ -46,7 +47,8 @@ const rest = new REST().setToken(process.env.DSC_TOKEN);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
console.log(`✅ | ${data.length} is now reloaded`);
|
console.log(`✅ | ${data.length} is now reloaded`);
|
||||||
} catch (error) {
|
}
|
||||||
|
catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
import { PrismaClient } from "@prisma/client";
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
export const prisma = new PrismaClient();
|
export const prisma = new PrismaClient();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue