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 toolkit5mo 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
Kevinnnn5mo ago
thats because there is no disconnect event
Cesar
Cesar5mo 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
monbrey5mo ago
Serverless architecture is not designed for this though
ThePedroo
ThePedroo5mo ago
And that's not 5m
Kevinnnn
Kevinnnn5mo 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
Cesar5mo ago
i was testing the timer, forgot to modify it back to 60
monbrey
monbrey5mo ago
big yikes here
Cesar
Cesar5mo 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
Kevinnnn5mo ago
If you need to keep the host from shutting off your application, then its not a good host for a discord bot
Cesar
Cesar5mo ago
im also hosting a mongodb together it
Kevinnnn
Kevinnnn5mo ago
Invest in proper hosting, either by paying for the service or using a reputable services free tier, like oracle and amazon
Cesar
Cesar5mo ago
im already using deno for other things
Kevinnnn
Kevinnnn5mo 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
Cesar5mo ago
that message thing discord send "only you can see" something like this isnt possible to create messages like that?
Kevinnnn
Kevinnnn5mo ago
Those are interactions, and yes it is possible to respond to interactions that only the person that sent the command can see
Cesar
Cesar5mo ago
by sending a dm?
Cesar
Cesar5mo ago
No description
Cesar
Cesar5mo ago
i mean this
Kevinnnn
Kevinnnn5mo ago
you can have DM slash commands, yes. Those are ephemeral responses, meaning only the person that sent the command can see it.
Cesar
Cesar5mo ago
yes do you have any link to this api?
d.js docs
d.js docs5mo ago
Suggestion for @Cesar:guide Slash Commands: Command response methods - Ephemeral responses read more
Cesar
Cesar5mo ago
ty
Cesar
Cesar5mo ago
No description
Cesar
Cesar5mo ago
is possible to hide this?
Kevinnnn
Kevinnnn5mo ago
For interaction commands, no
Cesar
Cesar5mo 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
Kevinnnn5mo 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
Cesar5mo ago
this would still be visible dont it?
Kevinnnn
Kevinnnn5mo ago
No, it will be tagged to the original interaction reply
Cesar
Cesar5mo ago
ive no idea whats this, ill search
Kevinnnn
Kevinnnn5mo ago
youll see this if you use followUp() after using reply()
No description
Cesar
Cesar5mo ago
is it also possible to create commands where user can input data?
Kevinnnn
Kevinnnn5mo ago
Yes, its called command options
d.js docs
d.js docs5mo ago
Suggestion for @Cesar:guide Slash Commands: Advanced command creation - Adding options read more
Cesar
Cesar5mo ago
do you have any pic about how it looks
Kevinnnn
Kevinnnn5mo ago
about what?
Cesar
Cesar5mo ago
input command
Kevinnnn
Kevinnnn5mo ago
thats how options look
No description
Cesar
Cesar5mo ago
cool the server went offline even the bot pinging the user
Kevinnnn
Kevinnnn5mo 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
Cesar5mo 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
More Posts
Slash Command registered but application cannot locate it when calledTrying to update an older bot to use slash commands and I have run into an issue when responding to Error [Object object]In my bot discord i have a defaultrole system, he add the role when a guy join but i add a reason anDiscordAPIError[50013]: Missing PermissionsI have a timeout command my bot has all the permissions it needs so I dont know why im getting this Slash command working but still replying with "The application did not respond"the command works but before its sent it responds with "The application did not respond". ```js coHi i am currently trying to fetch json data from an api using slash commands but it keeps erroring```js const { EmbedBuilder, PermissionsBitField } = require("discord.js"); const { SlashCommandBuildRecommendations for good boilerplate/template projectsHi! New to Discord.js, _very_ familiar with JavaScript/TypeScript. I was hoping to write a Discord bCollection problemIs there any easy way to modify an array that is placed as a value in an Collection object?hey iam builduin a ticket system for my bot with slash command and deploy command buti hav an errorit works fine and it shows the slash command in discord but when i execute it it says this error Erwhy i am getting this and how to fix ?```0|sharded-client | (3:08:07 PM) - [WARN] - ----- Unhandled Rejection ----- 0|sharded-client | (Set Path to custom ffmpeg binaryHello, we're currently encountering issues with the static-ffmpeg module in our Docker container, oc