Skip to content

Commit

Permalink
Merge pull request #60 from Wiibleyde/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Wiibleyde authored Dec 11, 2024
2 parents 80f01e2 + 08c9ff4 commit 83e02ac
Show file tree
Hide file tree
Showing 9 changed files with 8,442 additions and 3,932 deletions.
8,416 changes: 8,416 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"@discord-player/extractor": "^4.3.1",
"@discordjs/opus": "github:discordjs/opus",
"@google/generative-ai": "^0.21.0",
"@prisma/client": "^5.22.0",
"blagues-api": "^2.1.1",
Expand All @@ -27,7 +28,6 @@
"dotenv": "^16.0.3",
"jimp": "^0.22.12",
"node-ical": "^0.20.1",
"node-opus": "^0.3.3",
"prisma": "^5.22.0",
"rotating-file-stream": "^3.2.3"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/syncedlyrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function execute(interaction: CommandInteraction) {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const thread = await (queue.metadata as { channel: any }).channel.threads.create({
name: `Paroles synchronisées de ${queue.currentTrack?.title}`,
name: `Paroles synchronisées de ${queue.currentTrack?.title.slice(0, 50)}`,
})

queue.setMetadata({
Expand Down
11 changes: 9 additions & 2 deletions src/contextMenus/general/profilePicture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { successEmbed } from "@/utils/embeds";
import { EmbedBuilder } from "@discordjs/builders";
import { ApplicationCommandType, ContextMenuCommandBuilder, UserContextMenuCommandInteraction } from "discord.js";

export const data: ContextMenuCommandBuilder = new ContextMenuCommandBuilder()
Expand All @@ -12,5 +12,12 @@ export async function execute(interaction: UserContextMenuCommandInteraction): P
const author = interaction.targetUser
const userProfilePicture = author?.displayAvatarURL({ extension: "png", size: 1024 })

await interaction.editReply({ embeds: [successEmbed(interaction, `Photo de profil de ${author?.toString()}: ${userProfilePicture}`)] })
const embed = new EmbedBuilder()
.setTitle("Photo de profil")
.setImage(userProfilePicture)
.setColor(0x00ff00)
.setTimestamp()
.setFooter({ text: `Eve – Toujours prête à vous aider.`, iconURL: interaction.client.user.displayAvatarURL() })

await interaction.editReply({ embeds: [embed] })
}
4 changes: 2 additions & 2 deletions src/contextMenus/general/quote.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { prisma } from "@/utils/database";
import { successEmbed } from "@/utils/embeds";
import { createQuote } from "@/utils/quote";
import { ApplicationCommandType, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, TextChannel } from "discord.js";
import { ApplicationCommandType, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, TextChannel } from "discord.js";

export const data: ContextMenuCommandBuilder = new ContextMenuCommandBuilder()
.setName("Créer un citation")
Expand All @@ -13,7 +13,7 @@ export async function execute(interaction: MessageContextMenuCommandInteraction)

const quote = interaction.targetMessage?.content
const author = interaction.targetMessage?.author
const date = interaction.targetMessage?.createdAt.toISOString() || new Date().toLocaleDateString()
const date = interaction.targetMessage?.createdAt.toLocaleDateString() || new Date().toLocaleDateString()
const userProfilePicture = author?.displayAvatarURL({ extension: "png", size: 1024 })

let channelWhereToPost = null
Expand Down
10 changes: 4 additions & 6 deletions src/contextMenus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import * as quote from "./general/quote"

import * as profilePicture from "./general/profilePicture"

export const contextMessageMenus = {
const contextMessageMenus = {
"Créer un citation": quote
}

export const contextUserMenus = {
const contextUserMenus = {
"Récupèrer la photo de profil": profilePicture
}

export const contextMenus = {
...contextMessageMenus,
...contextUserMenus
}

export { contextMessageMenus, contextUserMenus }
13 changes: 8 additions & 5 deletions src/deploy-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { config } from "@/config"
import { commands, devCommands } from "@/commands"
import { logger } from "@/index"
import { client } from "."
import { contextMenus } from "./contextMenus"
import { contextMessageMenus, contextUserMenus } from "./contextMenus"

const commandsData = Object.values(commands).map((command) => command.data)
const devCommandsData = Object.values(devCommands).map((command) => command.data)
const contextCommandsData = Object.values(contextMenus).map((command) => command.data)
const contextCommandsData = [
...Object.values(contextMessageMenus).map((command) => command.data),
...Object.values(contextUserMenus).map((command) => command.data)
]

const rest = new REST({ version: '9', timeout: 15000 }).setToken(config.DISCORD_TOKEN)

Expand Down Expand Up @@ -40,10 +43,10 @@ export async function deployCommands(): Promise<void> {

export async function deployContextMenus(): Promise<void> {
try {
logger.info("Chargement des menus contextuels")
logger.info(`Chargement des menus contextuels (${contextCommandsData.length})...`)

await rest.put(
Routes.applicationGuildCommands(config.DISCORD_CLIENT_ID, config.EVE_HOME_GUILD),
Routes.applicationCommands(config.DISCORD_CLIENT_ID),
{
body: contextCommandsData,
}
Expand All @@ -70,7 +73,7 @@ export async function deployContextMenus(): Promise<void> {
*/
export async function deployDevCommands(guildId: string): Promise<void> {
try {
logger.info("Chargement des commandes pour la guilde...")
logger.info(`Chargement des commandes de développement pour la guilde ${guildId} (${devCommandsData.length})...`)

await rest.put(
Routes.applicationGuildCommands(config.DISCORD_CLIENT_ID, guildId),
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const client = new Client({
]
})


export const player = new Player(client, {ytdlOptions: {quality: 'highestaudio', highWaterMark: 1 << 25}})
player.extractors.register(YoutubeiExtractor, {})

Expand Down
Loading

0 comments on commit 83e02ac

Please sign in to comment.