@@ -5,7 +5,46 @@ const config = require("./config.json");
55const { prefix } = require ( "./config.json" ) ;
66client . commands = new Discord . Collection ( ) ;
77const { 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" ) ;
840
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+ } ) ;
948const sequelize = new Sequelize ( "database" , "user" , "password" , {
1049 host : "localhost" ,
1150 dialect : "sqlite" ,
@@ -36,17 +75,23 @@ const commandFiles = fs
3675
3776client . once ( "ready" , ( ) => {
3877 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+ } ) ;
4081 console . log ( "My Body is ready." ) ;
4182} ) ;
4283client . on ( "guildCreate" , ( ) => {
4384 // 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+ } ) ;
4588} ) ;
4689
4790client . on ( "guildDelete" , ( ) => {
4891 // 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+ } ) ;
5095} ) ;
5196for ( const file of commandFiles ) {
5297 const command = require ( `./commands/${ file } ` ) ;
@@ -59,7 +104,7 @@ for (const file of commandFiles) {
59104client . on ( "message" , ( message ) => {
60105 const guild = client . guilds . cache . get ( message . guild . id ) ;
61106 const guildid = guild . id ;
62- FAQTemp . tableName = guildid
107+ FAQTemp . tableName = guildid ;
63108 FAQTemp . sync ( ) ;
64109 function clean ( text ) {
65110 if ( typeof text === "string" )
@@ -68,7 +113,8 @@ client.on("message", (message) => {
68113 . replace ( / @ / g, "@" + String . fromCharCode ( 8203 ) ) ;
69114 else return text ;
70115 }
71- if ( ! message . content . startsWith ( prefix ) || message . channel . type == 'dm' ) return ;
116+ if ( ! message . content . startsWith ( prefix ) || message . channel . type == "dm" )
117+ return ;
72118
73119 const args = message . content . slice ( prefix . length ) . trim ( ) . split ( / + / ) ;
74120 const command = args . shift ( ) . toLowerCase ( ) ;
@@ -79,10 +125,11 @@ client.on("message", (message) => {
79125 } catch ( error ) {
80126 console . error ( error ) ;
81127 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 (
83129 error
84130 ) } \n\`\`\``
85131 ) ;
132+ Honeybadger . notify ( error ) ;
86133 }
87134} ) ;
88135
0 commit comments