File tree Expand file tree Collapse file tree 5 files changed +34
-10
lines changed
events/CommandLoggingEvents Expand file tree Collapse file tree 5 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 4
4
devid =
5
5
mongodb =
6
6
movietrackerapi =
7
- rapidapikey =
7
+ rapidapikey =
8
+
9
+ webhookSlashLogging = "",
10
+ webhookPrefixLogging = "",
Original file line number Diff line number Diff line change 4
4
devid =
5
5
mongodb =
6
6
movietrackerapi =
7
- rapidapikey =
7
+ rapidapikey =
8
+
9
+ webhookSlashLogging = "",
10
+ webhookPrefixLogging = "",
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ module.exports = {
54
54
musicEmojiError : "❌" ,
55
55
56
56
// CHANNEL IDS //
57
- slashCommandLoggingChannel : "1238869804744441896" , // slash command logging channel
58
- prefixCommandLoggingChannel : "1241592178480775188" , // Prefix command logging channel
59
57
suggestionChannel : "1240335460463677503" , // Suggestion channel
60
58
bugReportChannel : "1240341717031456840" , // Bug report channel
61
59
botLeaveChannel : "1139731092329480332" , // Logging channel for bot leaving servers
Original file line number Diff line number Diff line change 1
- const { Events, EmbedBuilder } = require ( 'discord.js' ) ;
1
+ const { Events, EmbedBuilder, WebhookClient } = require ( 'discord.js' ) ;
2
2
3
3
module . exports = {
4
4
name : Events . MessageCreate ,
@@ -7,7 +7,7 @@ module.exports = {
7
7
const guildPrefix = client . config . prefix ;
8
8
if ( ! message . author . bot && message . content . startsWith ( guildPrefix ) ) {
9
9
10
- const channel = await client . channels . cache . get ( client . config . prefixCommandLoggingChannel ) ;
10
+ const webhookURL = process . env . webhookPrefixLogging ;
11
11
const server = message . guild . name ;
12
12
const user = message . author . username ;
13
13
const userID = message . author . id ;
@@ -22,7 +22,17 @@ module.exports = {
22
22
. setTimestamp ( )
23
23
. setFooter ( { text : `Command Logger ${ client . config . devBy } ` , iconURL : message . author . avatarURL ( { dynamic : true } ) } )
24
24
25
- await channel . send ( { embeds : [ embed ] } ) ;
25
+ try {
26
+ const webhookClient = new WebhookClient ( { url : webhookURL } ) ;
27
+
28
+ await webhookClient . send ( {
29
+ embeds : [ embed ] ,
30
+ username : `${ client . user . username } Prefix Command Logger` ,
31
+ avatarURL : client . user . avatarURL ( ) ,
32
+ } ) ;
33
+ } catch ( error ) {
34
+ client . logs . error ( '[COMMAND_PREFIX_LOGGING_WEBHOOK] Error whilst sending webhook:' , error ) ;
35
+ }
26
36
}
27
37
}
28
38
}
Original file line number Diff line number Diff line change 1
- const { Events, EmbedBuilder } = require ( 'discord.js' ) ;
1
+ const { Events, EmbedBuilder, WebhookClient } = require ( 'discord.js' ) ;
2
2
3
3
module . exports = {
4
4
name : Events . InteractionCreate ,
@@ -8,7 +8,7 @@ module.exports = {
8
8
if ( ! interaction . isChatInputCommand ( ) ) return ;
9
9
else {
10
10
11
- const channel = await client . channels . cache . get ( client . config . slashCommandLoggingChannel ) ;
11
+ const webhookURL = process . env . webhookSlashLogging ;
12
12
const server = interaction . guild . name ;
13
13
const user = interaction . user . username ;
14
14
const userID = interaction . user . id ;
@@ -23,7 +23,17 @@ module.exports = {
23
23
. setTimestamp ( )
24
24
. setFooter ( { text : `Command Logger ${ client . config . devBy } ` , iconURL : interaction . user . avatarURL ( { dynamic : true } ) } )
25
25
26
- await channel . send ( { embeds : [ embed ] } ) ;
26
+ try {
27
+ const webhookClient = new WebhookClient ( { url : webhookURL } ) ;
28
+
29
+ await webhookClient . send ( {
30
+ embeds : [ embed ] ,
31
+ username : `${ client . user . username } SlashCommand Logger` ,
32
+ avatarURL : client . user . avatarURL ( ) ,
33
+ } ) ;
34
+ } catch ( error ) {
35
+ client . logs . error ( '[COMMAND_SLASH_LOGGING_WEBHOOK] Error whilst sending webhook:' , error ) ;
36
+ }
27
37
}
28
38
}
29
39
}
You can’t perform that action at this time.
0 commit comments