Not managing to transfer my code onto a different bot - discord.js

So I have my bot which I now transferred onto a Heroku server, with this I made a new bot which I named ex Test Bot, but for some reason when I went into my config.json with the code
{
"token": "DISCORD BOT ID THING"
}
Now when I change the following to my test bots ID which I will run from my PC, it gives me this wierd error
I really have no clue searched online couldnt fined anthing, I hope one of you guys could help. Thanks!

You're probably using an intent that you don't have permission to use or isn't enabled.
You'll have to go to Discord Developer Portal, choose your application, go to the Bot section, and enable all the intents. (Or the ones you are using.)
Note that once your bot reaches 100 or more servers, this will require verification and whitelisting.
Bot Verification and Data Whitelisting

Related

Enable intents for discord.py bot

Im making a discord bot, and every time it joins a new server, the bot sends me the server info and an invite. However, when I've tested this, it always shows one member which is itself. I have both presence and members intents enabled in the discord developer portal, but it still isn't working.
I then changed some code to Guild.fetch_members() to which I received the error:
discord.ext.commands.errors.CommandInvokeError:
Command raised an exception:
ClientException:
Intents.members must be enabled to use this.
As I said before, on the discord developers website member intents are enabled and I have had this code before without this issue.
When I had this code working before, it was using 1.5.x (I cant remember exactly) and now its using 1.6.0, so something in the new update may prevent this from working, but this is unusual to me, so how can I resolve this issue?
intents were introduced in 1.5.0 so I don't think they were working before, but answering your question
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(..., intents=intents)
Also remember to enable privileged member intents in the developer portal
How to enable privigeled intents

Does discord limit what information can you get using a bot?

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?

Discord.js - Bot messages LIMIT?

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.

Discord js send everyone pm

I want send everyone in server a message or a embed.
I searching google nothing shows up .
I Saw some bots doing anonuncements. PM everyone.
How i can do that . I want a working example i was using discord js .
The most effective way to do this would be to make an announcement channel and get the bot to "#everyone".
If you want to DM everyone in the server, loop through a servers members list and DM each user individually; remember that Discord limits 5 messages per every 5 seconds, so put a delay in your loop.
Discord Api got limits There are limitations with bot DMs, which you can read at https://discordapp.com/developers/docs/topics/rate-limits
Better to mention everyone or role.
This is not recommended, as the Discord API has limits. On the other hand, sending multiple direct messages to users will cause your bot to get blacklisted from "Possible Spam".
Still, you can achieve this as follows:
// Assuming 'guild' is the Server Guild
guild.members.cache.each(member => {
// Send message
member.user.send('An amazing message!').catch(e => {
// An error has occurred
console.log(e);
});
});
It is possible to go loop through and DM all of the users. However, with the Discord API having limitations this can be more tricky with a large server and you are going to want to implement a sleep function.
Use the code:
guild.members.cache.forEach(m => {
m.user.send('Hello this is a dm!')
})
As Morgan said it is probably easier to simply create a channel and just #everyone
Discord prohibits you from mass dming users.
and you will get rate limited

Discord bot to check if a minecraft server is online

I was wondering if anyone knew of a discord bot that will send a message in a discord sever when a minecraft server is online and send a message when it goes back offline
I've done some googling and can't seem to find one that does what I want there are a couple that u have to manually type commands for and others that appear in the sidebar of discord I simply want one that will do it automatically is there one that exists like this already?
I didn't found any not that already did this, but you can do this pretty easily with the Discord API.
Here is a a script I found that send a message to the server : https://gist.github.com/ianklatzco/769d9e3a991dc2f443a2e105b0157117
You can adapt it to ping the server in a if statement to send if it is online or not
(This script is in python but the Discord api works in more languages)

Resources