File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,13 @@ client.once('ready', () => {
12
12
13
13
client . login ( process . env . DISCORD_TOKEN )
14
14
15
+ client . on ( "disconnect" , ( ) => {
16
+ console . warn ( "⚠️ Bot desconectado! Tentando reconectar..." ) ;
17
+ } ) ;
18
+
19
+ client . on ( "reconnecting" , ( ) => {
20
+ console . log ( "🔄 Reconectando ao Discord..." ) ;
21
+ } ) ;
22
+
23
+
15
24
export { client }
Original file line number Diff line number Diff line change 1
1
import { FastifyInstance } from "fastify" ;
2
2
import { handleGitHubWebhook } from "../controllers/discord.controller" ;
3
+ import { client } from "../lib/bot" ;
3
4
4
5
export default async function BotRoutes ( server : FastifyInstance ) {
5
6
server . post ( '/webhook' , handleGitHubWebhook )
7
+ server . get ( "/ping" , async ( request , reply ) => {
8
+ if ( ! client . isReady ( ) ) {
9
+ return reply . status ( 500 ) . send ( { error : "Bot não está pronto!" } ) ;
10
+ }
11
+ return reply . send ( { status : "Bot online!" , uptime : process . uptime ( ) } ) ;
12
+ } ) ;
6
13
7
14
}
You can’t perform that action at this time.
0 commit comments