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 toolkit10mo 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
Kevinnnn10mo ago
thats because there is no disconnect event
Cesar
CesarOP10mo 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
monbrey10mo ago
Serverless architecture is not designed for this though
ThePedroo
ThePedroo10mo ago
And that's not 5m
Kevinnnn
Kevinnnn10mo 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
CesarOP10mo ago
i was testing the timer, forgot to modify it back to 60
monbrey
monbrey10mo ago
big yikes here
Cesar
CesarOP10mo 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
Kevinnnn10mo ago
If you need to keep the host from shutting off your application, then its not a good host for a discord bot
Cesar
CesarOP10mo ago
im also hosting a mongodb together it
Kevinnnn
Kevinnnn10mo ago
Invest in proper hosting, either by paying for the service or using a reputable services free tier, like oracle and amazon
Cesar
CesarOP10mo ago
im already using deno for other things
Kevinnnn
Kevinnnn10mo 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
CesarOP10mo ago
that message thing discord send "only you can see" something like this isnt possible to create messages like that?
Kevinnnn
Kevinnnn10mo ago
Those are interactions, and yes it is possible to respond to interactions that only the person that sent the command can see
Cesar
CesarOP10mo ago
by sending a dm?
Cesar
CesarOP10mo ago
No description
Cesar
CesarOP10mo ago
i mean this
Kevinnnn
Kevinnnn10mo ago
you can have DM slash commands, yes. Those are ephemeral responses, meaning only the person that sent the command can see it.
Cesar
CesarOP10mo ago
yes do you have any link to this api?
d.js docs
d.js docs10mo ago
Suggestion for @Cesar:guide Slash Commands: Command response methods - Ephemeral responses read more
Cesar
CesarOP10mo ago
ty
Cesar
CesarOP10mo ago
No description
Cesar
CesarOP10mo ago
is possible to hide this?
Kevinnnn
Kevinnnn10mo ago
For interaction commands, no
Cesar
CesarOP10mo 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
Kevinnnn10mo 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
CesarOP10mo ago
this would still be visible dont it?
Kevinnnn
Kevinnnn10mo ago
No, it will be tagged to the original interaction reply
Cesar
CesarOP10mo ago
ive no idea whats this, ill search
Kevinnnn
Kevinnnn10mo ago
youll see this if you use followUp() after using reply()
No description
Cesar
CesarOP10mo ago
is it also possible to create commands where user can input data?
Kevinnnn
Kevinnnn10mo ago
Yes, its called command options
d.js docs
d.js docs10mo ago
Suggestion for @Cesar:guide Slash Commands: Advanced command creation - Adding options read more
Cesar
CesarOP10mo ago
do you have any pic about how it looks
Kevinnnn
Kevinnnn10mo ago
about what?
Cesar
CesarOP10mo ago
input command
Kevinnnn
Kevinnnn10mo ago
thats how options look
No description
Cesar
CesarOP10mo ago
cool the server went offline even the bot pinging the user
Kevinnnn
Kevinnnn10mo 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
CesarOP10mo 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