@@ -5,7 +5,46 @@ const config = require("./config.json");
5
5
const { prefix } = require ( "./config.json" ) ;
6
6
client . commands = new Discord . Collection ( ) ;
7
7
const { Sequelize } = require ( "sequelize" ) ;
8
+ var Honeybadger = require ( "honeybadger" ) . configure ( {
9
+ apiKey : "249af784" ,
10
+ } ) ;
11
+ const webhookClient = new Discord . WebhookClient (
12
+ "779377397413314581" ,
13
+ "RIBVE0pYmkQGmLhd4VcYBijMg5o6vMs88dZTp0BagZosbesWsjawapwcT7EgcJZNf-rb"
14
+ ) ;
15
+ const DBL = require ( "dblapi.js" ) ;
16
+ let dbl = new DBL (
17
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjczNzE0MjA1NTY3MDc3NTg1MCIsImJvdCI6dHJ1ZSwiaWF0IjoxNjA1MTA1MjE3fQ.Vs-Pc3BQ_YBJXWRdOZ4TizKpKEHa37uS-TiIUV4_g7E" ,
18
+ { webhookPort : 5000 , webhookAuth : "password" }
19
+ ) ;
20
+
21
+ // Optional events
22
+ dbl . on ( "posted" , ( ) => {
23
+ console . log ( "Server count posted!" ) ;
24
+ } ) ;
25
+
26
+ dbl . on ( "error" , ( e ) => {
27
+ console . log ( `Oops! ${ e } ` ) ;
28
+ Honeybadger . notify ( e ) ;
29
+ } ) ;
30
+
31
+ dbl . webhook . on ( "ready" , ( hook ) => {
32
+ console . log (
33
+ `Webhook running at https://canary.discord.com/api/webhooks/779377397413314581/RIBVE0pYmkQGmLhd4VcYBijMg5o6vMs88dZTp0BagZosbesWsjawapwcT7EgcJZNf-rb`
34
+ ) ;
35
+ } ) ;
36
+ dbl . webhook . on ( "vote" , ( vote ) => {
37
+ const embed = new Discord . MessageEmbed ( )
38
+ . setTitle ( "Someone Voted!" )
39
+ . setColor ( "#ff9100" ) ;
8
40
41
+ webhookClient . send ( `User with ID ${ vote . user } just voted!` , {
42
+ username : "some-username" ,
43
+ avatarURL :
44
+ "https://cdn.discordapp.com/attachments/695345270338355232/779392937511223337/3dgifmaker91407.gif" ,
45
+ embeds : [ embed ] ,
46
+ } ) ;
47
+ } ) ;
9
48
const sequelize = new Sequelize ( "database" , "user" , "password" , {
10
49
host : "localhost" ,
11
50
dialect : "sqlite" ,
@@ -36,17 +75,23 @@ const commandFiles = fs
36
75
37
76
client . once ( "ready" , ( ) => {
38
77
FAQTemp . sync ( ) ;
39
- client . user . setActivity ( client . guilds . cache . size + ' servers' , { type : 'WATCHING' } ) ;
78
+ client . user . setActivity ( client . guilds . cache . size + " servers" , {
79
+ type : "WATCHING" ,
80
+ } ) ;
40
81
console . log ( "My Body is ready." ) ;
41
82
} ) ;
42
83
client . on ( "guildCreate" , ( ) => {
43
84
// Fired every time the bot is added to a new server
44
- client . user . setActivity ( client . guilds . cache . size + ' servers' , { type : 'WATCHING' } ) ;
85
+ client . user . setActivity ( client . guilds . cache . size + " servers" , {
86
+ type : "WATCHING" ,
87
+ } ) ;
45
88
} ) ;
46
89
47
90
client . on ( "guildDelete" , ( ) => {
48
91
// Fired every time the bot is removed from a server
49
- client . user . setActivity ( client . guilds . cache . size + ' servers' , { type : 'WATCHING' } ) ;
92
+ client . user . setActivity ( client . guilds . cache . size + " servers" , {
93
+ type : "WATCHING" ,
94
+ } ) ;
50
95
} ) ;
51
96
for ( const file of commandFiles ) {
52
97
const command = require ( `./commands/${ file } ` ) ;
@@ -59,7 +104,7 @@ for (const file of commandFiles) {
59
104
client . on ( "message" , ( message ) => {
60
105
const guild = client . guilds . cache . get ( message . guild . id ) ;
61
106
const guildid = guild . id ;
62
- FAQTemp . tableName = guildid
107
+ FAQTemp . tableName = guildid ;
63
108
FAQTemp . sync ( ) ;
64
109
function clean ( text ) {
65
110
if ( typeof text === "string" )
@@ -68,7 +113,8 @@ client.on("message", (message) => {
68
113
. replace ( / @ / g, "@" + String . fromCharCode ( 8203 ) ) ;
69
114
else return text ;
70
115
}
71
- if ( ! message . content . startsWith ( prefix ) || message . channel . type == 'dm' ) return ;
116
+ if ( ! message . content . startsWith ( prefix ) || message . channel . type == "dm" )
117
+ return ;
72
118
73
119
const args = message . content . slice ( prefix . length ) . trim ( ) . split ( / + / ) ;
74
120
const command = args . shift ( ) . toLowerCase ( ) ;
@@ -79,10 +125,11 @@ client.on("message", (message) => {
79
125
} catch ( error ) {
80
126
console . error ( error ) ;
81
127
message . channel . send (
82
- `\`An unexpected error has occured ! Please try again later! Please report this to @BoredFish#4269. More technical details:\` \`\`\`xl\n${ clean (
128
+ `\`An unexpected error has occurred ! Please try again later! Please report this to @BoredFish#4269. More technical details:\` \`\`\`xl\n${ clean (
83
129
error
84
130
) } \n\`\`\``
85
131
) ;
132
+ Honeybadger . notify ( error ) ;
86
133
}
87
134
} ) ;
88
135
0 commit comments