#development

1 messages · Page 1681 of 1

latent heron
umbral zealot
#

Being called mentally incapable isn't a joke, asshole.

dusky lagoon
#

Yeeezzz take it easy

#

Is a command loader the same as a command handler

vivid fulcrum
#

no

latent heron
#

no, that's called being a piece of shit, own up to what you did.

#

you got called out for it

dusky lagoon
#

you mean a dark joke??

latent heron
#

it didn't have the slightest hint of being a joke even

#

you legit tried to insist Hindsight is mentally handicapped

dusky lagoon
#

mentally handicapped 😂

latent heron
#

ugh, you're not worth my time today

dusky lagoon
#

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

latent heron
#

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"

dusky lagoon
#

well if im autistic and i make a autstic joke does that suddenly make me a piece of shit??

latent heron
#

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

dusky lagoon
#

it obviously was

#

as in me saying IT WAS A JOKE

latent heron
#

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

dusky lagoon
#

well i see it as a joke so if you cant handle dark humor then thats your problem

latent heron
#

you're being so unnecessarily difficult

dusky lagoon
#

bruhhh

#

i thought it was funny because i could relate to it

latent heron
#

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

latent heron
#

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

dusky lagoon
#

diagnosed??

latent heron
#

since 4

dusky lagoon
#

Damn

latent heron
#

especially when i actually have been diagnosed specifically with that

#

just fucking own up dude, this isn't hard.

median iris
#

any vsc user and node.js user here ?

#

i want to know how to run an bot app on vsc

#

cmd

#

?

#

@dusky lagoon

dusky lagoon
#

ohw heyy

median iris
#

pls tell

#

whts the cmd

#

to rn

#

run

dusky lagoon
#

mostly node .??

#

or node index

median iris
#

node

#

but

dusky lagoon
#

yeah node

median iris
#

ok lemme try 2nd

#

1st not working

#

not works

dusky lagoon
#

did you watch any youtube tutorials they perfectly explain how to start and create a bot

median iris
#

i saw

cinder patio
#

In which directory are you running the command

median iris
#

they type node .

#

terminal

dusky lagoon
#

then i should suggest trying the same thing

cinder patio
#

That doesn't answer my question

#

I don't think you know what you're doing

dusky lagoon
#

Didnt know it was a question

dusky lagoon
cinder patio
#

no

dusky lagoon
#

Ohw ruthless

median iris
#

see

#

@dusky lagoon

#

@cinder patio

pale vessel
#

Check your index.js file and package.json main entry

median iris
#

ok

#
const client = new Discord.Client();

client.once('ready', () => {
    console.log('Ready!');
});

client.login(process.env.token);```
#

basic structre

#

:?

#

;/

umbral zealot
#

save your files

#

node can't read what's in your editor, only what's saved on disk.

median iris
#

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

umbral zealot
#

the token in your .env file isn't correct

#

or you didn't save the .env

dusky lagoon
#

or you didnt add a token

cobalt spruce
#

no news about slash cmds in discordjs?

median iris
#

I added token

#

TOKEN=mytoken

umbral zealot
#

It's also possible you need to add dotenv to your project

median iris
#

i type this there

umbral zealot
#

oh wait

#

token and TOKEN are not the same thing

#

javascript is case sensitive

median iris
#

o

#

so i need to write token ?

umbral zealot
#

either you change it to token in the .env file or you use process.env.TOKEN

#

either will work

median iris
#

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

old latch
#

your token is invalid

pale vessel
#

you didn't configure dotenv

umbral zealot
median iris
#

not working

pale vessel
#

that really explains your situation doesn't it

#

what do you mean by not working

umbral zealot
#

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.

median iris
#
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

umbral zealot
#

and does your .env say token= or TOKEN= ?

median iris
#
PREFIX=!```
#

.env file

umbral zealot
#

What you shouldn't do is just blindly copy/paste shit, tbh.

#

And you also probably didn't even save your files again?

median iris
#

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

earnest phoenix
#

npm i dotenv

median iris
#

did it

earnest phoenix
#

hm

#

retry

median iris
#

ok

#

GG

#

It worked

#

tysm

earnest phoenix
#

bruh

umbral zealot
#

See if you do'nt have the patience to actually read through ONE page correctly, you don't have the patience to make bots.

earnest phoenix
#

whatever

#

np

umbral zealot
#

Learn to have patience, or stop now.

toxic sedge
#

True at

eternal osprey
#

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.

toxic sedge
#

dat

#

What is your code, and what did you try to execute?

eternal osprey
#

my !help command

#

has nothing with any tipe of commands in it

#

so that can't be it

toxic sedge
#

Could you send an example of your code?

eternal osprey
#
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)
    }
  
}```
eternal osprey
#

v11

earnest phoenix
#

update to v12

umbral zealot
#

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

toxic sedge
#

ye

earnest phoenix
#

still

umbral zealot
#

Ah right so.. yeah you need to actually update to v12

earnest phoenix
#

update to v12

umbral zealot
#

v11 is 100% broke.

earnest phoenix
#

yup

toxic sedge
#

yeah

earnest phoenix
#

gg

toxic sedge
#

just do npm i discord.js@latest

eternal osprey
#

so i gotta update everything i have done

#

just to fix this small issue

umbral zealot
#

yes.

umbral zealot
#

v12 came out a full YEAR ago, you had plenty of time to update.

eternal osprey
#

so i can't find the little snippet that is making the whole bot not work and just delete it>

umbral zealot
#

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.

eternal osprey
#

I rather would want to do that and upgrade it in the weekend as rn i have no time. Last 2 exams coming in.

umbral zealot
#

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. ¯_(ツ)_/¯

pale vessel
#

why are you creating a new client inside a command 🤔

umbral zealot
#

and then not even using it tbh

#

just a nice waste of RAM

eternal osprey
#

okay so there really is no way to remove that id in the guild create?

#

Where is that guild create even coming from

umbral zealot
#

There is no way for you to fix a broken, outdated library, no.

#

This is all internal

#

The error is in the library code

eternal osprey
#

owh fuck

#

okay

#

well that means that i will have to leave the bot for now as i need to finish my exams first

umbral zealot
#

Yes.

eternal osprey
#

thanks!

quartz kindle
#

and edit the file that causing the crash

#

ClientDataManager.js line 81

misty sigil
#

outdated lib go brr

errant perch
#

would async/ await be better than promises?

quartz kindle
#

async/await is promise

eternal osprey
errant perch
earnest phoenix
#

anyone a gRPC user here?

frigid mountain
#
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

earnest phoenix
#

I wanna make my help command vertical I am using embed.add_field how would I make it vertical?

old cliff
#
(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?
cinder patio
umbral zealot
frigid mountain
old cliff
umbral zealot
#

Well either you're still adding too many, or they're not being removed correctly.

cinder patio
#

show how you're removing em

earnest phoenix
#

anyone coding in py here?

old cliff
#
client.removeListener(event,client.events.get(event).run);
#

wait... should I remove first or add first?

#

I am adding new ones first

umbral zealot
#

you should remove first yes

old cliff
#

ok

umbral zealot
#

Alternatively try to do client.removeAllListeners(event) instead

old cliff
#

nah... that would be bizzare

umbral zealot
#

would it?

old cliff
#

yes

umbral zealot
#

why?

old cliff
#

I have like 3 listeners for an event and I want to remove 1 specific

#

and removing all would break things

umbral zealot
#

Ah well that's bizarre 😛

#

j/k

#

but yes remove first, then add the new one.

old cliff
#

I added first and removed later to avoid event getting removed and having an error while adding new one

#

so no event occurs...

cinder patio
old cliff
#

how can I remove this warning?

#

client.setMaxListeners(20) ?

umbral zealot
#

are you legit adding more than 10 listeners for one single event?

old cliff
#

no its just 1 per event and occasionally 2-3

#

not more per event

umbral zealot
#

Then fix the problem itself

#

raising the limit will only push the problem back further

#

and use a lot more RAM uselessly

old cliff
#

it doesn't increase ram usage Thonk

umbral zealot
#

it does, the functions are still loaded in memory

#

thus they're still executed when the event happens.

#

that's problematic.

old cliff
#

I am doing this for old functions

delete require.cache[require.resolve(file)];```
umbral zealot
#

ok but it doesn't detach the function from the event emitter

old cliff
#

but after new ones are added

#

so for a few seconds ram can go up

umbral zealot
#

ok but I'm saying

#

the old ones are not removed correctly

#

if they were, you would not get the warning

old cliff
#

hmm...

umbral zealot
#

move the removeListener to the top, before even clearing the cache

#

like, literally as the first line would be better.

old cliff
#

okie

#

still the same warning...

wicked canyon
#

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?

quartz kindle
old cliff
#

ok

wicked canyon
old cliff
#
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
rough current
#

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

quartz kindle
#

the problem is not the event

old cliff
#

and?

quartz kindle
#

that warning is likely coming from the sharding manager

old cliff
#

ok

#

should I just leave it?

quartz kindle
#

show your manager code

old cliff
#
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();```
quartz kindle
#

try logging shard._events.message

#

does the warning appear before or after the above shard events?

old cliff
old cliff
quartz kindle
#

dafuq

#

do you use child_process anywhere in your code?

#

if not, then the only explanation would be broadcastEval itself fucking up

crystal wigeon
#

how legit is double counter bot?

#

i saw it detects atls?

#

they say they check ip

oak cliff
#

This is for help with bot coding, not asking about other bots usefullness

#

Please use general or another channel

cinder patio
#

They're probably asking how the bot's doing it

#

It can't without redirecting the user to a website

crystal wigeon
#

yeah it does redirect to a website

#

i just wanna make sure its a legit bot

cinder patio
#

well there you go

#

then it's probably legit

crystal wigeon
#

okies

#

thanks

quartz kindle
#

if they use your IP then thats how they do it

#

you cant get someone's IP through discord, but you can through websites

crystal wigeon
#

its weird because for some the url didnt even open

#

makes sense

cinder patio
#

All the bot needs is a single request to a website

crystal wigeon
#

yep, they send a "verification link" to be clicked on

#

makes sense

cinder patio
#

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

old cliff
#

its probably a djs bug

quartz kindle
#

discord displays websites in a special embed

crystal wigeon
#

also

#

they claim to bypass vpns

quartz kindle
#

they probably generate the embed data server side

crystal wigeon
#

so is that even possible?

#

like even if the user is using a vpn

cinder patio
#

no

quartz kindle
#

if they use other tracking methods

#

like device fingerprinting

cinder patio
#

so no

crystal wigeon
#

interesting

cinder patio
#

can you even get that info via a request

crystal wigeon
#

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

cinder patio
#

it doesn't really matter what the site does

#

that's just for advertising purposes

quartz kindle
#

you can check what scripts they run on client side

#

they could be using canvas fingerprinting for example

vast atlas
#

can anyone help me in java

cinder patio
#

So canvas fingerprinting is basically unstoppable cookies

rustic nova
simple zodiac
#

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 thOnk (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!!`)
  }
}
winged linden
simple zodiac
winged linden
#

Not a public bot?

simple zodiac
#

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

winged linden
#

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

frigid mountain
#

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

simple zodiac
#

Yeah I want it to send that if it didn't have an error

winged linden
#

In the if(canmanageemoji) you are sending a message anyways even if it didnt add it

simple zodiac
#

yeah i'm not sure how to do it otherwise

winged linden
#

Wait i will do it for u give me a bit though

simple zodiac
#

the emojis that i was testing with were under 256kb & the names were like 4-6 characters when i was testing

#

alright

frigid mountain
#

Mmm

near stratus
#

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

simple zodiac
#

oops

#

sorry I think you do
embeds: [embed name]

#

I thought you meant something else, that should? work

near stratus
# simple zodiac sorry I think you do embeds: [embed name]
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',
	},
};
simple zodiac
#

woah

#

that is a massive embed

near stratus
#

just copy paste for testing

simple zodiac
#

uh im not sure what that is, i do my embeds another way but if you do
embeds: [exampleEmbed] that should work

near stratus
#

oh okay

simple zodiac
#

yea

#

hope that works

frigid mountain
#

guess I'm not getting help

simple zodiac
frigid mountain
#

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

simple zodiac
#

what is the issue

cinder patio
#

You're already using message.mentions to get the mentioned user, so why not apply the same knowledge

#

except this time with roles

near stratus
simple zodiac
#

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>"

frigid mountain
simple zodiac
#

oh

frigid mountain
cinder patio
#

yes

near stratus
#

I give up

simple zodiac
#

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

near stratus
#

@simple zodiac Well actually it worked. I misspelled embeds for embed

simple zodiac
#

ahh

#

glad that worked for you

frigid mountain
# cinder patio ^^ <@!774903577068044298>
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

wicked canyon
frigid mountain
#

How?

cinder patio
#

what is happening

#

what errors are you getting, if any

umbral zealot
#

What doesn't work? how doesn't it work? is there an error?

crystal wigeon
#

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

frigid mountain
cinder patio
#

Your bot cannot add roles to that member

#

or that role

earnest phoenix
#

missing permissions

cinder patio
#

The bot's role must be higher than the role you're trying to give

#

and the bot must have the Manage roles permission

cinder patio
#

the ip may change, though

frigid mountain
#

Oh thx

crystal wigeon
#

im kind aconfused, because the person who's alt sounds convencing

#

but they used to same ip

#

to verify

frigid mountain
#

That's means I have to add a message.reply("my role is not higher than that role")

earnest phoenix
cinder patio
#

Their IP could have changed

earnest phoenix
#

yeah

cinder patio
#

They change quite often

#

unless it's a static one ofc

earnest phoenix
#

help

vivid fulcrum
#

911, what's your emergency

tame kestrel
vivid fulcrum
#

it really depends on the router setup, no?

eternal osprey
#

@quartz kindle yo man i did what you said

#

and i found the file

tame kestrel
#

Well yeah but at the end of the day the single router that the isp gets is assigned an ip

eternal osprey
#

should i just remove this?

misty sigil
#

no

vivid fulcrum
#

in most households the router will assign the same public ip to connected devices, while keeping the internal masks unique

eternal osprey
tame kestrel
#

Yes, but your neighbors will never have the same ip as you

misty sigil
#

edit it

vivid fulcrum
misty sigil
#

not... delete it

eternal osprey
#

Like what should i edit?

misty sigil
#

what version of djs are you using

quartz kindle
#

if(!channel) return

#

right before that line

eternal osprey
#

aha

quartz kindle
#

this might not be the only problem, there might appear more errors after you fix that one

eternal osprey
#

yeah i will check it out

#

it worked!

#

If i could, i would kiss you on the cheek tim!

dusky sundial
#

@balmy root
background-repeat: no-repeat;

#

and you probably want background-size: cover; to fill the page too

rigid shadow
#

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.. 🤔

rough current
#

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?

cinder patio
#

How are you currently trying to mention them

rough current
#

message.author

cinder patio
#

how are you sending the message

#

show that part of the code

rough current
#

I use some weird code but here

cinder patio
#

nevermind

rough current
#

yeah

vivid fulcrum
#

if else commands notlikenoot

#

use the provided command library

rough current
#

Ty

near stratus
frigid mountain
#

I solved it 2 hours ago

frigid mountain
#

What do I do so that when a person uses a embed command it shows there avatar next to the footer

vivid fulcrum
#

their

#

in which library

frigid mountain
vivid fulcrum
#

??

frigid mountain
#

Idk what's that

vivid fulcrum
#

🚶‍♂️ 🦽

frigid mountain
#

Wdym

pale vessel
#

🤷

winged linden
#

🤐

frigid mountain
#

Help pls?

cinder patio
#

🤨

solemn quartz
#

Guys why does do i get an error saying that isNaN is not definied??

vivid fulcrum
#

why does do i
what is up with people's grammar today

#

because isNaN is not defined

solemn quartz
#

Bruh i just mistyped

vivid fulcrum
#

make sure you're calling it as a method, not a property

cinder patio
#

💆‍♂️

solemn quartz
#
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

vivid fulcrum
#

if else commands 😔

#

and transforming the content on every if clause 😔

sinful thistle
#

excuse me whatttttt did you just say?

stark abyss
#

That is strange, what is the error?

solemn quartz
#

the console says that isNaN is not definied

vivid fulcrum
#

which node version are you running

solemn quartz
#

v12.21.0

vivid fulcrum
#

oh also

rigid shadow
#

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.. 🤔

vivid fulcrum
#

these two conditions don't do what you think they do, you're comparing a string to a number, you need to parse args[0] as a number first nevermind, js implicitly converts

frigid mountain
#
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

solemn quartz
#

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
vivid fulcrum
solemn quartz
#

oh

#

Fuck

#

that capital ruined my life

solemn quartz
#

i was doing a clear command

frigid mountain
solemn quartz
#

and i had a error

#

pfttttttttt

frigid mountain
#

K that's nice

quartz kindle
#

show your command handler

frigid mountain
#

Wait

umbral zealot
#

specifically show the message event file (./events/message.js probably)

quartz kindle
#

index.js 110

frigid mountain
quartz kindle
#

command.run(message, args);

#

run: async (client, message, args) => {

#

message, args
client, message, args

umbral zealot
#

one of these things is not like the other 😄

umbral zealot
#

int values should be less than or equal to 100

#

that's pretty clear

#

What's messages ?

frigid mountain
umbral zealot
#

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.

frigid mountain
#

K

#

I watched a YouTube video so dont blame me blame the YouTuber Mr.warriyo

umbral zealot
#

I'm going to blame you for changing 100 to 500 from that youtube tutorial 😉

quartz kindle
#

lmao

#

i blame you for watching youtube videos

#

instead of reading docs

frigid mountain
umbral zealot
#

holy fuck this is a 10 year old coding on a fucking android phone omg

frigid mountain
#

?

umbral zealot
#

Literally the worst freakin' tutorial I've ever seen and that's saying a lot

#

my god

frigid mountain
#

Oh Mr.warriyo yea

earnest phoenix
#

what permission bitfield does the bot need to fetchInvites

#

found it, all good

balmy root
#
Discord Bot From Scratch

WAT

quartz kindle
#

i wanna see how cringe it is

umbral zealot
#

It's 100% cringe

#

it's cringe as fuck

#

I'm not saying coding a bot on an android phone is hard

balmy root
solemn latch
#

his last video on youtube sad

umbral zealot
#

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

cinder patio
#

🤭

quartz kindle
#

oh its an indian kid

#

thats not so bad

#

indian kids are smarter than many american adults

umbral zealot
#

still cringe

cinder patio
#

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

umbral zealot
#

cringe.

quartz kindle
#

i can see a promising future for him

solemn latch
#

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+

quartz kindle
#

but yes

umbral zealot
quartz kindle
#

still cringe

balmy root
#

OMFG

rigid shadow
#

I guess that's not that hard to beat 😅

balmy root
#
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
umbral zealot
#

heroku isn't even valid anymore

balmy root
#

ikr

#

i am looking for something else then glitch

umbral zealot
#

glitch.com blocked ping bots, heroku limited hours, and your shit school blocked the only valid other free hosting

simple zodiac
#

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)
}
umbral zealot
#

You're stuck. Just pay for a VPS.

balmy root
#

then they blocked it

umbral zealot
balmy root
#

GRRRRRRR

quartz kindle
#

who blocked?

umbral zealot
#

Their school

balmy root
#

school

quartz kindle
#

oh

#

lmao

#

use it outside of school?

balmy root
#

I hate this

umbral zealot
#

Cuz 12 year old coding on a chromebook, y'know?

quartz kindle
#

or use a vpn

umbral zealot
#

Then you should be able to figure out how to bypass this crap 😛

#

especially if you want to be a developer

balmy root
#
umbral zealot
#

Find another "it"

simple zodiac
umbral zealot
balmy root
#

this mf school

simple zodiac
balmy root
#

no

quartz kindle
#

i doubt you'll get it to work with a web proxy, you need an actual vpn software

#

or at least a chrome extension

umbral zealot
#

it's a webp file

#

that's definitely animated

balmy root
#

Hold up

balmy root
umbral zealot
#

hmm

#

well would you look at that

balmy root
#

HOLD TF UP

simple zodiac
#

it doesnt work for animated ones ¯_(ツ)_/¯

#

thats a gif

vivid fulcrum
#

remove the extension and discord will automatically provide you with the correct format

quartz kindle
#

you need the gif version ye

umbral zealot
#

perfect.

simple zodiac
#

When i use it on someone who doesnt have nitro, it sends the link.

#

And that doesnt embed

balmy root
#

30-day free trial?

#

tf

simple zodiac
#

or work at all

balmy root
#

this mf

balmy root
#
Free
  2 processes
  512MB RAM
  1GB storage
 Unlimited custom domains
 FTP access
 Free MongoDB database
 Free support
 30-day free trial
vivid fulcrum
umbral zealot
vivid fulcrum
#

you don't have to mess around with formats, discord will provide the correct one automatically

quartz kindle
#

that sounds way more troublesome than just getting a vpn

balmy root
#
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.
quartz kindle
#

there are plenty of free vpns you can try

balmy root
quartz kindle
#

dafuq is that

earnest phoenix
#

anyone got code to spam rickroll link ever 15 seconds

#

for apirl fools

balmy root
#

that is breaking tos

simple zodiac
earnest phoenix
vivid fulcrum
#

indexOf to find the dot and then substring

balmy root
#

that would crash a system

earnest phoenix
#

ok

balmy root
#

that keeps making new whiles bc true = true

earnest phoenix
#

then how can i do apirl fools joke

balmy root
#

dont

earnest phoenix
#

i am

split cipher
#

You can do an april fools joke by making a joke

#

ez

earnest phoenix
#

any idea for apirl fools joke for my bot

simple zodiac
#

change pfp a little

#

thats what i did for mine

earnest phoenix
#

ok

#

anything ells

umbral zealot
#

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

earnest phoenix
#

well my bot only got 3 command

#

s

vivid fulcrum
#

by the time you implement an april fools feature, april fools will end

winged linden
#

Lmao

simple zodiac
#

i mean for me it ends in 12 hours

umbral zealot
#

The time to start coding an april fools is March 1st, not April 1st.

earnest phoenix
simple zodiac
#

its 12 50 here pe

earnest phoenix
pale vessel
#

Almost 4am already, no more april fools please

#

close to australia

simple zodiac
#

bri'ish

pale vessel
#

not bri'ish, asian xd

simple zodiac
#

bri
ish

earnest phoenix
#

i have this code how do i fix the if @commands.has_permissions?

#

I got some code

#

for apirl fools

simple zodiac
quartz kindle
#

my bot's april fools joke is fully automated

#

i dont need to do anything

earnest phoenix
#

and token not working

solemn quartz
earnest phoenix
#

/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

quartz kindle
#

what the fuck

simple zodiac
#

?

#

what

earnest phoenix
#

idk what to do

quartz kindle
#

why did you write #/usr/bin/python3 inside a js file

simple zodiac
#

lmao

earnest phoenix
#

idk

simple zodiac
#

bruh

quartz kindle
#

what are you trying to do?

earnest phoenix
#

idk

quartz kindle
#

you dont know what you're trying to do?

earnest phoenix
#

found it online

quartz kindle
#

why did you look for it online if you dont know what you're trying to do?

earnest phoenix
#

idk

quartz kindle
#

is there anything you DO know?

solemn quartz
#

@simple zodiac you published your bot?

simple zodiac
pale vessel
solemn quartz
#

cool

quartz kindle
#

@_@

simple zodiac
#

lol

quartz kindle
#

"hey guys i need help"
"what do you need help with?"
"i dont know"

simple zodiac
#

lmao

quartz kindle
#

xd

earnest phoenix
#

Tim basically drinks a potion called "Infinity IQ" before entering the development channel

simple zodiac
#

how do i obtain this potion

earnest phoenix
#

You don't, its Tim's secret

simple zodiac
earnest phoenix
#

He holds them in his basement

simple zodiac
#

how do i get in to tims basement

earnest phoenix
#

😳 Woah

simple zodiac
#

😳

quartz kindle
#

lmao

simple zodiac
#

well..?

solemn quartz
#

guys how are hindsight, googlefeud, and tim always online reading the chat? it looks like they get payied for helping people lol

simple zodiac
#

lmao

solemn quartz
#

lmao

umbral zealot
#

No. We're just extremely passionate.

solemn quartz
#

lol

simple zodiac
#

payied

solemn quartz
#

why do i just forget the basic english words

#

sometimes

simple zodiac
#

lol

earnest phoenix
#

guys new apirl fools prank from discord

#

so clean

#

best when calling someone

simple zodiac
#

yeah i have the Lil Yachty one on

earnest phoenix
#

its clean

simple zodiac
#

go to their yt channel

#

(discords)

#

oh ok

earnest phoenix
#

Imagine if discord lets you create custom sounds for it

crimson vapor
#

just edit the sound files

umbral zealot
#

nah it'll be packs just like stickers 😛

simple zodiac
#

lol

umbral zealot
#

$4.99 for "My Uncle"

earnest phoenix
#

Is it actually paid

simple zodiac
#

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

vivid fulcrum
#

they're more than likely embedded into the source

pale vessel
#

just track network usage

vivid fulcrum
#

or it's a http request and then stored in memory

simple zodiac
#

idk what any of that means BC_sadpee

pale vessel
#

open developer tools

simple zodiac
#

the what

#

like inspect element?

deft jackal
#

I need help

#

With bot permissions

umbral zealot
#

What specific help do you need ?

deft jackal
#

Why them never save

deft jackal
umbral zealot
#

That doesn't "save"

deft jackal
#

I just want to add permisions

umbral zealot
#

there's no saving it, you just need to generate a link with the proper permissions

deft jackal
#

To my bot

#

Oh

#

Hmm

#

Pls tell me how can I do it

umbral zealot
#

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

sudden geyser
#

stearmcommunity?

rustic nova
#

Ignore it all good

sudden geyser
#

aight

deft jackal
#

Ok now? @umbral zealot

umbral zealot
#

literally you have the link now

#

¯_(ツ)_/¯

quartz kindle
#

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

earnest phoenix
#

i have this code how do i fix the if @commands.has_permissions?

sudden geyser
#

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)

earnest phoenix
#

ty

thick nexus
#

is there a way to get a user from an id

earnest phoenix
#

are intents disabled while your bot has over 100 servers?

unreal estuary
#

can someone help me with this pytube library

earnest phoenix
#

probably, i got 100+ servers within under a week which is probably why i got flagged

simple zodiac
#

how did you get so many lmao

earnest phoenix
#

no idea, i put it on another bot list and it just went insane

simple zodiac
#

oh which one if i can ask?

#

aight

#

yea i see it isnt even on top.gg

#

looking at your profile on top.gg

earnest phoenix
#

yeah lol

simple zodiac
#

i might add mine there 😳

earnest phoenix
#

discord gave me an added limit of 250 servers, i hope it doesnt hit that so i can get on top.gg beforehand lol

simple zodiac
#

Yeah that's nice that they do that

#

You should maybe try contacting them? Saying that it was on a bot list

earnest phoenix
#

ill just wait a week first

simple zodiac
#

aight

#

good luck

earnest phoenix
#

ty

marble juniper
#

most bots die when they hit 100 servers

#

lol

#

they usually don't grow further than 200

#

at least on average

earnest phoenix
#

good to know

thin echo
#
if msg.startswith("Lai rock"):
#

How do I make it so i can put two things where "Lai rock" is?

balmy root
#

wdym

balmy root
thin echo
#

yeah

#

sigh

balmy root
#

oof

#

lost me bai

#

i agree

drifting wedge
#
    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?

silver monolith
#

i am so confused this keeps crashing my bot

rocky dagger
#

Whats the code?

umbral zealot
silver monolith
#

oh ok

#

how do i?

umbral zealot
silver monolith
#

no like how do i switch without reforming the entire thing

umbral zealot
#

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.

silver monolith
#

uh

#

wait

#

i use v12

#

i made the bot in october

umbral zealot
#

That error relates to v11

silver monolith
#

really?

umbral zealot
#

Or... well, last I saw it did

silver monolith
#

this bug only started to happen when i changed something in my code

umbral zealot
#

if you do npm ls discord.js in your bot folder what version do you get?

silver monolith
#

one sec lemme do it

umbral zealot
#

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

silver monolith
#

oh ok

#

this only happened when i updated something in my code tho so like im kinda confused

umbral zealot
#

What did you change in your code?

silver monolith
#

ok

#

wait i need to check

#

i forgot lol

umbral zealot
silver monolith
#

idk how to explain

#

it has to do with guild IDs and stuff

#

waaaait

#

i think i may know what caused it

#

nevermind

cunning gorge
#

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"

umbral zealot
#

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)

cunning gorge
#

ah thanks

balmy root
#

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
umbral zealot
#

member is undefined.

#

clearly

balmy root
#

no thats not wat i mean

#

any time there is an error

umbral zealot
#

Catch the errors.

balmy root
#

:/

umbral zealot
#

Make code that doesn't crash.

balmy root
#

how thpu

#

i have this thig

umbral zealot
#

try/catch for normal blocks, .catch() for promises

devout hornet
#

Does anyone have a Time/Reminder command?

umbral zealot
#

look up "handling errors in javascript"

devout hornet
#

Timer *

balmy root
#
} catch (error) {
        console.error("\033[91m" + error + "\033[0m");
        msg.channel.send(
          `${msg.author} The command didn't work. Try Again :wink:`
        );
umbral zealot
#

try/catch doesn't work on promise-based code using .then()

balmy root
#

i have that

umbral zealot
#

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

balmy root
#

:/

umbral zealot
balmy root
#

i need something with out await i hate await and dont use it

umbral zealot
#

Then add .catch() on every line that can throw an error which uses a promise

#

¯_(ツ)_/¯

balmy root
#

:/

#

is there an easyer way

#

and faster way

umbral zealot
#

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);
}
}

umbral zealot
#

The page I linked on promises also teaches you about how to use async/await properly.

brave tendon
#

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

lucid prawn
#

When can i use ejs on

umbral zealot
#

"when"???

#

I don't think ejs has a time limitation to it....

earnest phoenix
brave tendon
#

not for all servers the bot is active in

earnest phoenix
#

fetch members

#

add to a variable

#

once its done looping you got your total number

#

atleast that's how I do it

brave tendon
#

okay thanks ^^

earnest phoenix
#

nws

umbral zealot
#

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

quartz pier
#

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?

lucid prawn
#

How do i make the user avatar show on my website

umbral zealot
lucid prawn
#

Yes

umbral zealot
#

More details? How? What's your backend like?

#

Because the easiest way is to send that info from the backend tbh

lucid prawn
#

All i have is the oauth2 from discord i can show you my code

opal plank
#

you gotta exchange the token for an access_token

opal plank
lucid prawn
#

I did

opal plank
#

you have the user id?

#

send a request to /users/@ me endpoint

quartz pier
#

Does anyone know how to make a dashboard for a discord bot?

opal plank
#

that should return the avatar url

lucid prawn
#

Can you look at my login.html code

opal plank
#

no need to

#

you already said you got the access_token

#

just touch the /users/@me endpoint with your access_token

lucid prawn
#

Can you check if i did it right

opal plank
#

ugh, ngl, kinda laying in bed rn

#

mouse far away

lucid prawn
#

Ok

#

I will post it here

umbral zealot
#

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

lucid prawn
#
<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>
opal plank
#

sends anwayay

umbral zealot
#

Or are you not at all using index.js

lucid prawn
#

Im not using index.js i just did </script>

umbral zealot
#

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

lucid prawn
#

Ok

brave tendon
umbral zealot
#

Awesomeness!

opaque acorn
#

client.user.setActivity(actividad, { type: "WATCHING" });
^

TypeError: Cannot read property 'setActivity' of undefined

drifting wedge
#
 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

sudden geyser
#

You probably aren't running a version of Python supporting async/await.

opaque acorn
#

somebody?

#

client.user.setActivity(actividad, { type: "WATCHING" });
^

TypeError: Cannot read property 'setActivity' of undefined

umbral zealot
#

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.

opaque acorn
#

` 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"
}; `

umbral zealot
#

How and when are you calling this code?

opaque acorn
#

ready.js

#

on events

umbral zealot
#

And this is the whole file?

opaque acorn
#

ye

umbral zealot
#

Hmm.

#

Show me your code that loads your events

#

In your index

opaque acorn
#

['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))

}

umbral zealot
#

You added Discord here

#

That broke it.

#

Remove that Discord var from there

drifting wedge
#
 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?
umbral zealot
#

If you need something from the Discord library, import it in the file you're using it in

opaque acorn
umbral zealot
opaque acorn
#

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?

thin echo
#
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

slender thistle
dusky sundial
drifting wedge
#

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

slender thistle
#

It will run every X seconds/minutes in the background as opposed to your blocking while True: which won't exactly work well

drifting wedge
#

not time