#development
1 messages · Page 1681 of 1
Being called mentally incapable isn't a joke, asshole.
no
no, that's called being a piece of shit, own up to what you did.
you got called out for it
you mean a dark joke??
it didn't have the slightest hint of being a joke even
you legit tried to insist Hindsight is mentally handicapped
mentally handicapped 😂
ugh, you're not worth my time today
mental issues doesnt mean handicapped and that comes from someone who legit has mental isseus so lets stop this argument please
because now your just insulting me
having mental issues doesn't mean you're suddenly allowed to insinuate that as a joke on others
i have them too buddy, don't play the "i have them so it's okay for me to joke about them"
well if im autistic and i make a autstic joke does that suddenly make me a piece of shit??
you see, you never even made it as a joke
you made it appear that Hindsight has mental issues
stop playing the joke card because it obviously wasn't a joke
it did not appear that way to them
so clearly it wasn't viewed as a joke
why are you having such a difficult time with admitting the fact that you made someone upset and that you won't apologize holy shit
well i see it as a joke so if you cant handle dark humor then thats your problem
you're being so unnecessarily difficult
i can relate to it too, but i didn't laugh at it because of the way you worded it
maybe if you had actually structured the message to be read in such a certain way that it could have been perceived as a joke, none of this would be happening right now
how can you relate to it??
but you chose to double down and play the joke card, and then go bold and say that you can relate to it so it's suddenly ok
I have ASD
diagnosed??
since 4
Damn
so i don't appreciate this attempt of you trying to make it look okay because you wanted to make it look relatable
especially when i actually have been diagnosed specifically with that
just fucking own up dude, this isn't hard.
any vsc user and node.js user here ?
i want to know how to run an bot app on vsc
cmd
?
@dusky lagoon
ohw heyy
yeah node
did you watch any youtube tutorials they perfectly explain how to start and create a bot
i saw
In which directory are you running the command
then i should suggest trying the same thing
Didnt know it was a question
who me??
no
Ohw ruthless
Check your index.js file and package.json main entry
ok
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.login(process.env.token);```
basic structre
:?
;/
Ok
(node:11000) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (C:\Users\Dell\Downloads\Test\node_modules\discord.js\src\client\Client.js:206:52)
at Object.<anonymous> (C:\Users\Dell\Downloads\Test\index.js:8:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11000) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11000) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
error
:/
im beginner
pls tell
or you didnt add a token
no news about slash cmds in discordjs?
It's also possible you need to add dotenv to your project
i type this there
either you change it to token in the .env file or you use process.env.TOKEN
either will work
ok
ill try
at Client.login (C:\Users\Dell\Downloads\Test\node_modules\discord.js\src\client\Client.js:206:52)
at Object.<anonymous> (C:\Users\Dell\Downloads\Test\index.js:8:8)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
sending this
:/
whts the prob
pls tell
your token is invalid
you didn't configure dotenv
here's a guide : https://anidiots.guide/other-guides/env-files
not working
Whenever I link to something and someone answers "not working" I always assume what they mean is that their brain isn't working when trying to read the page I sent.
require('dotenv').config();
const client = new Discord.Client();
const prefix = process.env.PREFIX;
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', message => {
if (message.author.bot) return;
if (message.content.indexOf(prefix.length) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command === 'ping') {
message.reply('Pong!');
}
});
client.login(process.env.token)```
index.js
and does your .env say token= or TOKEN= ?
What you shouldn't do is just blindly copy/paste shit, tbh.
And you also probably didn't even save your files again?
to try if it run
ok ill save
throw err;
^
Error: Cannot find module 'dotenv'
Require stack:
- C:\Users\Dell\Downloads\Test\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\Dell\Downloads\Test\index.js:2:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\Dell\\Downloads\\Test\\index.js' ]```
new error
npm i dotenv
did it
bruh
See if you do'nt have the patience to actually read through ONE page correctly, you don't have the patience to make bots.
Learn to have patience, or stop now.
True at
TypeError: Cannot read property 'id' of undefined 3|index | at ClientDataManager.newChannel (/root/AwsomeModeration/node_modules/discord.js/src/client/ClientDataManager.js:81:36) 3|index | at Guild.setup (/root/AwsomeModeration/node_modules/discord.js/src/structures/Guild.js:206:68) 3|index | at GuildCreateHandler.handle (/root/AwsomeModeration/node_modules/discord.js/src/client/websocket/packets/handlers/GuildCreate.js:12:15) 3|index | at WebSocketPacketManager.handle (/root/AwsomeModeration/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65) 3|index | at WebSocketConnection.onPacket (/root/AwsomeModeration/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35) 3|index | at WebSocketConnection.onMessage (/root/AwsomeModeration/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17) 3|index | at WebSocket.onMessage (/root/AwsomeModeration/node_modules/ws/lib/event-target.js:120:16) 3|index | at WebSocket.emit (events.js:314:20) 3|index | at Receiver.receiverOnMessage (/root/AwsomeModeration/node_modules/ws/lib/websocket.js:789:20) where is this coming from? It randomly displayed this after a quick restart.
my !help command
has nothing with any tipe of commands in it
so that can't be it
Could you send an example of your code?
const n = require("../n.json");
const Discord = require("discord.js");
const human = require('humanize');
const client = new Discord.Client();
exports.run = (client, message, args) => {
{
const embed5 = new Discord.RichEmbed()
.setThumbnail("https://media.giphy.com/media/1hHE0KGmseJy0/giphy.gif")
.addField('**Moderation commands**', '``!giverole``, ``!kick``, `` !morehelp``, ``!help``, ``!lockdown``, ``!purge``, ``!tempmute``, ``!unban``, ``!warn``, ``!warnlvl``', true )
.addField('**Music commands**','``!play``, ``!queue``, ``!skip``, ``!stop``, ``!resume``, ``!pause``, ``!shuffle``, ``!clear-queue``, ``!volume``, ``!filter``, ``!w-filters``', true )
.addField('**Misc commands**', '``!bugreport``,``!botinfo``, ``!botlink``, ``!ping`` ,``!serverinfo``, ``!userinfo``, ``!donate``, ``!support``, ``!website``,``!meme``', true )
.addField('**Ranking commands**', '``!rank``, ``!leaderboard``', true )
.addField('**Game commands**', '``!8ball <question>``, ``!coinflip <heads/tails>``, ``!truth``, ``!dare``', true )
.setDescription("**MAKE SURE THAT YOU HAVE A CHANNEL CALLED**" + " *``mod logs``* "+ "**IN YOUR SERVER!**" + "\n" + "**For more detailed help, use command !morehelp <command>**")
.setColor("RANDOM")
.setTimestamp()
.setFooter('AwsomeCord || Moderation')
message.channel.send(embed5)
}
}```
discord js version?_
v11
update to v12
at GuildCreateHandler.handle (/root/AwsomeModeration/node_modules/discord.js/src/client/websocket/packets/handlers/GuildCreate.js:12:15)
This is clearly an issue in your guildCreate event
ye
i have no guildcreate event
still
Ah right so.. yeah you need to actually update to v12
update to v12
v11 is 100% broke.
yup
yeah
gg
just do npm i discord.js@latest
yes.
Dont use v11 d.js
v12 came out a full YEAR ago, you had plenty of time to update.
so i can't find the little snippet that is making the whole bot not work and just delete it>
There is no snippet to fix a 1-year old version that broke because of an API change, no
Update to v12, it's time.
I rather would want to do that and upgrade it in the weekend as rn i have no time. Last 2 exams coming in.
You should have done it in the dozens of weekends you've had since the release of v12. now it's too late.
this is what happens when you're a procrastinator. ¯_(ツ)_/¯
why are you creating a new client inside a command 🤔
okay so there really is no way to remove that id in the guild create?
Where is that guild create even coming from
There is no way for you to fix a broken, outdated library, no.
This is all internal
The error is in the library code
owh fuck
okay
well that means that i will have to leave the bot for now as i need to finish my exams first
Yes.
thanks!
you can go inside node_modules/discord.js/src/client
and edit the file that causing the crash
ClientDataManager.js line 81
outdated lib go brr
would async/ await be better than promises?
async/await is promise
finally something i can work with! Thank you! Tim never disappoints me,.
oh lol sorry
anyone a gRPC user here?
const Discord = require('discord.js')
module.exports = {
name: 'mail',
run(message, args) {
const sayMessage = args.join(" ")
const channel = message.client.channels.cache.get('826871017203957760')
let embed = new Discord.MessageEmbed()
.setTitle("Modmail")
.setDescription("Modmail was sent by" `${message.author.username}`)
.setColor("#00ff00")
.addField("Mail Message", `${sayMessage}`, true)
.setTimestamp()
.setFooter("modmai sent ")
channel.send(embed)
}
}
The command works but the $ message.author.usernamedoes not work it was suppose to show the person the user's name that used that command
I wanna make my help command vertical I am using embed.add_field how would I make it vertical?
(node:19416) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [ChildProcess]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)```|
Yo whats this?
does anyone know
I'm surprised that doesn't throw an error
add a + after by"
That means either you have too many client.on("message" lines, or you have one inside another event.
Ow yea thx sorry I forgot that
I am actually removing specific listeners and adding again with new functions
Well either you're still adding too many, or they're not being removed correctly.
show how you're removing em
anyone coding in py here?
client.removeListener(event,client.events.get(event).run);
wait... should I remove first or add first?
I am adding new ones first
you should remove first yes
ok
Alternatively try to do client.removeAllListeners(event) instead
nah... that would be bizzare
would it?
yes
why?
I have like 3 listeners for an event and I want to remove 1 specific
and removing all would break things
I added first and removed later to avoid event getting removed and having an error while adding new one
so no event occurs...

are you legit adding more than 10 listeners for one single event?
Then fix the problem itself
raising the limit will only push the problem back further
and use a lot more RAM uselessly
it doesn't increase ram usage 
it does, the functions are still loaded in memory
thus they're still executed when the event happens.
that's problematic.
I am doing this for old functions
delete require.cache[require.resolve(file)];```
ok but it doesn't detach the function from the event emitter
I am removing the old ones
but after new ones are added
so for a few seconds ram can go up
ok but I'm saying
the old ones are not removed correctly
if they were, you would not get the warning
hmm...
move the removeListener to the top, before even clearing the cache
like, literally as the first line would be better.
I try to output User per ID in an embed Post by Bot.
The Syntax is like this:
discord_user = "<@" + str(i[4]) + ">\n" str(i[4]) is the id like 175055606818817
list_discord.append(discord_user)
list_discord_temp += list_discord.pop()
embed.add_field(name="*Lichess*", value=list_lichess_temp, inline=True)
The embed Message is in a channel only for Moderators.
Some User are correctly mentioned (clickable for the user info card)
Others aren`t and show sth. like this: <!@35467895678*>
By posting this into the same channel as normal text it changes to the expected mention.
Screens follow. What am I missing?
console.log(this._events[event]) before and after removing the listener
ok
directMessage
[Function: bound run] AsyncFunction
(node:32068) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [ChildProcess]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
undefined
guildCreate
[Function: bound run] AsyncFunction
undefined
guildDelete
[Function: bound run] AsyncFunction
undefined
guildMemberAdd
[Function: bound run] AsyncFunction
undefined
guildMemberRemove
[Function: bound run] AsyncFunction
undefined
inviteCreate
[Function: bound run] AsyncFunction
undefined
inviteDelete
[Function: bound run] AsyncFunction
undefined
message
[Function: bound run] AsyncFunction
undefined
messageUpdate
[Function: bound run] AsyncFunction
undefined
ready
[
[Function (anonymous)],
[Function: bound start],
[Function: bound run] AsyncFunction
]
[ [Function (anonymous)], [Function: bound start] ]```
@quartz kindle
undefined cause event had only 1 listener which was removed
Does anyone know why this is not working:
@client.event
async def on_guild_join(guild):
general = find(lambda x: x.name == 'general', guild.text_channels)
if general and general.permissions_for(guild.me).send_messages:
await general.send('Hello! Thanks for inviteing cheerbot to your server'.format(guild.name))
It is meant to be a message that sends when my bot joins the server
11 message listeners added to [ChildProcess]
the problem is not the event
and?
that warning is likely coming from the sharding manager
show your manager code
const Logger = require('./utils/Logger.js');
const { ShardingManager } = require('discord.js');
const Manager = new ShardingManager('./Circuit.js', {
token: require('./config.js').token,
totalShards: 1,
shardList: [0],
shardArgs: ['--shard'],
respawn: true,
});
Manager.on('shardCreate', (shard) => {
Logger.info(`Shard[${shard.id}] has been created!`, `Shard`);
shard.on('ready', () => {
Logger.info(`Shard[${shard.id}] is now ready!`, `Shard`);
});
shard.on('death', (child) => {
Logger.error(`Shard[${shard.id}][${child.pid}] Death`, `Shard`);
});
shard.on('disconnect', () => {
Logger.error(`Shard[${shard.id}] Disconnection`, `Shard`);
});
shard.on('error', (err) => {
Logger.error(`Shard[${shard.id}] Error : ${err.name}`, `Shard`);
});
shard.on('reconnecting', () => {
Logger.info(`Shard[${shard.id}] reconnecting...`, `Shard`);
});
shard.on('spawn', (child) => {
Logger.info(`Shard[${shard.id}][${child.pid}] has been spawned!`, `Shard`);
});
});
Manager.spawn();```
try logging shard._events.message
does the warning appear before or after the above shard events?
it appears when I execute this code
undefined
dafuq
do you use child_process anywhere in your code?
if not, then the only explanation would be broadcastEval itself fucking up
This is for help with bot coding, not asking about other bots usefullness
Please use general or another channel
They're probably asking how the bot's doing it
It can't without redirecting the user to a website
if they use your IP then thats how they do it
you cant get someone's IP through discord, but you can through websites
All the bot needs is a single request to a website
actually... hm... discord makes a request to any link to get it's metadata right
do they make it client-side? If that's the case then the user may not even need to click on the link
no
its probably a djs bug
i dont think so
discord displays websites in a special embed
they probably generate the embed data server side
no
possible yes
if they use other tracking methods
like device fingerprinting
so no
interesting
can you even get that info via a request
do you wanna checkout the link?
what the verification link does is, it first redirects you to a site, that just shows some ads and has "success" as title, then redirects back to discords "add bot to server" auth
after like 5secs
so ig there's some checks going on under the hood
you can check what scripts they run on client side
they could be using canvas fingerprinting for example
can anyone help me in java
So canvas fingerprinting is basically unstoppable cookies
what do you need
Could I get help with a command I'm making? I'm trying to make a command that like adds an emoji using an image url and giving it a name, but, every time that I add something it says the error, and that it added the emoji, whether or not it actually added it
(Discord JS)
if (message.content.startsWith(`${guildPrefix}addemoji`)) {
let canManageEmojis = message.channel.permissionsFor(message.member).has("MANAGE_EMOJIS", false);
var args = message.content.split(' ').slice(1);
if (canManageEmojis) {
message.guild.emojis.create(`${args[0]}`,`${args[1]}`)
message.channel.send(`Succesfully added your emoji, ":${args[1]}:"!`)
.catch(message.channel.send(`Oops! I couldn't add \`:${args[1]}:\`. Possible errors: The name was over 32 characters in length | The file size of the image was above 256KB. | Your server doesn't have enough space for emojis.`));
} else {
message.channel.send(`oops! You don't have the \`MANAGE_EMOJIS\` permission!!`)
}
}
Well u also have to check if the bot have perms to "MANAGE_EMOJIS"
The bot has admin perms in the server i'm testing in, and it is in the default permissions.
Not a public bot?
it is, but the permissions are not my concern right now
unless that IS the issue
somehow?
I'm not sure honestly
The role itself does have admin + the bots role I have has admin
Well what your doing wrong is that even if it didnt add the emoji it send the message since the member has perms to add emojis
How do I make this code
const role = guild.roles.cache.find(role => role.name === '<role name>'); const member = message.mentions.members.first(); member.roles.add(role);
So that I dont have to type the name of the role ,so I just mention the role
Yeah I want it to send that if it didn't have an error
In the if(canmanageemoji) you are sending a message anyways even if it didnt add it
yeah i'm not sure how to do it otherwise
Wait i will do it for u give me a bit though
the emojis that i was testing with were under 256kb & the names were like 4-6 characters when i was testing
alright
Mmm
Help pls
How do I send embeds for slash commands ?
I'm using this
Client.ws.on('INTERACTION_CREATE', async interaction => {
Client.api.interactions(interaction.id, interaction.token).callback.post({data: {
type: 4,
data: {
embed: exampleEmbed
}
}})
})
And it doesn't work
(If I do data: { content: "string message"} it works
oops
sorry I think you do
embeds: [embed name]
I thought you meant something else, that should? work
const exampleEmbed = {
color: 0x0099ff,
title: 'Some title',
url: 'https://discord.js.org',
author: {
name: 'Some name',
icon_url: 'https://i.imgur.com/wSTFkRM.png',
url: 'https://discord.js.org',
},
description: 'Some description here',
thumbnail: {
url: 'https://i.imgur.com/wSTFkRM.png',
},
fields: [
{
name: 'Regular field title',
value: 'Some value here',
},
{
name: '\u200b',
value: '\u200b',
inline: false,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
{
name: 'Inline field title',
value: 'Some value here',
inline: true,
},
],
image: {
url: 'https://i.imgur.com/wSTFkRM.png',
},
timestamp: new Date(),
footer: {
text: 'Some footer text here',
icon_url: 'https://i.imgur.com/wSTFkRM.png',
},
};
just copy paste for testing
uh im not sure what that is, i do my embeds another way but if you do
embeds: [exampleEmbed] that should work
oh okay
guess I'm not getting help

How do I make this code
const role = guild.roles.cache.find(role => role.name === '<role name>'); const member = message.mentions.members.first(); member.roles.add(role);
So that I dont have to type the name of the role ,so I just mention the role
what is the issue
You're already using message.mentions to get the mentioned user, so why not apply the same knowledge
except this time with roles
nope
(node:20211) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
data.content: This field is required
Oh, you need to have content have like even just a letter or soemthing i think?
I've gotten similar errors before
If you want it to look nice you can have like
content: "<put a zero width space here>"
I want to make it so I dint have to type the role name I just mention the role
oh
^^ @frigid mountain
Like
message.mentions.roles.first()
yes
Only sends whatever is in content: ".."
I give up
oh
im sorry
you added embeds:
right
was the embed created in that interaction?
I think that is important
im not sure
I dont even know how to make a slash command work lmao
ive tried once
thats how i did mine
const Discord = require('discord.js')
module.exports = {
name: 'grole',
run(message, args) {
const role = message.mentions.roles.first()
const member = message.mentions.members.first()
member.roles.add(role)
}
}
Does not work
no one an idea? By the way its Python with the import discord.ext.commands
Be more specific
How?
What doesn't work? how doesn't it work? is there an error?
quick question
so
if ip is being used to detect alt, is it possible for another person using the same ISP have have same IP? ik its a stupid question but just making sure
missing permissions
proably yes
The bot's role must be higher than the role you're trying to give
and the bot must have the Manage roles permission
Most likely not, ips are meant to be unique after all
the ip may change, though
Oh thx
im kind aconfused, because the person who's alt sounds convencing
but they used to same ip
to verify
That's means I have to add a message.reply("my role is not higher than that role")
well proably it have a chance
Their IP could have changed
yeah
help
911, what's your emergency
Nope, ips represent the individual device connected, ie your router. It goes beyond that a bit but basically you can’t have the same IP as someone else unless you’re both behind the same device (ie a VPN)
it really depends on the router setup, no?
Well yeah but at the end of the day the single router that the isp gets is assigned an ip
should i just remove this?
no
in most households the router will assign the same public ip to connected devices, while keeping the internal masks unique
Yes, but your neighbors will never have the same ip as you
edit it
thats what you basically said im just slow because mobile lmfao
not... delete it
what version of djs are you using
aha
this might not be the only problem, there might appear more errors after you fix that one
yeah i will check it out
it worked!
If i could, i would kiss you on the cheek tim!
@balmy root
background-repeat: no-repeat;
and you probably want background-size: cover; to fill the page too
I'm confused... is there any issue with JDA (or the API) currently? It doesn't fire the event at any embed anymore... did they change anything? 🤔
I tried it with discord.js there will it receive still the embeds, odd.
All of my bots just stopped working on embeds today, before they worked a couple of months fine.. 🤔
Does anyone know the link to the doc or how to @ the person who used the command because message.author only says something like BrevmanTV#1000
Would that return the users id?
How are you currently trying to mention them
message.author
I use some weird code but here
yeah
Ty
Parse the role and catch it first
I solved it 2 hours ago
What do I do so that when a person uses a embed command it shows there avatar next to the footer
Libary
??
Idk what's that
🚶♂️ 🦽
Wdym
🤷
🤐
Help pls?
🤨
Guys why does do i get an error saying that isNaN is not definied??
Bruh i just mistyped
make sure you're calling it as a method, not a property
💆♂️
if (message.content.toLowerCase().startsWith(prefix + "clear")) {
if (!args[0]) return message.reply("Please enter the amount of messages to clear!");
if(isNaN(args[0])) return message.reply("Please type a real number!");
if(args[0] > 100) return message.reply("You can't remove more than 100 messages!");
if(args[0] < 1) return message.reply("You have to delete at least one message!");
await message.channel.messages.fetch({ limit: args[0]}).then(messages =>{
message.channel.bulkDelete(messages)
});
}
``` this is my code, isNaN should be already definied right?
i used it in another code and it worked
excuse me whatttttt did you just say?
That is strange, what is the error?
the console says that isNaN is not definied
which node version are you running
v12.21.0
oh also
I'm confused... is there any issue with JDA (or the API) currently? It doesn't fire the event at any embed anymore... did they change anything? 🤔
I tried it with discord.js there will it receive still the embeds, odd.
All of my bots just stopped working on embeds today, before they worked a couple of months fine.. 🤔
these two conditions don't do what you think they do, you're comparing a string to a number, you need to parse nevermind, js implicitly convertsargs[0] as a number first
const Discord = require('discord.js')
module.exports = {
name: 'purge',
description: 'Clears messages for you!',
usage: "purge <how-many-messages>",
description: "delete messages",
run: async (client, message, args) => {
if(!args[0]) return message.reply('Please enter the amount of messages you want to clear!');
if(isNaN(args[0])) return message.reply('Please enter a real number!');
if(args[0] > 500) return message.reply('You cannot delete more than 500 messages!');
if(args[0] < 1) return message.reply('To delete messages please delete atleast 1 message.');
await message.channel.messages.fetch({limit: args[0]}).then(messages =>{
message.channel.bulkDelete(messages);
});
}
}
I keep getting errors
oh wait, i took that one code from a tutorial, i actually did this before
if (message.content.toLowerCase().startsWith(prefix + "clear")) {
if (!args[0]) return message.channel.send('Error, must specify the number of messages to clear. \n Correct usage: \clear <messages to clear>')
if (args[1]) return message.channel.send('Error, invalid command usage. \n Correct usage: \clear <messages to clear>')
if (isNan(args[1])) return message.channel.send('Error, invalid number of messages to clear. \n Correct usage: \clear <messages to clear>')
const cleared = parseInt(Number(args[1]), 10)
if (cleared > 100) return message.channel.send('Error, amount of messages to clear is too large. \n Correct usage: \clear <messages to clear>')
if (cleared < 1) return message.channel.send('Error, amount of messages to clear is too ')
await message.channel.messages.fetch({limit: args[1]}).then(messages => {
message.channel.bulkDelete(messages)
})
``` @vivid fulcrum
Dont work!
your args is undefined
I wasnt giving the code to you
i was doing a clear command
How do I define
K that's nice
show your command handler
Wait
specifically show the message event file (./events/message.js probably)
index.js 110
command.run(message, args);
run: async (client, message, args) => {
message, args
client, message, args
one of these things is not like the other 😄
could someone help?
int values should be less than or equal to 100
that's pretty clear
What's messages ?
What does it mean
it means you're tryign to delete more than 100 messages
What's messages, the variable? what's it supposed to be?
or, regardless, if(args[0] > 500) return message.reply('You cannot delete more than 500 messages!');
this isn't valid
the max is 100
you cannot bulk delete more than 100 messages.
I'm going to blame you for changing 100 to 500 from that youtube tutorial 😉
That's what the video wrote lmao
holy fuck this is a 10 year old coding on a fucking android phone omg
?
Literally the worst freakin' tutorial I've ever seen and that's saying a lot
my god
Oh Mr.warriyo yea
Discord Bot From Scratch
WAT
dafuq
show
i wanna see how cringe it is
not that hard dude
It's 100% cringe
it's cringe as fuck
I'm not saying coding a bot on an android phone is hard
nah i do ot everyday
his last video on youtube 
I'm saying listening to a 10 year old coding a bot on an android phone while somehow zoomed out so the screen is tiny is the very definition of CringAF
🤭
oh its an indian kid
thats not so bad
indian kids are smarter than many american adults
still cringe
The kid is gonna look back at this and cringe very hard
Still, coding this young is still pretty impressive
even if it's a little...
you know
cringe.
i can see a promising future for him
and the fact he has so many videos, at that age i didnt have the attention span to do something like that for 2 months+
but yes
yes but only if he can get a PC
still cringe
OMFG
I guess that's not that hard to beat 😅
For alternatives, look at Hosting on Heroku (if you don't need to write files locally such as sqlite) or Hosting on Repl.IT (if you don't mind your files being seen publicly).
```REPL.IT IS FREAKING BLOCKED
heroku isn't even valid anymore
glitch.com blocked ping bots, heroku limited hours, and your shit school blocked the only valid other free hosting
Does anyone know how I can get someones avatar and have it work if their pfp is animated or still? I want to make an avatar cmd but when I do it to an account without an animated pfp it just sends it as a literal file. heres the code for it (discord.js)
if (message.content.toLowerCase().startsWith(`${guildPrefix}avatar`)) {
const users = message.mentions.users.first() || message.author
let attachment = new Discord.MessageAttachment("https://cdn.discordapp.com/avatars/"+users.id+"/"+users.avatar+".gif", "")
message.channel.send(attachment)
}
You're stuck. Just pay for a VPS.
?
GRRRRRRR
who blocked?
Their school
school
I hate this
Cuz 12 year old coding on a chromebook, y'know?
or use a vpn
16 mf
Then you should be able to figure out how to bypass this crap 😛
especially if you want to be a developer
i allready have but it dont support repl,it
Holy Unblocker is a secure web proxy service with support for many sites. Bypass filters and freely enjoy a safer private browsing experience or unblock websites on devices such as Chromebooks and at places like school or work without downloading anything.
Find another "it"
This doesn't work for gifs. I tried using it on my own pfp and it sent a still image
it should definitely work for animated avatars.
this mf school
I used this and it sent a still image.
message.channel.send(users.displayAvatarURL())
no
i doubt you'll get it to work with a web proxy, you need an actual vpn software
or at least a chrome extension
Hold up
HOLD TF UP
remove the extension and discord will automatically provide you with the correct format
you need the gif version ye
perfect.
When i use it on someone who doesnt have nitro, it sends the link.
And that doesnt embed
or work at all
this mf
interesting
Free
2 processes
512MB RAM
1GB storage
Unlimited custom domains
FTP access
Free MongoDB database
Free support
30-day free trial
yup, that's a fun little trick i found out ages ago
that's a 30 day free trial
you don't have to mess around with formats, discord will provide the correct one automatically
so... instead of unblocking repl.it you want to change hosting?
that sounds way more troublesome than just getting a vpn
Google Cloud
Experience Google’s low latency network and host your application where Google products are.
There are four available options for you.
App Engine – no need to manage the infrastructure as Google does for you. It’s a PaaS solution.
Compute Engine – get a VM with the choice of your OS and install it the way you want. You manage the server and have full control.
Kubernetes Engine – Run Node.js application in a container.
Cloud Functions – A serverless solution where you create your function to execute on Google’s infrastructure. You pay for code runs.
there are plenty of free vpns you can try
lightspeed blocking system patched that
dafuq is that
that is breaking tos
I'm not sure how to remove that from it since im just using display avatar url
but apirl fools
indexOf to find the dot and then substring
ok
that keeps making new whiles bc true = true
then how can i do apirl fools joke
dont
i am
any idea for apirl fools joke for my bot
Announce that you've made a deal with Microsoft to run your bot on Teams and the docs are on https://teams.js.org/yourbotname/integration
by the time you implement an april fools feature, april fools will end
Lmao
The time to start coding an april fools is March 1st, not April 1st.
same
its 12 50 here 
same
bri'ish
not bri'ish, asian xd
bri
ish
i have this code how do i fix the if @commands.has_permissions?
I got some code
for apirl fools

and token not working
wow lol
/home/runner/CheesyBot-apirlfools/index.js:1
#/usr/bin/python3
^
SyntaxError: Invalid or unexpected token
Hint: hit control+c anytime to enter REPL.
is error
what the fuck
idk what to do
why did you write #/usr/bin/python3 inside a js file
lmao
idk
bruh
what are you trying to do?
idk
you dont know what you're trying to do?
found it online
why did you look for it online if you dont know what you're trying to do?
idk
is there anything you DO know?
@simple zodiac you published your bot?
yeah it got approved yesterday
"idk"
cool
@_@
lol
"hey guys i need help"
"what do you need help with?"
"i dont know"
lmao
xd
Tim basically drinks a potion called "Infinity IQ" before entering the development channel
how do i obtain this potion
You don't, its Tim's secret

He holds them in his basement
how do i get in to tims basement
😳 Woah
😳
lmao
well..?
guys how are hindsight, googlefeud, and tim always online reading the chat? it looks like they get payied for helping people lol
lmao
lmao
No. We're just extremely passionate.
lol
fuck shit my grammar sucks
payied
lol
yeah i have the Lil Yachty one on
its clean
just edit the sound files
nah it'll be packs just like stickers 😛
lol
$4.99 for "My Uncle"
Is it actually paid
im gonna see if i can find the sound files
i have no idea where to look for them outside of the roaming\discordcanary directory
where would i even find it lol
they're more than likely embedded into the source
just track network usage
or it's a http request and then stored in memory
idk what any of that means 
open developer tools
What specific help do you need ?
Why them never save
Any
That doesn't "save"
I just want to add permisions
there's no saving it, you just need to generate a link with the proper permissions
Go to the "Oauth2" page
select the bot scope
that creates a link for invites
change permissions=0 with the permissions it gives you on the bot page with the permissions you want selected.
For example, Manage Server + Roles + Channels gives you perms of 268435504
Then in the Oauth2 page, you get this: https://discord.com/api/oauth2/authorize?client_id=471269875860504577&permissions=0&scope=bot , change permissions=0 to permissions=268435504
stearmcommunity?
Ignore it all good
aight
Ok now? @umbral zealot
your bot's invite link contains the permissions, thats where they are saved, in the link itself
they will show up when you add your bot to a server using the new invite link
i have this code how do i fix the if @commands.has_permissions?
You should use the decorator on the function (role)
It'll act as a check. If it fails (because the user doesn't have the manage roles permission), some block of code will catch it (either a global handler or the local command)
For more information, see:
- Handling an error globally: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.on_command_error
- Handling an error at the cogs level: https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Cog.cog_command_error
- Local error handling: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#error-handling
ty
is there a way to get a user from an id
are intents disabled while your bot has over 100 servers?
can someone help me with this pytube library
non-advertised
i'm not too familiar with verified bots, is top.gg considered as advertising?
probably, i got 100+ servers within under a week which is probably why i got flagged
how did you get so many lmao
no idea, i put it on another bot list and it just went insane
oh which one if i can ask?
aight
yea i see it isnt even on top.gg
looking at your profile on top.gg
yeah lol
i might add mine there 😳
discord gave me an added limit of 250 servers, i hope it doesnt hit that so i can get on top.gg beforehand lol
Yeah that's nice that they do that
You should maybe try contacting them? Saying that it was on a bot list
ill just wait a week first
ty
assuming ur bot is ever gonna hit that
most bots die when they hit 100 servers
lol
they usually don't grow further than 200
at least on average
good to know
if msg.startswith("Lai rock"):
How do I make it so i can put two things where "Lai rock" is?
wdym
or `${a} ${b}`
async def delete_guild_data(self):
guild = self.gcollection.find({"in_guild":False})
while True:
await delete_guild_data(self)
sleep(3600)
py
any ideas?
i am so confused this keeps crashing my bot
Whats the code?
Discord.js v11 no longer works and will not be repaired. Update to v12.
no like how do i switch without reforming the entire thing
You don't. You need to update the code.
You had an entire year to do so, v12 has been out since March 2020. You procrastinated, now you pay the price. V11 is no longer functional and it's not a 5-minute fix, you have to update a lot of code.
That error relates to v11
really?
Or... well, last I saw it did
this bug only started to happen when i changed something in my code
if you do npm ls discord.js in your bot folder what version do you get?
oh look
commando requires v11 lol
It's interesting that both of those are listing discord.js as unmet peer deps
but doesn't say what version you do have
Try npm i discord.js@latest that would install 12.5.2 . It's possible the same error happens in v12 older versions that weren't updated for a while
oh ok
this only happened when i updated something in my code tho so like im kinda confused
What did you change in your code?

idk how to explain
it has to do with guild IDs and stuff
waaaait
i think i may know what caused it
nevermind
Is there a way to only delete words that are included not strings within words, for example
if I wanted to ban all instances of "he" but the word "hello" contains he. I dont want to delete hello
But I wanted to delete the message "random random he random"
add the spaces before and after the word?
split the sentence by space, and check if one of the elements is exactly your banned word
like, in JS I'd do sentence.split(" ").includes(bannedWord) (of course if you have many banned words it's like 2 loops basically)
ah thanks
mk so on repl.it when an error happens it makes it unrun or makes the bot go offline how can i fix this
/home/runner/bot/commands/moderation/ban.js:8
member.ban().then((member) => {
^
TypeError: Cannot read property 'ban' of undefined
at Object.execute (/home/runner/bot/commands/moderation/ban.js:8:12)
at Timeout._onTimeout (/home/runner/bot/index.js:110:42)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
exit status 1
Catch the errors.
:/
Make code that doesn't crash.
try/catch for normal blocks, .catch() for promises
Does anyone have a Time/Reminder command?
look up "handling errors in javascript"
Timer *
} catch (error) {
console.error("\033[91m" + error + "\033[0m");
msg.channel.send(
`${msg.author} The command didn't work. Try Again :wink:`
);
try/catch doesn't work on promise-based code using .then()
i have that
you need to use await to use try/catch, or oyu need to use .catch() at the end of every line that can throw an error
:/
i need something with out await i hate await and dont use it
Then add .catch() on every line that can throw an error which uses a promise
¯_(ツ)_/¯
Yes the easy way is a try/catch around a block of promises which uses async/await.
looks like this ```js
async function myFunc() {
try {
const a = await getData();
const b = await getMoreData(a);
const c = await getEvenMoreData(b);
const d = await getUltimateData(c);
console.log(d);
// and you can also RETURN this!
return d;
} catch(err) {
console.error("An error occured: " + e);
}
}
tf
The page I linked on promises also teaches you about how to use async/await properly.
How can I achieve that my bot counts all users from the servers the bot is in?
I tried with guild.members.fetch() but that didn't worked for me with all servers
When can i use ejs on
wdym by didn't work for all servers
I only got the user count for the server the command was executed in
not for all servers the bot is active in
get your bot object and loop through each server
fetch members
add to a variable
once its done looping you got your total number
atleast that's how I do it
okay thanks ^^
nws
You don't need to fetch all members
Just add up all the memberCount prop for all servers
in discord.js that's client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)
@brave tendon
Does anyone know how to make a Carl-bot tag when I run a command it will ping a random member with a certain role?
How do i make the user avatar show on my website
oh thank you!
Are you logging people on to your website using oauth2 and discord?
Yes
More details? How? What's your backend like?
Because the easiest way is to send that info from the backend tbh
All i have is the oauth2 from discord i can show you my code
you gotta exchange the token for an access_token
and then you can use the access token for the stuff on behalf of the user
Does anyone know how to make a dashboard for a discord bot?
that should return the avatar url
Can you look at my login.html code
no need to
you already said you got the access_token
just touch the /users/@me endpoint with your access_token
Can you check if i did it right
You don't even need to, like
do anything
renderTemplate already sends you the user
it's available as the user variable on every single template file you have
<script>
window.onload = () => {
const fragment = new URLSearchParams(window.location.hash.slice(1));
if (fragment.has("access_token")) {
const accessToken = fragment.get("access_token");
const tokenType = fragment.get("token_type");
fetch('https://discord.com/api/users/@me', {
headers: {
authorization: `${tokenType} ${accessToken}`
}
})
.then(res => res.json())
.then(response => {
const { username, discriminator } = response;
document.getElementById('info').innerText += ` ${username}#${discriminator}`;
})
.catch(console.error);
}
else {
document.getElementById('login').style.display = 'block';
}
}
</script>
sends anwayay
Or are you not at all using index.js
Im not using index.js i just did </script>
This looks like half the code ripped out from my dashboard code, with random HTML thrown in instead of the ejs files
your index.html attempts to use include() but that's reserved for EJS files
it doesn't work if you don't render it server-side
unless that's some brand new html thing that's magic and your use of my index.js dashboard is just there to confuse the hell out of everyone
Ok
Thanks again! working like a charm
Awesomeness!
client.user.setActivity(actividad, { type: "WATCHING" });
^
TypeError: Cannot read property 'setActivity' of undefined
async def delete_guild_data(self):
guild = self.gcollection.find({"in_guild":False})
while True:
await delete_guild_data(self)
sleep(3600)```
py
https://cdn.discordapp.com/attachments/272764566411149314/827322024711553064/unknown.png
any ideas?
@slender thistle sorry to bother but youre like the only python person here kek
rovi doesnt exist anymore
You probably aren't running a version of Python supporting async/await.
somebody?
client.user.setActivity(actividad, { type: "WATCHING" });
^
TypeError: Cannot read property 'setActivity' of undefined
That code needs to be inside an event
It cannot be outside of them.
Client.user is only undefined before the bot is in a ready state.
` module.exports = (client) => {
console.log("RAILBAN esta ONLINE.");
const actividades = [
"el show de Shokuhou | ?help",
"a Kuroko meterse en mi cama | ?help",
"a Index morder a Touma | ?help",
"a Accelerator ser el bueno | ?help",
"que soy realmente | ?help",
"a las Sisters en acción | ?help"
];
setInterval(() => {
let actividad = actividades[Math.floor(Math.random() * actividades.length)];
client.user.setActivity(actividad, { type: "WATCHING" });
}, 15000);
status: "online"
}; `
How and when are you calling this code?
And this is the whole file?
ye
['command_handler', 'event_handler'].forEach(handler =>{
require(./handlers/${handler})(client, Discord);
})
and
const fs = require('fs');
module.exports = (client, Discord) =>{
const load_dir = (dirs) =>{
const event_files = fs.readdirSync(./events/${dirs}).filter(file => file.endsWith('.js'));
for(const file of event_files){
const event = require(`../events/${dirs}/${file}`);
const event_name = file.split('.')[0];
client.on(event_name, event.bind(null, Discord, client));
}
}
['client', 'guild'].forEach(e => load_dir(e))
}
async def delete_guild_data(self):
guild = self.gcollection.find({"in_guild":False})
while True:
await delete_guild_data(self)
sleep(3600)```
py
https://cdn.discordapp.com/attachments/272764566411149314/827322024711553064/unknown.png
any ideas?
If you need something from the Discord library, import it in the file you're using it in
@drifting wedge
ty it worked

a
another
/app/events/guild/message.js:3
if(!message.content.startsWith(prefix) || message.author.bot) return;
^
TypeError: Cannot read property 'content' of undefined
now what?
if msg.startswith("Lai hug"):
embed=discord.Embed(title=random.choice(starter_hugtext), description=random.choice(starter_hugs), color=0xf5d6ea)
await message.channel.send(embed=embed)
I'm trying to make an embeded message
This is python btw
hugtext is text and hugs are gifs
but each time I run the command the gif is just a link
I know it has to do with the description but I'm not sure what to do
You want a discord.ext task preferably
did you try embed.set_image(url=starter_hugs)?
i looked into that
but what difference will it make?
its basically the same code?
OPHHH
i see itll be sync?
btw the sleep is from asyncio
It will run every X seconds/minutes in the background as opposed to your blocking while True: which won't exactly work well
not time



