After like 10 minutes or so, bot goes offline but the UptimeRobot is always running, i think replit is shutting down behind the scene. although, i have tried to implement this piece of code
client.on('disconnect', function(erMsg, code) {
console.log('----- Bot disconnected from Discord with code', code, 'for reason:', erMsg, '-----');
client.connect();
});
but even then it shut down!!
I am trying to have my bot up and running all the time, i need some information or some code to fix have replit restart again automatically. Or maybe, i can use some other free service to get my bot running.
This is because they are blocking requests coming from UptimeRobot. Which means they don't want you to uptime your repl. So you shouldn't be using these.
Related
This might be a duplicated question! sorry I couldn't find an answer!
I have a bot running on a linux server "using discord python lib". I want trigger a command from the server side as a cronjob. Is that possible with the way Discord events are designed? The command needs to run every 5 mins!
I have a db with user/payment data. The command should check if the userid has sent payment. If so then assign them a specific role. Otherwise if the user's payment data is false remove the role.
Right now this works fine with a command I wrote "update_payment" however this command has to be triggered from the discord server manually. I don't want to run this by hand every 5 mins. How do I trigger it from a cronjob on the linux server?
You can use tasks.loop to loop your task:
from discord.ext import tasks
#tasks.loop(minutes=5)
async def update_payment():
pass # whatever here
update_payment.start()
I've created a discord bot that runs locally on user's machines and I'm not exactly sure how it would work if for example 30 people are running their local instances at the same time. Will other users's instances emit events to eachother or is each running instance only going to care about its own script.
I wrote a quick discord bot as a joke, that just sends a gag message to my friend every 3 or 4 days. However, I could not find my friend's account using client.users.cache.get() or client.users.fetch(). I made sure the ID I put in was correct, to no avail. I then tested it with my own account, which worked perfectly fine. The only difference was that I was in a server with this tester bot, and everyone else in that bot-dev server could receive messages from this bot. I also realized it is impossible to get other information, (friends, etc.). Is this intentional, or is this simply a bug?
I've made a bot with discord.js and I want to run some code when a user joins my guild. The obvious answer here is the client event guildMemberAdd, which worked until about a month ago. For some odd reason it stopped working and I've been trying to fix it, but I have no idea what the problem is.
Here is a super simplified version of my script since it's over 3000 lines long:
client.on('guildMemberAdd', member => {
console.log(`${member.user.tag} joined`);
});
I've even tried a try and catch block but everything seems fine. What am I doing wrong here?
They changed it so you have to go on the developer portal, click on your bot en turn Privileged Gateway Intents on then it should work again (it is in the bot tab)
I have a bot with which you have to verify yourself to be on our Discord server
(The verification takes place in the DM`s)
Recently we have the problem that certain members of our Discord cannot write to the bot.
Everyone allowed everyone to send a message to the person
Each of the people is on our Discord Server, allows the person to write messages and have not blocked the bot
The bot does not issue any error messages
We would be delighted to find a quick solution
Since you haven't provided any code snippets, logs or error messages, it's a bit difficult to assess your situation... but here are some basic troubleshooting steps that you could follow:
Remove and re-authenticate the bot into the server.
Double check that you have enabled DM's.
Check the console for any errors that could pertain to direct messaging issues with users in the server. (especially from successful DM's)
Try to notice any differences between the users in the server who are
able to message the bot, versus those who cannot.
Ensure the bot isn't running more than one instance. (i.e. you might
have more than one bot running on the same token!)
I highly recommend giving more detail, because usually a question pertaining to broken/lost functionality would usually attach code or error logs to help diagnose the issue.
Okay, the problem is that you either didn't enable DMs or the bot is not in the server.
Otherwise, this problem will not occur.