Hosting on Deno Deploy

I'm hosting my bot on Deno Deploy https://deno.com/deploy it's working great but after some time it goes offline. I tried:
client.on('disconnect', () =>
{
console.log('Bot is disconnected, attempting to reconnect...');
client.login('...').catch(console.error);
});


client.login('...');
client.on('disconnect', () =>
{
console.log('Bot is disconnected, attempting to reconnect...');
client.login('...').catch(console.error);
});


client.login('...');
but the 'disconnect' event is not getting fired. What else could i try to make it keep online?
42 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
Kevinnnn
Kevinnnn11mo ago
thats because there is no disconnect event
Cesar
CesarOP11mo ago
meguFace goes idle after some time if it dont receive any request, and it makes the bot goes off as long i ping the server the discord bot get on again
function startInterval()
{
setInterval(async () =>
{
discord.users.fetch('390180464393977857').then(user =>
{
user.send('ping')
.then(() => console.log(`Sent a message to ${ user.tag }`))
.catch(console.error);
}).catch(console.error);
}, 5 * 60 * 1000); // every 5 minutes
}
startInterval();
function startInterval()
{
setInterval(async () =>
{
discord.users.fetch('390180464393977857').then(user =>
{
user.send('ping')
.then(() => console.log(`Sent a message to ${ user.tag }`))
.catch(console.error);
}).catch(console.error);
}, 5 * 60 * 1000); // every 5 minutes
}
startInterval();
ill try this to see if it keep the bot on
monbrey
monbrey11mo ago
Serverless architecture is not designed for this though
ThePedroo
ThePedroo11mo ago
And that's not 5m
Kevinnnn
Kevinnnn11mo ago
also pretty sure this would set off some sort of alarm that a bot is sending a message to the same user every so often
Cesar
CesarOP11mo ago
i was testing the timer, forgot to modify it back to 60
monbrey
monbrey11mo ago
big yikes here
Cesar
CesarOP11mo ago
5 min is not so often and i need to check how long it takes to make the server goes idle i think its 10min+
Kevinnnn
Kevinnnn11mo ago
If you need to keep the host from shutting off your application, then its not a good host for a discord bot
Cesar
CesarOP11mo ago
im also hosting a mongodb together it
Kevinnnn
Kevinnnn11mo ago
Invest in proper hosting, either by paying for the service or using a reputable services free tier, like oracle and amazon
Cesar
CesarOP11mo ago
im already using deno for other things
Kevinnnn
Kevinnnn11mo ago
If you want to keep using deno, thats your choice Deno deploy is really only meant for HTTP only interaction bots, not for full standing bots
Cesar
CesarOP11mo ago
that message thing discord send "only you can see" something like this isnt possible to create messages like that?
Kevinnnn
Kevinnnn11mo ago
Those are interactions, and yes it is possible to respond to interactions that only the person that sent the command can see
Cesar
CesarOP11mo ago
by sending a dm?
Cesar
CesarOP11mo ago
No description
Cesar
CesarOP11mo ago
i mean this
Kevinnnn
Kevinnnn11mo ago
you can have DM slash commands, yes. Those are ephemeral responses, meaning only the person that sent the command can see it.
Cesar
CesarOP11mo ago
yes do you have any link to this api?
d.js docs
d.js docs11mo ago
Suggestion for @Cesar:guide Slash Commands: Command response methods - Ephemeral responses read more
Cesar
CesarOP11mo ago
ty
Cesar
CesarOP11mo ago
No description
Cesar
CesarOP11mo ago
is possible to hide this?
Kevinnnn
Kevinnnn11mo ago
For interaction commands, no
Cesar
CesarOP11mo ago
i mean, make a command stealth im lf something that user can interact with the bot privately theres any other option than dming the bot?
Kevinnnn
Kevinnnn11mo ago
Ephemeral replies will hide the original message from everyone. If you want it to respond publicly without the command, you can use <interaction>.followUp()
Cesar
CesarOP11mo ago
this would still be visible dont it?
Kevinnnn
Kevinnnn11mo ago
No, it will be tagged to the original interaction reply
Cesar
CesarOP11mo ago
ive no idea whats this, ill search
Kevinnnn
Kevinnnn11mo ago
youll see this if you use followUp() after using reply()
No description
Cesar
CesarOP11mo ago
is it also possible to create commands where user can input data?
Kevinnnn
Kevinnnn11mo ago
Yes, its called command options
d.js docs
d.js docs11mo ago
Suggestion for @Cesar:guide Slash Commands: Advanced command creation - Adding options read more
Cesar
CesarOP11mo ago
do you have any pic about how it looks
Kevinnnn
Kevinnnn11mo ago
about what?
Cesar
CesarOP11mo ago
input command
Kevinnnn
Kevinnnn11mo ago
thats how options look
No description
Cesar
CesarOP11mo ago
cool the server went offline even the bot pinging the user
Kevinnnn
Kevinnnn11mo ago
As I said earlier, deno deploy is not meant for discord bots that use full fledged packages like discord.js It is meant for HTTP Interaction bots, meaning discord sends you requests via an API you created and you respond back to the API request from discord.js
Cesar
CesarOP11mo ago
i see i figured out how to use the ephemeral thing really cool thanks for the help Kevin
Want results from more Discord servers?
Add your server