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.
Related
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.
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 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 have developed my own simple discord bot (with discord.js) and deployed it to a node server.
Everything is running fine.
Now I want to add some more features to it. During development I'd like to test it locally (of course).
Question is: Can I run my bot locally and test it without disrupting my currently running bot?
If not:
Do I need another bot/token instance?
How can I test my bot without disrupting my currently running bot?
The problem is, when you use the same token for your local bot and for your bot, that is hosted on your node server, it has a total of 2 instances.
Bot on Node server = 1 instance of the bot
Bot on local server = 1 instance of the bot
Which makes a total of 2 instances of the same bot, what you don't want, because then, whenever you execute a command, where the bot is on, it executes the command twice.
Therefore, if I were you, I would create another bot application here and use this new bot to test the bot's new features locally.
99% of all bot developers do it like this, because they don't interrupt the main bot with this method.
I noticed this:
(Note that I deployed this service just 2 days ago and no one know it!!)
The only valid request here is the one to "/extract" at 4:10, because it is correct and it is at the scheduled time (of the cron job).
(You can also notice that the user agent is "AppEngine")
I created some routing for the "hacking try" paths to reply with a "F*** Y**".
Then I decided to use a dos.yaml file to define a blacklist.
I was taking note of the IPs and I noticed that the IP of the valid request is also used in this request (and probably other "malicious" ones):
I noticed that every execution of the my scheduled "cron job" (automated one or using "Run now") has a different IP. Also all the malicious requests have different IPs but you can see that some of them are executed programmatically:
How is it possible?
My explanation is that Google Cloud Platform is hosting a lot of malicious services.
Also, the documentation says that cron jobs are issued by the IP 0.1.0.1.
Someone can explain me this unexpected behavior or where is the fault in my argument?
Alex