2023-10-13 15:04:11 +02:00
import { buttonList } from "../interactions/buttons/index.mjs" ;
import { modalList } from "../interactions/modals/index.mjs" ;
import { selectMenuList } from "../interactions/selectmenus/index.mjs" ;
2022-11-09 14:44:05 +01:00
2023-10-13 15:04:11 +02:00
import config from "../config.json" assert { type : "json" } ;
2023-09-13 21:12:45 +02:00
const { guildId } = config ;
export default {
2023-10-13 15:04:11 +02:00
name : "interactionCreate" ,
2022-11-09 14:44:05 +01:00
async execute ( interaction , client ) {
if ( interaction . guild . id != guildId ) {
return interaction . reply ( {
2023-10-13 15:04:11 +02:00
content :
"Bonjour,\nLe support multi-serveur de portal'bot a été désactivé.\nCela signifie qu'il n'est plus disponible autre part que sur les serveurs Portal.\nBot actuellement diponible sur:\n-Art'Portal - http://discord.gg/graphisme\n\nSi vous recherchez un bot multifonctionnel, le développeur du bot vous conseille Tokinotsuki - https://discord.com/oauth2/authorize?client_id=791437575642152982&permissions=8&scope=bot%20applications.commands" ,
2022-11-09 14:44:05 +01:00
} ) ;
}
2023-10-13 15:04:11 +02:00
if (
interaction . isChatInputCommand ( ) ||
interaction . isContextMenuCommand ( )
) {
2022-11-09 14:44:05 +01:00
const command = client . commands . get ( interaction . commandName ) ;
if ( ! command ) return ;
2023-10-13 15:04:11 +02:00
2022-11-09 14:44:05 +01:00
try {
await command . execute ( interaction , client ) ;
} catch ( error ) {
console . error ( error ) ;
try {
2023-10-13 15:04:11 +02:00
await interaction . reply ( {
content :
"There was an error while executing this command!" ,
ephemeral : true ,
} ) ;
} catch ( error ) {
2022-11-09 14:44:05 +01:00
console . error ( error ) ;
}
}
} else if ( interaction . isButton ( ) ) {
2023-10-13 15:04:11 +02:00
buttonList [ interaction . customId . split ( "_" ) [ 0 ] ]
? buttonList [ interaction . customId . split ( "_" ) [ 0 ] ] . execute (
interaction ,
client ,
)
: interaction . reply ( {
content :
"Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !" ,
ephemeral : true ,
} ) ;
2023-02-25 10:15:28 +01:00
} else if ( interaction . isStringSelectMenu ( ) ) {
2023-10-13 15:04:11 +02:00
selectMenuList [ interaction . customId . split ( "_" ) [ 0 ] ] . execute (
interaction ,
client ,
) ;
2022-11-09 14:44:05 +01:00
} else if ( interaction . isModalSubmit ( ) ) {
2023-10-13 15:04:11 +02:00
modalList [ interaction . customId . split ( "_" ) [ 0 ] ]
? modalList [ interaction . customId . split ( "_" ) [ 0 ] ] . execute (
interaction ,
client ,
)
: interaction . reply ( {
content :
"Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !" ,
ephemeral : true ,
} ) ;
2022-11-09 14:44:05 +01:00
} else {
2023-10-13 15:04:11 +02:00
console . log ( interaction ) ;
2022-11-09 14:44:05 +01:00
}
2023-10-13 15:04:11 +02:00
} ,
} ;