@@ -87,7 +87,7 @@ async function load() {
8787
8888 if ( locales . has ( locale . locale ) )
8989 return console . warn ( `[UYARI] ${ locale . locale } dili zaten yüklenmiş. Atlanıyor..` ) ;
90-
90+
9191 locales . set ( locale . locale , locale ) ;
9292 console . info ( `[BİLGİ] "${ locale . locale } " dili yüklendi. (${ Date . now ( ) - start } ms sürdü.)` ) ;
9393 } )
@@ -102,32 +102,32 @@ async function load() {
102102 let uInter = require ( interactionFile ) ;
103103
104104 if ( uInter ?. _type != "interaction" && uInter ?. _type != "noDeployInteraction" ) {
105- console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyası boş. Atlanıyor..` ) ;
105+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyası boş. Atlanıyor..` ) ;
106106 return ;
107107 }
108108
109109 if ( ! uInter . id ) {
110- console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının bir idsi bulunmuyor. Atlanıyor..` ) ;
110+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının bir idsi bulunmuyor. Atlanıyor..` ) ;
111111 return ;
112112 }
113113
114114 if ( uInter . name . length > 3 ) {
115- console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının isim listesi çok uzun. (>3) Atlanıyor..` ) ;
115+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının isim listesi çok uzun. (>3) Atlanıyor..` ) ;
116116 return ;
117117 }
118118
119119 if ( ! uInter . name ?. length ) {
120- console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının bir ismi bulunmuyor. Atlanıyor..` ) ;
120+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyasının bir ismi bulunmuyor. Atlanıyor..` ) ;
121121 return ;
122122 }
123123
124124 if ( Underline . interactions . has ( uInter . id ) ) {
125- console . warn ( `[UYARI] "${ uInter . id } " idli bir interaksiyon daha önceden zaten yüklenmiş. Atlanıyor.` )
125+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ uInter . id } " idli bir interaksiyon daha önceden zaten yüklenmiş. Atlanıyor.` )
126126 return ;
127127 }
128128
129129 if ( typeof uInter . onInteraction != "function" ) {
130- console . error ( `[HATA] "${ rltPath } " interaksiyon dosyası geçerli bir onInteraction fonksiyonuna sahip değil! Atlanıyor.` ) ;
130+ if ( Underline . config . debugLevel >= 1 ) console . error ( `[HATA] "${ rltPath } " interaksiyon dosyası geçerli bir onInteraction fonksiyonuna sahip değil! Atlanıyor.` ) ;
131131 return ;
132132 } ;
133133
@@ -138,7 +138,7 @@ async function load() {
138138
139139 if ( uInter . developerOnly ) {
140140 uInter . calculated . developerOnly = true ;
141- console . warn ( `[UYARI] "${ uInter . id } " idli interaksiyon'da developerOnly seçeneğini kullanmışsınız, bu seçenek ilerki sürümlerde kaldırılacaktır lütfen bunu yapmak yerine perms.user kısmına "DEVELOPER"'ı koyunuz.` )
141+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ uInter . id } " idli interaksiyon'da developerOnly seçeneğini kullanmışsınız, bu seçenek ilerki sürümlerde kaldırılacaktır lütfen bunu yapmak yerine perms.user kısmına "DEVELOPER"'ı koyunuz.` )
142142 }
143143
144144 {
@@ -147,20 +147,20 @@ async function load() {
147147 uInter . calculated . developerOnly = true ;
148148 uInter . perms . user . splice ( devOnlyIndex , 1 ) ;
149149 }
150-
150+
151151 let gOwnerOnlyIndex = uInter . perms . user . findIndex ( p => p == "GUILD_OWNER" ) ;
152152 if ( gOwnerOnlyIndex > - 1 ) {
153153 uInter . calculated . guildOwnerOnly = true ;
154154 uInter . perms . user . splice ( gOwnerOnlyIndex , 1 ) ;
155155 }
156156 }
157-
157+
158158 if ( ! uInter . guildOnly && ( uInter . perms . bot . length != 0 || uInter . perms . user . length != 0 ) ) {
159- console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyası sunuculara özel olmamasına rağmen özel perm kullanıyor.` ) ;
159+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " interaksiyon dosyası sunuculara özel olmamasına rağmen özel perm kullanıyor.` ) ;
160160 }
161161
162162 if ( ! uInter . guildOnly && uInter . calculated . guildOwnerOnly ) {
163- console . error ( `[HATA] "${ rltPath } " interaksiyon dosyası sunuculara özel olmamasına rağmen sunucu sahibine özel! Atlanıyor.` ) ;
163+ if ( Underline . config . debugLevel >= 1 ) console . error ( `[HATA] "${ rltPath } " interaksiyon dosyası sunuculara özel olmamasına rağmen sunucu sahibine özel! Atlanıyor.` ) ;
164164 return ;
165165 }
166166
@@ -172,7 +172,7 @@ async function load() {
172172 if ( Underline . interactions . size ) {
173173 console . info ( `[BİLGİ] ${ Underline . interactions . size } interaksiyon yüklendi.` ) ;
174174 } else {
175- console . warn ( `[UYARI] Hiçbir interaksiyon yüklenmedi, herşey yolunda mı?` ) ;
175+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] Hiçbir interaksiyon yüklenmedi, herşey yolunda mı?` ) ;
176176 }
177177
178178 eventFiles = await getEventFilePaths ( ) ;
@@ -186,19 +186,19 @@ async function load() {
186186 let event = require ( eventFile ) ;
187187
188188 if ( event ?. _type != "event" ) {
189- console . warn ( `[UYARI] "${ rltPath } " event dosyası boş. Atlanıyor..` ) ;
189+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ rltPath } " event dosyası boş. Atlanıyor..` ) ;
190190 return ;
191191 }
192192
193193 if ( typeof event . id != "string" ) event . id = path . basename ( eventFile ) . slice ( 0 , - 3 ) . replace ( / / g, "" ) ;
194194
195195 if ( Underline . events . has ( event . id ) ) {
196- console . warn ( `[UYARI] "${ event . id } " adlı bir event daha önceden zaten yüklenmiş. Atlanıyor.` ) ;
196+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ event . id } " adlı bir event daha önceden zaten yüklenmiş. Atlanıyor.` ) ;
197197 return ;
198198 }
199199
200200 if ( typeof event . onEvent != "function" ) {
201- console . error ( `[HATA] "${ rltPath } " olay dosyası geçerli bir onEvent fonksiyonuna sahip değil! Atlanıyor.` ) ;
201+ if ( Underline . config . debugLevel >= 1 ) console . error ( `[HATA] "${ rltPath } " olay dosyası geçerli bir onEvent fonksiyonuna sahip değil! Atlanıyor.` ) ;
202202 return ;
203203 } ;
204204
@@ -213,7 +213,7 @@ async function load() {
213213 if ( Underline . events . size ) {
214214 console . info ( `[BİLGİ] ${ Underline . events . size } event yüklendi.` ) ;
215215 } else {
216- console . warn ( `[UYARI] Hiçbir olay yüklenmedi, herşey yolunda mı?` ) ;
216+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] Hiçbir olay yüklenmedi, herşey yolunda mı?` ) ;
217217 }
218218
219219 {
@@ -244,21 +244,23 @@ async function load() {
244244 chillout . forEach ( events ,
245245 /** @param {import("./types/Event") } event */
246246 ( event ) => {
247- if ( ! event . disabled ) {
248- try {
249- event . onEvent ( ...args ) ;
250- Underline . config . onAfterEvent ( eventName , args , other ) ;
251- } catch ( err ) {
252- console . error ( `[HATA] "${ event . id } " idli ve "${ eventName } " isimli olayda bir hata oluştu!` ) ;
253- if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
254- if ( err . stack ) {
255- `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
256- console . error ( `[HATA] ${ line } ` ) ;
257- } ) ;
247+ if ( ! event . disabled ) {
248+ try {
249+ event . onEvent ( ...args ) ;
250+ Underline . config . onAfterEvent ( eventName , args , other ) ;
251+ } catch ( err ) {
252+ if ( Underline . config . debugLevel >= 1 ) {
253+ console . error ( `[HATA] "${ event . id } " idli ve "${ eventName } " isimli olayda bir hata oluştu!` ) ;
254+ if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
255+ if ( err . stack ) {
256+ `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
257+ console . error ( `[HATA] ${ line } ` ) ;
258+ } ) ;
259+ }
260+ }
258261 }
259262 }
260- }
261- } ) ;
263+ } ) ;
262264
263265 } , 0 )
264266 }
@@ -313,7 +315,7 @@ async function unload() {
313315
314316 unloadStart = 0 ;
315317 pathsToUnload = 0 ;
316-
318+
317319}
318320
319321async function reload ( ) {
@@ -347,32 +349,32 @@ client.on("interactionCreate", async (interaction) => {
347349 if ( interaction . isAutocomplete ( ) ) {
348350 if ( uInter . disabled ) {
349351 let r = await config . userErrors . disabled ( interaction , uInter , other ) ;
350- interaction . respond ( r ) ;
352+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
351353 return ;
352354 }
353355 if ( config . blockedUsers . has ( interaction . user . id ) ) {
354356 let r = await config . userErrors . blocked ( interaction , uInter , other ) ;
355- interaction . respond ( r ) ;
357+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
356358 return ;
357359 }
358360 if ( uInter . guildOnly && ! interaction . guildId ) {
359361 let r = await config . userErrors . guildOnly ( interaction , uInter , other ) ;
360- interaction . respond ( r ) ;
362+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
361363 return ;
362364 }
363365 if ( uInter . calculated . developerOnly && ! config . developers . has ( interaction . user . id ) ) {
364366 let r = await config . userErrors . developerOnly ( interaction , uInter , other ) ;
365- interaction . respond ( r ) ;
367+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
366368 return ;
367369 }
368370 if ( uInter . calculated . guildOwnerOnly && ! config . developers . has ( interaction . user . id ) && interaction . guild . ownerId != interaction . user . id ) {
369371 let r = await config . userErrors . guildOwnerOnly ( interaction , uInter , other ) ;
370- interaction . respond ( r ) ;
372+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
371373 return ;
372374 }
373375 if ( uInter . guildOnly && ( ! config . developers . has ( interaction . user . id ) ) && uInter . perms . user . length != 0 && ! uInter . perms . user . every ( perm => interaction . member . permissions . has ( perm ) ) ) {
374376 let r = await config . userErrors . userPermsRequired ( interaction , uInter , uInter . perms . user , other ) ;
375- interaction . respond ( r ) ;
377+ interaction . respond ( r ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } )
376378 return ;
377379 }
378380 /** @type {Discord.ApplicationCommandOptionChoice } */
@@ -382,14 +384,16 @@ client.on("interactionCreate", async (interaction) => {
382384 if ( option ) {
383385 try {
384386 let completeResponse = await option . onComplete ( interaction , focussed . value ) ;
385- interaction . respond ( completeResponse ) ;
387+ interaction . respond ( completeResponse ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ;
386388 } catch ( err ) {
387- console . error ( `[HATA] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon için otomatik tamamlama çalıştırılırken bir hata ile karşılaşıldı!` )
388- if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
389- if ( err . stack ) {
390- `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
391- console . error ( `[HATA] ${ line } ` ) ;
392- } ) ;
389+ if ( Underline . config . debugLevel >= 1 ) {
390+ console . error ( `[HATA] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon için otomatik tamamlama çalıştırılırken bir hata ile karşılaşıldı!` )
391+ if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
392+ if ( err . stack ) {
393+ `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
394+ console . error ( `[HATA] ${ line } ` ) ;
395+ } ) ;
396+ }
393397 }
394398 }
395399 }
@@ -407,72 +411,74 @@ client.on("interactionCreate", async (interaction) => {
407411 }
408412
409413 if ( uInter . disabled ) {
410- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
414+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
411415 config . userErrors . disabled ( interaction , uInter , other ) ;
412416 return ;
413417 }
414418
415419 if ( config . blockedUsers . has ( interaction . user . id ) ) {
416- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
420+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
417421 config . userErrors . blocked ( interaction , uInter , other ) ;
418422 return ;
419423 }
420424
421425 if ( uInter . guildOnly && ! interaction . guildId ) {
422- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
426+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
423427 config . userErrors . guildOnly ( interaction , uInter , other ) ;
424428 return ;
425429 }
426430
427431 if ( uInter . calculated . developerOnly && ! config . developers . has ( interaction . user . id ) ) {
428- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
432+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
429433 config . userErrors . developerOnly ( interaction , uInter , other ) ;
430434 return ;
431435 }
432436
433437 if ( uInter . calculated . guildOwnerOnly && ! config . developers . has ( interaction . user . id ) && interaction . guild . ownerId != interaction . user . id ) {
434- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
438+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
435439 config . userErrors . guildOwnerOnly ( interaction , uInter , other ) ;
436440 return ;
437441 }
438442
439443 if ( uInter . guildOnly && uInter . perms . bot . length != 0 && ! uInter . perms . bot . every ( perm => interaction . guild . me . permissions . has ( perm ) ) ) {
440- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
444+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
441445 config . userErrors . botPermsRequired ( interaction , uInter , uInter . perms . bot , other ) ;
442446 return ;
443447 }
444448
445449 if ( uInter . guildOnly && ( ! config . developers . has ( interaction . user . id ) ) && uInter . perms . user . length != 0 && ! uInter . perms . user . every ( perm => interaction . member . permissions . has ( perm ) ) ) {
446- if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( ( ) => { } ) ) : null ;
450+ if ( uInter . nullError ) return interaction . update ? ( await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ) : null ;
447451 config . userErrors . userPermsRequired ( interaction , uInter , uInter . perms . user , other ) ;
448452 return ;
449453 }
450454
451455 if ( uInter . autoDefer != "off" ) {
452456 const newDefer = ( ) => {
453- console . warn ( `[UYARI] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon için "deferReply" umursanmadı, interaksiyon zaten otomatik olarak bekleme moduna alınmış.` ) ;
457+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon için "deferReply" umursanmadı, interaksiyon zaten otomatik olarak bekleme moduna alınmış.` ) ;
454458 } ;
455459 if (
456460 interaction . isCommand ( ) || interaction . isApplicationCommand ( ) || interaction . isMessageContextMenu ( ) || interaction . isUserContextMenu ( )
457461 ) {
458- await interaction . deferReply ( uInter . autoDefer == "ephemeral" ? { ephemeral : true } : null ) ;
462+ await interaction . deferReply ( uInter . autoDefer == "ephemeral" ? { ephemeral : true } : null ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ;
459463 interaction . deferReply = newDefer ;
460464 interaction . reply = interaction . editReply ;
461465 } else if (
462466 interaction . isButton ( ) || interaction . isSelectMenu ( )
463467 ) {
464- await utils . nullDefer ( interaction ) ;
468+ await interaction . update ( ) . catch ( Underline . config . debugLevel >= 2 ? console . error : ( ) => { } ) ;
469+ // await utils.nullDefer(interaction);
465470 interaction . deferReply = newDefer ;
466471 interaction . reply = interaction . editReply = interaction . followUp = ( ) => {
467- console . warn ( `[UYARI] "${ uInter . name [ 0 ] } " adlı interaksiyon için "reply" umursanmadı, interaksiyona zaten otomatik olarak boş cevap verilmiş.` ) ;
472+ if ( Underline . config . debugLevel >= 1 ) console . warn ( `[UYARI] "${ uInter . name [ 0 ] } " adlı interaksiyon için "reply" umursanmadı, interaksiyona zaten otomatik olarak boş cevap verilmiş.` ) ;
468473 } ;
469474 }
470475 }
471476
472477 if ( typeof uInter . coolDown == "number" ) uInter . coolDown = [ {
473478 type : "user" ,
474- amount : uInter . coolDown
479+ amount : uInter . coolDown ,
475480 } ] ;
481+
476482 if ( typeof uInter . coolDown == "object" && ! Array . isArray ( uInter . coolDown ) ) uInter . coolDown = [ uInter . coolDown ] ;
477483
478484 let converter = {
@@ -530,12 +536,14 @@ client.on("interactionCreate", async (interaction) => {
530536 await config . onAfterInteraction ( uInter , interaction , other ) ;
531537
532538 } catch ( err ) {
533- console . error ( `[HATA] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon çalıştırılırken bir hata ile karşılaşıldı!` )
534- if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
535- if ( err . stack ) {
536- `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
537- console . error ( `[HATA] ${ line } ` ) ;
538- } ) ;
539+ if ( Underline . config . debugLevel >= 1 ) {
540+ console . error ( `[HATA] "${ uInter . actionType == "CHAT_INPUT" ? `/${ uInter . name . join ( " " ) } ` : `${ uInter . name [ 0 ] } ` } " adlı interaksiyon çalıştırılırken bir hata ile karşılaşıldı!` )
541+ if ( err . message ) console . error ( `[HATA] ${ err . message } ` ) ;
542+ if ( err . stack ) {
543+ `${ err . stack } ` . split ( "\n" ) . forEach ( ( line ) => {
544+ console . error ( `[HATA] ${ line } ` ) ;
545+ } ) ;
546+ }
539547 }
540548 }
541549 } ) ( ) ;
0 commit comments