Search
Setup for Free
d-I❄
discord.js - Imagine ❄
•
3y ago
RajGM
discord bot in same server as NEXTJS Backend
How to make
(export
) discord bot to be alive
(import
) to rest of the NEXTJS server files
?
discord.js - Imagine ❄
Join
Support server for discord.js, a Node.js module to interact with Discord's apps API.
58,336
Members
View on Discord
Similar Threads
Was this page helpful?
Yes
No
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
D
d.js toolkit
•
6/27/23, 5:36 PM
• What
's your exact discord
.js
npm list discord.js
npm list discord.js
and node
node -v
node -v
version
?
• Post the full error stack trace
, not just the top part
!
• Show your code
!
• Explain what exactly your issue is
.
• Not a discord
.js issue
? Check out
#useful
-servers
.
S
Siris.ly
•
6/27/23, 5:38 PM
the nextjs backend is serverless it won
't be feasible with the normal discord
.js library
R
RajGM
OP
•
6/27/23, 5:39 PM
Should I host the discord bot in some nodejs server and then call it from nextjs server
?
S
Siris.ly
•
6/27/23, 5:40 PM
What are you trying to do
?
R
RajGM
OP
•
6/27/23, 5:41 PM
A backend that stores some data to firebase from client
then send those data to discord server
S
Siris.ly
•
6/27/23, 5:42 PM
so you just need access to the firebase backend on your website
, right
?
R
RajGM
OP
•
6/27/23, 5:42 PM
yes
O
ohio
•
6/27/23, 5:42 PM
@rajgm you could always just make an http bot to send the data to a discord server
O
ohio
•
6/27/23, 5:42 PM
much less resource hungry
O
ohio
•
6/27/23, 5:42 PM
for a bot that doesn
't need all the features of d
.js
S
Siris.ly
•
6/27/23, 5:42 PM
Yes
, you could but its a bit more complex to setup
O
ohio
•
6/27/23, 5:42 PM
if all you use it is to send a message
O
ohio
•
6/27/23, 5:42 PM
or you could even opt for webhooks
O
ohio
•
6/27/23, 5:42 PM
i think webhooks would be the best option
S
Siris.ly
•
6/27/23, 5:43 PM
but also if you want to use djs you can host the bot on a nodejs server and access firebase
only
on the website
R
RajGM
OP
•
6/27/23, 5:44 PM
that means I need to create another server with some keys and discordbot on the same server
expose it to the first server
R
RajGM
OP
•
6/27/23, 5:44 PM
is nodejs server fesible for the discord bot for websocket connection all the time
?
O
ohio
•
6/27/23, 5:45 PM
@rajgm you could probably just use a webhook if all you want is to send data from a nextjs server to a discord channel
S
Siris.ly
•
6/27/23, 5:45 PM
yeah
, also you can use a webhook bot
, which only recieves interaction events on nextjs
R
RajGM
OP
•
6/27/23, 5:46 PM
is it possible to tag someone in discord server with webhooks
?
R
RajGM
OP
•
6/27/23, 5:47 PM
I think with webhook I can
't check if a member exists in discord server
.
R
RajGM
is it possible to tag someone in discord server with webhooks?
O
ohio
•
6/27/23, 5:47 PM
yes
O
ohio
•
6/27/23, 5:47 PM
<
@id
>
O
ohio
•
6/27/23, 5:48 PM
thats how you tag someone with a bot
O
ohio
•
6/27/23, 5:48 PM
at least thats how i do it
R
RajGM
OP
•
6/27/23, 5:48 PM
yes
R
RajGM
I think with webhook I can't check if a member exists in discord server.
R
RajGM
OP
•
6/27/23, 5:48 PM
concerned with this
R
RajGM
I think with webhook I can't check if a member exists in discord server.
O
ohio
•
6/27/23, 5:49 PM
ye
R
RajGM
OP
•
6/27/23, 5:51 PM
Thanks a lot
, enf and siris
.
R
RajGM
OP
•
6/27/23, 6:01 PM
got it
.
use webhook to send message to server
but use rest with discord bot to check member
R
RajGM
OP
•
6/27/23, 6:03 PM
got it
.
only trouble in using bot in NEXTJS backend will be that the bot will be connecting and disconnecting to the server with each request
.
R
RajGM
OP
•
6/27/23, 6:04 PM
am i correct
?
R
RajGM
OP
•
6/27/23, 6:06 PM
but with rest we had to wait for client
.on
(
'ready
'
,
.
.
.
) to perform any actions
?
R
RajGM
OP
•
6/27/23, 6:09 PM
yes
, i was confusing discordJS with the native rest endpoints
R
RajGM
OP
•
6/27/23, 6:11 PM
I can use the sub
-package
@discordjs
/rest to send and get guild members without worrying about connection issues
Original message was deleted
R
RajGM
OP
•
6/27/23, 6:12 PM
Similar Threads
Using a Discord bot from Nextjs Backend
d-I❄
discord.js - Imagine ❄ / djs-questions
2y ago
server location for VPS discord bot
d-I❄
discord.js - Imagine ❄ / djs-questions
3y ago
Bot backend suggestions
d-I❄
discord.js - Imagine ❄ / djs-questions
11mo ago
Discord bot
d-I❄
discord.js - Imagine ❄ / djs-questions
13mo ago