#development

1 messages · Page 1627 of 1

lament rock
#

Okay. Just want it to show a return type for what the user inputs

viscid gale
#

im now seeing this.. seems fun

onyx hare
#

How Do I Redo This, Im Trying To Log When The Command Is Used, It Logs The Guilds Yes, But It Logs All of Em At Once Even If The Command Came From One Server

exports.run = (client, message, args,) => {
    let channel = message.mentions.channels.first();
        let announcement = args.slice(1).join(" ");
        channel.send(announcement);
        client.guilds.cache.forEach(guild => {
            console.log(`${announcement} Has Been Said In ${guild.name} | ${guild.id} By ${message.author.username}`);
          })
    message.delete({timeout:10});
earnest phoenix
lament rock
earnest phoenix
#

Hmm, let's see

lament rock
#

oh nvm. That would be a literal object with a property P

#

This is jank

#

{ [P[keyof P]]: V }

#

I'm just throwing shit out there

#

let me actually sit at my desk and code

viscid gale
#

they will begin running almost at the same time.. if you wait for the async to finish, then do the then.. they change dramatically.. so may I ask why you make them run when the other is running?

earnest phoenix
#

@lament rock

lament rock
#

Yeah. That's what I thought. Trying something

opaque seal
#

What does the customisable behaviour tag mean?

fluid basin
#

@viscid gale use this

modest maple
#

what are we using this for 👀

#

I can never recommend using that code

viscid gale
#

ik bru ik

#

the mere thing that i'd be using that many promises would be insanely off

#

it's called experimenting

#

and thanks btw u guys

modest maple
#

experimenting with what?

viscid gale
#

when u were little, didnt u race paper boats down the drain to see which was faster? u weren't applying it in anything but u were doing it for fun

#

same thing different context i guess

umbral igloo
#

I feel like my question was drowned out in this discussion. Does anyone know how to access the bot's client? I've tried initializing it like it shows in the discord.js documentation, but when I try to do, ie.```js
const BaseCommand = require('../../utils/structures/BaseCommand');
const Discord = require(discord.js);
const Client = new Discord.Client();

const config = require(../../../slappey.json);

Client.login(config.token);

module.exports = class ChannelsCommand extends BaseCommand {
constructor() {
super(channels, utility, []);
}

async run(client, message, args) {
try {
const listedChannels = [];
const Guild = await client.guilds.fetch("guild_key_here");
Guild.channels.cache.forEach(channel => {
if(channel.permissionsFor(Client).has('VIEW_CHANNEL')) listedChannels.push(channel.name);
});
message.channel.send(You have access to: ${listedChannels.join(', ')});
} catch (err) {
console.log(err);
}
}
}
it gives this error:txt
TypeError: Cannot read property 'has' of null

#

So I fear that the client isn't actually initialized.

wise coral
#

I don't know if it's development question but how to make new bot? 5k people has bot developer role. :/

fiery field
#

well anyway

#

idk if you have heard of it but the bot is called

#

yukari

#

and there is nothing about in on the discord bot page so doing it manually is the only way

dusky sundial
umbral igloo
#

Am I asking a common question here?

umbral zealot
#

async run(client, message, args) { <--- is this client not sufficient?

umbral igloo
umbral igloo
umbral zealot
#

What I mean is, ```
const Discord = require(discord.js);
const Client = new Discord.Client();
const config = require(../../../slappey.json);
Client.login(config.token);

Remove all those lines. They do not belong here in this command code.
#

Now, whether the client is actually available in this file depends on how that command is called

#

as in, how is command.run() being called from your message handler.

umbral igloo
#
const BaseEvent = require('../../utils/structures/BaseEvent');

module.exports = class MessageEvent extends BaseEvent {
  constructor() {
    super('message');
  }
  
  async run(client, message) {
    if (message.author.bot) return;
    if (message.content.startsWith(client.prefix)) {
      const [cmdName, ...cmdArgs] = message.content
      .slice(client.prefix.length)
      .trim()
      .split(/\s+/);
      const command = client.commands.get(cmdName);
      if (command) {
        command.run(client, message, cmdArgs);
      }
    }
  }
}
umbral zealot
#

well that should be fine then, assuming client.prefix isn't causing an error the rest should be fine

#

So now, what is the actual issue in your command trying to access the client?

#

what issue were you trying to solve?

umbral igloo
#

Accessing its permissions.

umbral zealot
#

the permission of what?

#

client doesn't have permissions

umbral igloo
#

the ```js
if(channel.permissionsFor(client).has(VIEW_CHANNEL))

#

It doesn't?

#

Then maybe I'm confused on what a client is.

umbral zealot
#

no, the client is the application itself, not the bot user

#

think of the client exactly like the discord application

#

the discord application is not you, the user, and you are not the application

#

What you're looking for is client.user which is the bot's user object.

umbral igloo
#

ah

umbral igloo
#

thank you

umbral zealot
lament rock
#

@earnest phoenix I tried the best I could to match the return type you had originally planned, but I cannot get it to work.
This is the sample that I got closest to working:

/**
 * @template K
 * @template V
 * @extends Map<K,V>
 */
class Thing extends Map {
    constructor() {
        super()
    }
    /**
     * @template {Array<K>} P
     * @template {P[keyof P]} EoP
     * @param {P} keys
     * @returns {{ [typeof EoP]: boolean }}
     */
    deleteMany(...keys) {
        return keys.map(key => ({
            [key]: this.delete(key)
        }));
    }
}

However, I don't think you can do this unless there was a keyword which gets only entries of an Array

umbral igloo
#

Another thing I've noticed when looking at say, StackOverflow / Reddit, is that people use a different method```js
const Client = new Discord.Client();

Client.on(message, ...

umbral zealot
#

It's mostly a question of preference

copper cradle
#

it's the same

#

don't worry

umbral zealot
#

There's always more than one way to skin a cat, when it comes to programming.

skinCat(cat);
const Cat = require('./cat')
const cat = new Cat.skinned();
const cat2 = new Cat();
cat2.skin();
umbral igloo
#

I see.

#

So it's just two different approaches.

umbral zealot
#

yes

copper cradle
#

you should rename your Client variable to client just to follow js conventions

umbral igloo
#

Yeah, it was just an example. I had it capitalized originally to differentiate between the client var in the async run(client, ... line, only to find out that client is the bot client.

#

Thanks for your help guys, I'll probably be back lol.

earnest phoenix
lament rock
cinder patio
#

Extra comma

crimson vapor
#

I thought trailing commas were ok

cinder patio
#

Not in json

crimson vapor
#

ah

#

right

cinder patio
#

It's after the last element in the array

#

You removed it

#

did you save the file?

charred geyser
#

Is anyone familiar with bulk fetching and deleting message history by message content (if its even possible). Not too bothered about the lib but preferably JDA or discord.js

cinder patio
#

The only way to do is
fetch 100 messages -> loop through each one of them, checking if the content matches -> delete matches

charred geyser
#

alright, thats the only thing i could think of

#

thanks anyway

#

👍

#

oh, well… is there any simple way of looping through 100 and then the next 100

#

or would i just have to like store the last message id and then just fetch 100 from after that message or something

cinder patio
#

not sure if discord.js stores that automatically

nimble kiln
charred geyser
#

alright

#

ty

stone quest
#

Guys, how could i add a altprefix? I know it is possible but I have no clue how to do it, google is also not helping

#
final long guildId = event.getGuild().getIdLong();
String prefix = Config.get("PREFIX");
String raw = event.getMessage().getContentRaw();

if (raw.startsWith(prefix)) {
    manager.handle(event, prefix);
}

#

this is my prefix code, takes the prefix from the .env

crimson vapor
#

what language is this?

slender thistle
#

Is this JDA

crimson vapor
#

I didn't know that JDA worked with .env

cinder patio
#

What does .env have to do with any programming language tho bloblul

stone quest
#

It indeed works

slender thistle
#

You want a dictionary attached to your client object

crimson vapor
#

idk I thought it was just some javascript thing

slender thistle
#

where the key is the guild ID and the value is the prefix

#

For saving yes, for fetching I personally prefer to pulling from database on bot start and then working with cache only

crimson vapor
#

I only cache prefixes for like 15 minutes

#

no point to have a big boi map if you don't use it

slender thistle
#

shrug

#

I haven't worked with projects big enough to worry about that

#

kekw

cinder patio
#

same shiv 😩

stone quest
old cliff
#

how do I upload to a custom sharex server ? I have made one

cinder patio
#

upload... where?

#

you need to host it

earnest phoenix
#

how would i make something like this work?

slender thistle
#

Comma after displayName

#

no

latent heron
crimson vapor
#

assuming you have it hosted, you make a new custom uploader with the correct upload path and method, ex. POST and https://pyrocdn.com/upload and set the correct headers/body ex. key | MY_SPECIAL_KEY

slender thistle
#

use concatenation

latent heron
#

AHA

slender thistle
#

or template strings

crimson vapor
#

its all preference but template strings make it easier with spacing

earnest phoenix
slender thistle
#

Looks prettier also

slender thistle
crimson vapor
#

${msg.member.displayName} loved someone! vs msg.member.displayName + ' loved someone!'

earnest phoenix
#

something like that?

modest maple
#

👀 does that make any sense to you

earnest phoenix
#

sorry im new to coding

earnest phoenix
slender thistle
#

You want one big string

#

Yours will only create loved someone!

#

You enter stuff in {} INSIDE the backticks as a placeholder

crimson vapor
#

actually it will create Unexpected token: $

slender thistle
#

I'm not explaining that shit

slender thistle
#

They will be essentially replaced with actual values

earnest phoenix
#

but do you mean like this:

#
.setTitle(`${msg.member.displayName} loved someone!`)
slender thistle
#

Try it

earnest phoenix
#

and it didn't work.

sage bobcat
#

One message removed from a suspended account.

slender thistle
#

Are you sure you saved your file and that the error isn't coming from somewhere else

earnest phoenix
#

only when i tried the command tho

slender thistle
#

Nodejs experts can come out now

#

My knowledge faces a dead end here

cinder patio
#

show the full error

earnest phoenix
# cinder patio show the full error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! universe@1.7.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the universe@1.7.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#

only pops in console when i try the command

#

all other commands work

cinder patio
#

Is there more to the error or is that all

earnest phoenix
#

and it only pops up when i try the command

tired panther
#

Something in your script is broken or causing problems

earnest phoenix
#

and when i remove ${msg.member.displayName} thats when the error stops

tired panther
earnest phoenix
tired panther
earnest phoenix
tired panther
earnest phoenix
#

so like this

tired panther
#

or of your commnd

earnest phoenix
#
.setTitle(`msg.member.displayName, loved someone!`)
#

^^ is that what i would type?

tired panther
#

you node module folder is probably corrupted, run npm start

earnest phoenix
#

but when i type the command it stops and gives the error

#

this is the code for the command:

#
const Command = require('../Command.js');
const { MessageEmbed } = require('discord.js');

module.exports = class FindIdCommand extends Command {
  constructor(client) {
    super(client, {
       name: 'love',
      usage: 'love <user mention>',
      description: 'Shows how much All About Ishaan loves you!',
      type: client.types.OWNER,
      ownerOnly: true,
      examples: ['love  @♥°•Lexie•°♥']
    });
  }
  run(message, args) {
    const target = this.getMemberFromMention(message, args[0])
    if (!target) 
      return this.sendErrorMessage(message, 0, 'Please mention a user, role, or text channel');
    const embed = new MessageEmbed()
      .setTitle(`msg.member.displayName, loved someone!`)
      .addField('He loved:', target,)
      .addField('I hope he loves you forever! I am wishing you a wonderful day!', target,)
      .setImage('http://38.media.tumblr.com/9204649fd84d3df7223feb6712a89444/tumblr_n8pc8badUs1sg0ygjo1_500.gif')
      .setFooter(message.member.displayName,  message.author.displayAvatarURL({ dynamic: true }))
      .setTimestamp()
      .setColor(message.guild.me.displayHexColor);
    message.channel.send(embed);
  }
};
tired panther
#
npm cache clean --force
rm -rf node_modules package-lock.json
npm install
``` it should work again
earnest phoenix
#

or is that wrong

tired panther
#

you are passing "message" and you are trying to access "msg" blobfacepalm

tired panther
tired panther
#

yes

earnest phoenix
#

so this?:

#
     .setTitle(`${message.member.displayName} loved someone!`)
pale vessel
earnest phoenix
onyx hare
#

im having a moment or my bots just dumb, i have color: "darkred", as my embed colour the colour its shwoing is darkblue -=- xD

onyx hare
#

ohh

tired panther
#

use HexColors for customization

pale vessel
#

it does exist DARK_BLUE

#

["DEFAULT", "WHITE", "AQUA", "GREEN", "BLUE", "YELLOW", "PURPLE", "LUMINOUS_VIVID_PINK", "GOLD", "ORANGE", "RED", "GREY", "NAVY", "DARK_AQUA", "DARK_GREEN", "DARK_BLUE", "DARK_PURPLE", "DARK_VIVID_PINK", "DARK_GOLD", "DARK_ORANGE", "DARK_RED", "DARK_GREY", "DARKER_GREY", "LIGHT_GREY", "DARK_NAVY", "BLURPLE", "GREYPLE", "DARK_BUT_NOT_BLACK", "NOT_QUITE_BLACK"]

royal herald
#

dark but not black

tired panther
tired panther
royal herald
#

black but not dark

tired panther
toxic jolt
#

i how to fix this pls help guys

#

im using shard

#

one shard is online but other any shard is dont online

crimson vapor
#

yeah, no errors here

#

looks like you have 4 shards online

#

bruh

#

why?

#

doesn't seem too hard if there is a library for a http server

#

just gotta get the body from the request

stone quest
slender thistle
#

idk how it works in Java

snow niche
#

So I'm creating a meme bot. And when the reaction on the meme reaches 2 (2 for testing purposes) and I the owner of bot send lmao send-meme it should send the meme with 2 reactions. So far with my code it does this correctly.

What I want it to do is if the meme is the same as before it wont send it. How would I do that? I'm using reddit for the memes.

Code:

hot-meme.js (generates meme)
https://gist.github.com/EliteHaxy/bbaee8f36caadac07bc1eb8b696accec

send-meme.js (sends meme to channel)
https://gist.github.com/EliteHaxy/e6d8e414dbd438cf45e122dc69247394

in the future I want it to be automatic where when a reaction reaches the limit (in this case 2) it sends it to the meme channel. Doesn't duplicate the meme though if its the same.

Also side note question how would I say "if something is exported do this"?

in this case when a meme reaches 2 reactions it exports it. I want it to be when it exports it also sends that meme to the channel with no duplicate memes.

latent heron
#

is this like a similar imitation of starboard but for daily memes?

lusty quest
#

define daily limitation? like you cant get the same meme mutiple times in a row or only allow a certain amount of memes per day?

foggy robin
#

is that normal

umbral zealot
#

I mean it's an error, so... no?

lusty quest
#

well if the bot dont have permissions for it

foggy robin
#

how would I fix it

#

oh I got you

lusty quest
#

also the role of the bot has to be above the one you want to give

foggy robin
#

ok

edgy raptor
#

How do you find the Client ID of a bot? I am trying to add Dice Maiden to my server and I need the client ID

near schooner
#

hi everyone

#

how can i get that on my channel

#

help me pls

umbral zealot
median void
#

For the client Id go to your application then bot and it says client Id just copy

umbral zealot
#

If your own bot, not someone else's, of course.

median void
#

Yes

umbral zealot
near schooner
#

i have Dyno

median void
#

That's not yours

near schooner
#

but i dont know how to do that

median void
#

He means one you developee

umbral zealot
#

You mean Dyno already does that?

earnest phoenix
#

what is invite managers id

#

?

near schooner
#

i dont know, i dont know too much english, so it too hard for me

umbral zealot
#

Well, we really can't help you then

near schooner
umbral zealot
#

If you found a bot that does that, just use it

#

maybe ask on that server you captured that video from, ask them what bot they're using?

near schooner
#

@@

earnest phoenix
#

Hi i recently released a bot and bot testers find it really cool.But does somebody have tips how to gain much guilds?

feral aspen
#
(node:15092) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: 
https://docs.atlas.mongodb.com/security-whitelist/
nocturne grove
#
HTTPError [FetchError]: request to https://discordapp.com/api/v7/channels/724379979751882784 failed, reason: getaddrinfo EAI_AGAIN discordapp.com
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 500,
method: 'patch',
path: '/channels/724379979751882784'
}```
Anything I can do about this? I saw people say "update discord.js" but afaik it's just v12
earnest phoenix
feral aspen
#

I literally have my current local IP whitelisted.

#

Not working, yet.

earnest phoenix
#

then do all

lyric mountain
#

except when it becomes spam

feral aspen
lyric mountain
#

he meant whitelist 0.0.0.0

feral aspen
#

Oof.

earnest phoenix
#

yes

feral aspen
#

I'll try now.

lusty quest
#

DONT

#

its like sending an invite to the Darknet for free data to grab

earnest phoenix
lyric mountain
#

well, for testing purposes he can do it without problems

#

to see if issue is regarding ip whitelist

lusty quest
#

but close it, if you are done

lyric mountain
feral aspen
#

It works with everyone, but I literally can't connect to the databsase.

lyric mountain
#

like, if people like your bot, they'll talk good about it

tired panther
#

Is Date.now() everywhere the same?

feral aspen
lusty quest
lyric mountain
lusty quest
earnest phoenix
tired panther
lyric mountain
lusty quest
#

its seconds counted from 1970 onwards

#

so its everywhere the same

tired panther
lyric mountain
#

free will advertising is insanely powerful, just look at how people are capable of cancelling other people

earnest phoenix
#

quite hard to gain guilds if there are paying bad bots

tired panther
earnest phoenix
tired panther
#

PAYWALL

lusty quest
#

you could try auctions, but they went to become way harder with the recent changes

feral aspen
lyric mountain
lusty quest
lyric mountain
#

like, not the 192.168.xxx.xxx

feral aspen
lyric mountain
lusty quest
#

did you have a static or dynamic ip? also like KuuHaKu said the right ip?

feral aspen
#

It used to work like 1 day ago, today it doesn't.

lyric mountain
#

make them fall in love with it

#

eventually you'll start to get advertising from those people

rotund peak
#

hi guys

earnest phoenix
#

okay i will try are they any partnering bots without botlabs.gg

lyric mountain
#

...just be helpful to your users

#

else you'll get a lot of invite-leavers

feral aspen
lyric mountain
#

(people who invite then kick 1 second later)

lyric mountain
#

through cmd?

feral aspen
#

There is a button called Add current IP adress

lyric mountain
#

ah, ok then

lusty quest
#

ive had a guild where idk what they had going on, they just invited my bot 10 times and kicked the bot 9 times

feral aspen
#

but still doesn't work, bruh.

lusty quest
#

did you have a VPN running? like some browsers have one build in

feral aspen
#

Nope.

#

I don't use a VPN.

lusty quest
#

then use one and see if it helps

feral aspen
#

I'm not allowed to use it.

#

We have a fine of using that in our country.

#

ffs.

lusty quest
#

lol

#

rip

feral aspen
#

What can I do?

#

Use 0.0.0.0?

lusty quest
#

i do not recommend it

#

since you have then a point of entry that could get bruteforced

feral aspen
#

What can I do, though?

cinder patio
feral aspen
#
(node:13220) UnhandledPromiseRejectionWarning: MongooseError: Operation `servers.findOne()` buffering timed out after 10000ms
lusty quest
#

yea bcs you are not connected

feral aspen
#

wow.

lusty quest
#

does it work now?

feral aspen
#

I literally edited and pressed save again and the IP changed.

lusty quest
#

gg

feral aspen
#

I did absolutely nothing.

lusty quest
#

the bane of dynamic IPs

feral aspen
#

👏

lusty quest
#

well your ISP did

feral aspen
#

🤷‍♂️

feral aspen
crimson vapor
#

its possible you have so much data it takes too long to index and send?

lusty quest
#

i love my FTTH network tho, i have a semi Static IP bcs its shared with 50 other people in the village, bcs of this the IP changes extremly rarely

lusty quest
#

its like downloading games

crimson vapor
#

im pretty sure I did that once on accident

#

ngl

#

like 100k documents on accident

lusty quest
#

nah

feral aspen
#

Hm.

lusty quest
#

discord used MongoDB when they started, a few 100k documents are nothing

feral aspen
#

50 documents.

#

World record for me! 😂

lusty quest
#

if you run out of Ram you will get some issues (MongoDB stores Keys in Ram)

feral aspen
#

2GB storage*! No worries!

lusty quest
#

tbh this should be fine for most discord bots. like one document is just 1-3kb

#

maybe 5kb if its a larger one

feral aspen
lusty quest
lusty quest
#

the discord API?

nocturne grove
#

require('discord.js').version gives 12.1.1

#

@lusty quest

lusty quest
#

12.1.1 is really old

nocturne grove
#

oh oops 😅
Thank you

obtuse jolt
quartz kindle
#

return, not echo

#

you dont need echo when concatenating

craggy pine
#

echo just prints what's in the " " if I remember correctly.

quartz kindle
#

yes

#

you're already echoing the string you're concatenating

obtuse jolt
#

i see

#

ty

deft lark
#

k

tired panther
#

Does anyone know a solution for this Problem:

  • I have a Date given ==> want to parse it on the timezone ===> and get the timestamp of the time in the timestamp
earnest phoenix
#

just do not do it ,use a parser maybe you will find one on npm.js

tired panther
hollow saddle
tired panther
#
  1. is depreceated
tired panther
slender thistle
#

I mean, do you need to convert to a specific timezone or support multiple?

hollow saddle
#

It is indeed considered "legacy" but still works flawlessly and is continuously widely used. Well yeah it has to convert the time to the timezone. Perhaps I'm confused on what exactly you want?

lusty quest
#

iirc the epoch timestamp is GMT 0 so you could go from it

tired panther
lusty quest
#

why there are only like 24 zones

#

just reference them

tired panther
lyric mountain
tired panther
#

any ressources

lusty quest
lyric mountain
#

timezones are based on hour differences

#

it's basically a 1+1 equation

tired panther
pale vessel
#

read docs 2Head

quartz kindle
tired panther
#

Yes, hard to find, when they are so much stfu lol

lyric mountain
#

I just told u how to calculate

lusty quest
tired panther
lyric mountain
#

just add when it's needed smh

tired panther
fast edge
#

I have a doubt

quartz kindle
lyric mountain
#

it's literally a simple equation

lyric mountain
quartz kindle
#

but the main difference is the whether and when a specific timezone has summer time

lusty quest
fast edge
#

My bot had like 40-41 votes in Feb and still it never showed on the Maine Top.gg page, but I saw many bots being on the main page even with 30 votes and vere not sponsored

lusty quest
#

its possible that they got a place with auctions

fast edge
#

??????

lyric mountain
#

where did u see them?

fast edge
#

the main page

#

home page

lyric mountain
#

no, I mean, WHERE in the main page?

fast edge
#

and they werent sponsored or promoted

tired panther
fast edge
lyric mountain
solemn latch
#

trending new bots is only for new bots

lyric mountain
#

you only stay there for a limited time

#

1 month iirc

solemn latch
#

it can be less than a week in some cases

#

it depends on several things not just votes

quartz kindle
lyric mountain
#

once you're out of there you'll need to compete against the big dudes

#

or buy a tag

fast edge
#

no one wants small bots

#

🥲

river panther
#

^

lyric mountain
#

well, all bots were small once

river panther
#

my bot's name is small

fast edge
#

My bot is ShadeEE

river panther
#

sm0l to be more prcise

#

spel

lyric mountain
#

mine was 30-ish servers a year ago, now it's 1600+ servers

lyric mountain
#

everyone starts from ground

river panther
lyric mountain
lyric mountain
tired panther
lyric mountain
#

help your users

river panther
fast edge
lyric mountain
#

be kind to them

river panther
#

spel

#

mouth*

lyric mountain
tired panther
#

propaganda 3805_ultrafastparrot

fast edge
#

I dont even have friends

#

😦

river panther
fast edge
#

toxic

lyric mountain
#

their servers' members will eventually become curious

#

and ask how it works

river panther
#

exdi

fast edge
#

whenever I show them they kick my a**

lyric mountain
#

well, be kinder then

#

there'll always be toxic users

fast edge
#

My lonely bot lol

lyric mountain
#

just start small, don't try to shove a banana down their throats

fast edge
#

true

river panther
#

idiom

#

all i can think of is deepthroating

fast edge
#

what is deepthroating

lyric mountain
#

oh my

river panther
#

its like you use a stick to clean your throat

fast edge
#

oo

#

but cant we just gargle it out

lyric mountain
#

just...let's drop that convo

tired panther
#

lol

river panther
#

eh, ok

lyric mountain
#

but my point is: don't force ads

#

people hate forced ads

fast edge
#

oo

#

Like

#

Add my bot

lyric mountain
#

look at youtube premium or Raid: Shadow Legends™️

fast edge
#

add it pls

#

lol

#

@lyric mountain Would you like to try ma bot

lyric mountain
#

no

river panther
#

rude

lyric mountain
#

see? that's forced ads

#

don't ask for them to add

fast edge
#

:0

lyric mountain
#

just become friends with your potential users

#

then slowly talk about the bot

fast edge
#

noice

lyric mountain
#

don't simply run over them with a car

fast edge
tired panther
#

My Nitro expires in 9 Minutes ablobsob

lyric mountain
#

be patient, don't expect more than 5 servers per week at the start

fast edge
#

sED

lyric mountain
#

eventually it'll speed up

fast edge
fast edge
tired panther
river panther
#

my bot is in only 86 servers

fast edge
river panther
#

ofc yes

fast edge
#

Can I try it out?//

lyric mountain
river panther
lyric mountain
#

well, I mean, some bots do go from 0 to 100 real quick after it gets into motion

fast edge
lyric mountain
#

not here btw

river panther
#

but i am turning it off right now, the link to add it is in my rpc

fast edge
#

yea

river panther
fast edge
#

ook

lyric mountain
#

actually....

#

that's a selfbot thing ain't it?

#

I mean, the rpc buttons

fast edge
river panther
#

yes

#

seb is love

fast edge
#

Hello Fello Seb stan

craggy pine
#

It isn't a selfbot thing. Ik erwin does it using something

river panther
lyric mountain
#

wonder how

fast edge
river panther
#

its legal

river panther
fast edge
#

its dope

craggy pine
#

SDK? I think lemmy check

river panther
#

yes indeed

#

something

fast edge
#

Your bot is nice

tired panther
#

DISCORD RPC

river panther
#

hank you

tired panther
river panther
#

oh yes

#

exdidididididididididididididi

tired panther
river panther
#

ik

fast edge
#

I j ust realized

#

I also have an RPC

river panther
#

oh nice

#

@fast edge you can play with the bot tomorrow? may i turn it off?

#

i need to go through the bugs and stuff

river panther
#

ok, bai, ttyl

fast edge
#

😭 my luck is bad

#

BB

river panther
#

oak bai

cinder patio
fast edge
tired panther
#

my nitro expired

#

sorry I am one minute to late lol

cinder patio
#

bruh

#

it's for a website

mental maple
#

Hi, could someone help me with writing and reading a JSON file? I want to periodically access it and store server preferences in it, but I'm having a lot of trouble (doesn't seem like there's too much comprehensible info about it online). If there's a better way to do it please let me know.

tired panther
#

black white lol

cinder patio
#

sqlite3, mongodb, postgresql are all great choices

mental maple
#

Thanks, will look into it

cinder patio
#

And if you are just starting out you can try out quick.db

#

which makes it way easier

#

but it's very limiting

cinder patio
#

I want it to be a button, to show if the user is banned, for example it would be not filled if the user isn't banned, and when an admin clicks on the hammer, it fills

#

there isn't a non-filled hammer 😢

mental maple
#

Edit it in photoshop

cinder patio
#

it's an icon not an image

#

svg

lyric mountain
#

button for what? a site?

mental maple
#

Ah

cinder patio
#

yeah

lyric mountain
boreal iron
lyric mountain
boreal iron
#

Is free to use

cinder patio
#

I'll change the color to white I guess

#

wait I can't that'll mess up my themes

#

I guess I'll use the bootstrap icon lmao

rancid notch
#

I really wanted my bot to be verified, but there was a problem where I coded it.

lyric mountain
#

see? perfect

rancid notch
lyric mountain
#

you need to add a padding of -1 because of line width

cinder patio
#

thanks

lyric mountain
#

when you need to fill it, just change fill="none" to black

#

or whatever color u need

lyric mountain
rancid notch
crimson vapor
#

I code them in bootghost

lyric mountain
#

tldr: any text editor

#

there's no visual drag 'n drop builder

crimson vapor
#

I prefer nano

lyric mountain
#

you need to code

crimson vapor
#

but you do you

cinder patio
#

I buy my boots, I don't make em

crimson vapor
#

you're missing out

quartz kindle
#

can confirm, google buys them from me

crimson vapor
#

Tim made GoogleFeud's boots?

toxic jolt
#

pls help :c

earnest phoenix
#

@dusk scarab

#

over here

dusk scarab
#

ah

#

thank you

#

henlo peeples of development peoplesing peoples

#

yes im very good at saying hi

#

So im getting an error with my warning system

#

and idek why

#

i have the error as well as all the warning commands, the warning model, main.js and message.js in here

#

if someone is able to help it would be greatly appreciated

crisp geyser
#

Hi! Does anyone know if <message>.awaitReactions() is supossed to work on direct messages? My function works perfectly on a text channel but its filter does not receive any reaction if done in DMs.

solemn latch
solemn latch
solemn latch
# dusk scarab wdym

if your not exporting any schema then your not using anything related to mongoose, so mongoose methods dont work

dusk scarab
#

lemme fix that

#

ill come back if i need more help

solemn latch
#
//creating and exporting user schema
const mongoose = require('mongoose');
const UserSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true
    },
    otherproperties: {
        type: String
    }
});
const User = mongoose.model('User', UserSchema);

module.exports = User;
// using the User schema in another file
const User = require("../models/user.js");
User.somemongooseschemamethod;
#

just as an example.

dusk scarab
#

thanks

#

im about to run it and see if it works

#

@solemn latch yeah i wasnt able to fix it

#

ill send my new warns.js

#
const db = require('../models/warns')
const { Message, MessageEmbed } = require('discord.js')
const { Mongoose } = require('mongoose')
const mongoose = require(`mongoose`)

let Schema = new mongoose.Schema({
    guildid: String,
    user: String,
    content: Array
})
const warnschema = mongoose.model("warnschema", Schema)
module.exports = warnschema;


module.exports = {
    name :'warns',
    async execute(client, message, args){
        if(!message.member.roles.cache.has('808043455255150612')) return message.channel.send('You do not have permissions to use this command.')
        const user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
        if(!user) return message.channel.send('User not found.')
        const reason = args.slice(1).join(" ")
        db.findOne({ guildid: message.guild.id, user: user.user.id}, async(err, data) => {
            if(err) throw err;
            if(data) {
                message.channel.send(new MessageEmbed()
                    .setTitle(`${user.user.tag}'s warns`)
                    .setDescription(
                        data.content.map(
                            (w, i) => 
                            `\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.moderator).user.tag}\nReason : ${w.reason}`
                        )
                    )
                    .setColor("RED")
                )
            } else {
                message.channel.send('User has no warns')
            }

        })
    }
}
crisp geyser
solemn latch
dusk scarab
#

i mean in my other commands i had the const db = require('../models/warns`)

solemn latch
#

if you delete your usage of db in warns.js your other files will probably start erroring

dusk scarab
solemn latch
#

which is whats erroring

dusk scarab
#

so... I shouldnt use db in my warns.js?

solemn latch
#

I didnt say that.

dusk scarab
#

sry btw im new to the whole mongodb thing

solemn latch
#

I think your error is because your '../models/warns' is setup incorrectly

dusk scarab
#

huh

#

ok lemme check

#

so the ../ would bring it into the main directory

#

then its in the models folder

#

then it navigates to the warns.js folder

#

do I have to include the .js?

solemn latch
#

yes...

dusk scarab
#

ok ill try

#

honestly i knew it would be something dumb

#

ill try it

dusk scarab
solemn latch
#

whats the file look like?

dusk scarab
#

which file?

#

warns file?

solemn latch
#

the warns model file

dusk scarab
#
const db = require('../models/warns.js')
const { Message, MessageEmbed } = require('discord.js')
const { Mongoose } = require('mongoose')
const mongoose = require(`mongoose`)

let Schema = new mongoose.Schema({
    guildid: String,
    user: String,
    content: Array
})


module.exports = {
    name :'warns',
    async execute(client, message, args){
        if(!message.member.roles.cache.has('808043455255150612')) return message.channel.send('You do not have permissions to use this command.')
        const user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
        if(!user) return message.channel.send('User not found.')
        const reason = args.slice(1).join(" ")
        db.findOne({ guildid: message.guild.id, user: user.user.id}, async(err, data) => {
            if(err) throw err;
            if(data) {
                message.channel.send(new MessageEmbed()
                    .setTitle(`${user.user.tag}'s warns`)
                    .setDescription(
                        data.content.map(
                            (w, i) => 
                            `\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.moderator).user.tag}\nReason : ${w.reason}`
                        )
                    )
                    .setColor("RED")
                )
            } else {
                message.channel.send('User has no warns')
            }

        })
    }
}
solemn latch
#

not the command

#

the model

dusk scarab
#

this is the model file

#

the tutorial i watched didnt have two different ones

solemn latch
#

thats a yikes

#

so wheres your commands folder located?

dusk scarab
#

in the main directory

solemn latch
#

so you have two commands folders?

dusk scarab
#

no

#

wait

solemn latch
#

so theres nothing at /models/?

dusk scarab
#

i need to try something

dusk scarab
#

is

solemn latch
#

whats there

dusk scarab
#

profileSchema.js (economy system)
and warns.js

lyric mountain
#

TIL ncevm only supports JDK 11 and below

solemn latch
lyric mountain
#

😔

dusk scarab
solemn latch
#

I think whatever source your using for this is configured differently than what you have setup.

#

which means its really no use to you

#

you should setup mongoose and your commands seperately

dusk scarab
#

ok

#

ill try messing around with it

solemn latch
#

your /models/warns.js should look something like this

//creating and exporting user schema
const mongoose = require('mongoose');
const UserSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true
    },
    otherproperties: {
        type: String
    }
});
const User = mongoose.model('User', UserSchema);

module.exports = User;

except warns, not a user.

#

nothing involving the command goes there.

dusk scarab
#

oh

#

man im dumb

#

thanks a lot tho dude

#

i shall tryeth this

#

im pleased to announce it finally works

#

thanks a lot 😛

solemn latch
#

np

jovial nexus
#

How can i fix this FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

lament rock
#

Allocate more memory to your node process or look into what's taking all that memory in the first place and fix it

jovial nexus
#

And how do i allocate more mem?

lament rock
#

Idk. Google has an answer somewhere

jovial nexus
#

just adding --max-old-space-size=8192 ans start script

lament rock
#

Pretty sure it has a max of 1GB by default on x64 architectures. Or I might be wrong

#

max old space is how much space is allocated to a specific region of the garbage collection process

#

but might work

jovial nexus
#

it worked

#

and still crashes lol

lament rock
#

You might have a memory leak somewhere

jovial nexus
#

yeah

#

nah now it worked

cinder patio
#

no there's definitely something wrong with your code

#

think of this as a temporary solution

jovial nexus
#

man im trying to mine a crypto currency i just programmed i dont need a fix lol

dusk scarab
#

if you want, you can get Opera GX and limit the RAM usage to like 1 GB or less so that it runs fine without taking up all ur memory

jovial nexus
#

im not using internet for this

onyx hare
#

The embed failed to send the support server as a hyperlinked word this is the first time ive had this problem


const Discord = require('discord.js')

exports.run = async (client, message, args) => {
    message.react(':runit:');
    
    var HELP = new Discord.MessageEmbed()
    .setTitle("Help:")
    .setDescription("To View My Commands Use c2 Commands")
    .addField("Support","If You Are Having Any Trouble You Will Have To Visit Our Community Server [Mos Eisley Cantina](https:discord.gg/F86Drtz)")
    .addField("OFFLINE","If You Have Seen Me Offline, I Am Updating To Be Notified Of Downtime/Updates Visit [Mos Eisley Cantina](https:discord.gg/F86Drtz)")
    .setColor("0x#FF0000")
    
    message.author.send(HELP)
};

vivid fulcrum
#

the url in your hyperlink is not a valid url

onyx hare
#

oh i now see i forgot he //

vivid fulcrum
#

yup

misty sigil
#

only reasons for downtime are updates

onyx hare
#

not all the time, ive had powercuts during updates that have caused unwanted downtime

earnest phoenix
#

Hi guys

#

Does somebody know if it's possible to clear errors on express-validator

#

i mean when i refresh the page

#

i still got the error

wide wharf
#

RIP. My script has 1234 lines... how to use multiple .js files??
(please don't tell me to read discordjs docs they doesn't explain that good)

boreal iron
#

They actually do.

polar abyss
#

Sup

boreal iron
#

Use the inbuilt command handler just by adding a few more lines.

wide wharf
misty sigil
#

you can use modules

wide wharf
#

but how

#

and I got an error >:C

:/home/container$ npm i && npm start
npm ERR! code EJSONPARSE
npm ERR! file /home/container/package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 499 while parsing '{
npm ERR! JSON.parse   "name": "Clyde",
npm ERR! JSON.parse   "version": "1.0.0'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/container/.npm/_logs/2021-03-03T20_59_16_013Z-debug.log
container@pterodactyl~ Server marked as offline...


[Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon]: Exit code: 1
[Pterodactyl Daemon]: Out of memory: false
[Pterodactyl Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
#

anyone?^

misty sigil
#

well

wide wharf
#

I can send whole script on pastebin if you want me to

boreal iron
# wide wharf but how

Docs are answering this with script examples.
Use exports to split up your commands, classes etc., throw them into a directory, find and load files using filesync and add the loaded content to the existing command handler.

misty sigil
#

file1.js

module.exports = {
  string: "test",
  number: 2,
  boolean: false,
  array: ["pog", "gers"],
  object: {pog: true},
  function: () => {
    return true;
  }
}```

file2.js 
```js
module.exports = (a, b) => {
  return a + b;
}

main.js

const m = require('./file1.js')
console.log(m.function()) // true
console.log(m.string) // test
const add = require('./file2.js')
console.log(add(1, 1)) // 2
#

fuckin hell that was a lot

wide wharf
#

holy

boreal iron
#

Might be a solution to include a few collections of classes but not to include lots of files.

misty sigil
#

bad package.json

wide wharf
wide wharf
misty sigil
#

it’s not that hard....

harsh blade
#

TypeError: Cannot read property 'roles' of null

client.on("message", message => {
  if (message.author.id === client.user.id) return;
  if (!message.member.roles.cache.has("765885271861624843")) return;
  var noWords = JSON.parse(fs.readFileSync("./antiping.json"));
  var msg = message.content.toLowerCase();
  for (let i = 0; i < noWords["antiping"].length; i++) {
    if (msg.includes(noWords["antiping"][i])) {
      message.delete()
      let embed = new Discord.MessageEmbed()
        .setTitle("Please dont ping staff!")
        .setURL("https://client.dynamichost.xyz")
        .setColor("#ff2e2e")
        .setDescription("We can be really busy sometimes. \n Being at school or doing work... \n We do see your messages so please be patient. \n Dont ping staff without permission.")
        .setFooter("Regards - DynamicHost")
        .setImage("")
        .setThumbnail("https://cdn.discordapp.com/attachments/765885272420253706/799597747153010728/gnome_V2.png")
      return message.channel.send({ embed });
    }
  }
});
#

eh?

boreal iron
#

Why would you even bother with it if you have no clue?

wide wharf
# misty sigil bad package.json
{
  "name": "Clyde",
  "version": "1.0.0",
  "description": "aka ModBot",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node 1index.js",
    "lint": "eslint ."
  },
  "keywords": [],
  "author": "IsmailZ",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^12.4.0",
    "dotenv": "^8.2.0",
    "chalk": "^4.1.0",
    "google": "2.1.0",
    "google-translate-api": "2.3.0",
    "weather-js": "2.0.0",
    "ffmpeg": "0.0.4"
    "ms": "2.1.3"
  }
}
wide wharf
misty sigil
#

it’s not hard

boreal iron
#

Imagine working with PHP frameworks especially for remote protocols with a few tousend lines of code

crimson vapor
earnest phoenix
#

thoughts on adding this error to my bot?

#

❌ | Invalid syntax:purge [amount to search] [options] ^^^^^^^^^^^^^^^^^^ Must be a numerical amount.

wide wharf
pale vessel
harsh blade
#

TypeError: Cannot read property 'roles' of null
at Client.<anonymous> (/home/container/src/index.js:288:22)
at Client.emit (events.js:326:22)
Any ideas?

misty sigil
#

message.member is null

#

it’s not that hard

lament rock
#

Client.<anonymous> nice

harsh blade
#
client.on("message", message => {
  if (message.author.id === client.user.id) return;
  if (message.member.roles.cache.has("765885271861624843")) return;
  var noWords = JSON.parse(fs.readFileSync("./antiping.json"));
  var msg = message.content.toLowerCase();
  for (let i = 0; i < noWords["antiping"].length; i++) {
    if (msg.includes(noWords["antiping"][i])) {
      message.delete()
      let embed = new Discord.MessageEmbed()
        .setTitle("Please dont ping staff!")
        .setURL("https://client.dynamichost.xyz")
        .setColor("#ff2e2e")
        .setDescription("We can be really busy sometimes. \n Being at school or doing work... \n We do see your messages so please be patient. \n Dont ping staff without permission.")
        .setFooter("Regards - DynamicHost")
        .setImage("")
        .setThumbnail("https://cdn.discordapp.com/attachments/765885272420253706/799597747153010728/gnome_V2.png")
      return message.channel.send({ embed });
    }
  }
});

Thats my code

misty sigil
#

I’ve already told you the problem

lament rock
#

You're trying to access a member's roles in a DM which is not correct

harsh blade
#

how do i make it "Not null"

misty sigil
#

by running it somewhere that has members

harsh blade
#

its working just fine without this line
if (message.member.roles.cache.has("765885271861624843")) return;

misty sigil
#

yes because member is null

harsh blade
#

Eh ok ty

misty sigil
#

oh god free hosting

harsh blade
#

mb the problem is that the code is in index.js

#

cuz im lazy

earnest phoenix
#

idk

#

or you want to use it for dm

#

nvm

errant perch
#

at what point does autoSharding decide to shard?

earnest phoenix
#

i realised that ur trying to check a role

errant perch
#

like how many shards per server

earnest phoenix
#

so nvm

#

=))

wide wharf
#
/home/container/1index.js:1234
        client.channels.get('698983333782093925').send('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: @' + message.member.user.tag + ' \nMessage: ' + message.content)});
                        ^

TypeError: client.channels.get is not a function
    at Client.<anonymous> (/home/container/1index.js:1234:18)
    at Client.emit (events.js:326:22)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:825:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Clyde@1.0.0 start: `node 1index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Clyde@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/container/.npm/_logs/2021-03-03T21_22_44_632Z-debug.log
```Another ERROR... :C
misty sigil
#

client.channels.cache.get

earnest phoenix
#

discord js v12?

wide wharf
earnest phoenix
#

=))

wide wharf
# misty sigil client.channels.cache.get
(node:38) UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
    at notActive (/home/container/1index.js:784:34)
    at Client.<anonymous> (/home/container/1index.js:782:14)
    at Client.emit (events.js:326:22)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
(node:38) 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:38) [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.
misty sigil
#

What old ass code you copying from

earnest phoenix
#

MessageEmbed

errant perch
#

fr

#

do MessageEmbed

wide wharf
#

k not fully my own tbh

errant perch
#

if you are trying to fetch channels do

#
client.channels.fetch(id).then(channel => {channel.send("message")})
wide wharf
#

an edit of my friend's code xD

errant perch
#

it'll work

#

it doesn't require channel cache

wide wharf
# errant perch ```js client.channels.fetch(id).then(channel => {channel.send("message")}) ```
client.on('message', message => {
    if (!message.guild) return; //No DM Messages Allowed!
    if(message.channel.id === "630405908715012150") return; //FG (avoid spam logs)
    if(message.guild.id === "264445053596991498") return; //Top.gg (too many msg)
    client.channels.cache.get('772767304072429588').send('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: @' + message.member.user.tag + ' \nMessage: ' + message.content)});
``` how to?
pale vessel
errant perch
#

it should work if the bot can access the channel

earnest phoenix
#

yep

harsh blade
#

How do i check if someone has a specific role

earnest phoenix
#

1 sec

harsh blade
#

ty

earnest phoenix
#

u manage how to get the member

#

hope it helps

#

:}

boreal iron
#

Just use has()

#

if (<guild_member>.roles.cache.has(role.id))

solemn latch
#

isnt it roles.cache.has?

harsh blade
#

did u make a typo?

#

TypeError: Cannot read property '_roles' of null

boreal iron
#

He doesn’t wanna know if the role exists

lament rock
#

message.member is null in DM channels

harsh blade
#

i just want to make it so that the bot ignores messages from staff role

solemn latch
#

in server right?

harsh blade
#

Yeah

#

any msg sent by staff

earnest phoenix
#

pls

harsh blade
#

how 😭

#

never played around w role detection

#

only in custom commands

boreal iron
#

Scroll up, told you already

lament rock
#

You can chain conditionals btw

#

if (message.member && message.member.roles.cache.has(id)) return

harsh blade
#

@harsh blade

#

:0

#

nvm

#

wrong server

#

ffs

#

im so stupid sorry

boreal iron
#

weird development channel moments

harsh blade
#

im running of decaff coffee rn 😭

earnest phoenix
#

just

#

console.log(message.member)

#

that s it

#

put that in your command or message event

#

idk

boreal iron
#

Who are you answering? Seems to be out of context...

harsh blade
earnest phoenix
#

if u can

earnest phoenix
harsh blade
earnest phoenix
#

and

#

if u do

#

console.log(message.member._roles)

#

do you get [ '765885271861624845', '776774885149507615' ]?

harsh blade
#

yeah

boreal iron
harsh blade
#

is it supposed 2b gray?

earnest phoenix
#

replace

pale vessel
#

IDs are strings

earnest phoenix
#

<guild_member>

#

with message.member

#

and

#

done

pale vessel
#

Make the ID a string

earnest phoenix
#

oh

pale vessel
#

cache.has() takes string for key

earnest phoenix
#

i didn't saw that

#

put the id in "" :))

pale vessel
#

and like Papi said, check that message.member exists since it's null in DMs

earnest phoenix
#

like this ("123456789012345678")

harsh blade
#

aand it just crashed

#

`if (message.member.roles.cache.has("765885271861624843"));
^

TypeError: Cannot read property 'roles' of null`

#

Sorry to bother yall w this

earnest phoenix
#

np

boreal iron
#

if(); wtf

harsh blade
pale vessel
#

if (newMessage) dontRead();

boreal iron
#

If the statement is true just do something or return

#

It’s getting worse.

harsh blade
harsh blade
earnest phoenix
harsh blade
#

ahhhhhhhh

#

bruh

earnest phoenix
#

and replace 4th line

#

with 2

#

to be like this

harsh blade
#

Awesome!

#

oh wait what

#

if (message.member.roles.cache.has("765885271861624843"));
^

TypeError: Cannot read property 'roles' of null

earnest phoenix
#
if(message.member && message.member.roles.cache.has("123456789012345678")){
  console.log("test")
}
harsh blade
#

but it was just working

earnest phoenix
#

me too

umbral zealot
#

maybe you restarted your bot and the member isn't cached anymore.

#

you need to fetch members that aren't cached.

boreal iron
#

Sorry without knowing the basics of JS getting help is impossible

coral cave
#

Yeah. I suggest starting off with WOK (Worn off keys) or MenuDocs

#

Both are great to get you started on fundementals

harsh blade
#

i am constantly learning...

umbral zealot
#

message.guild.members.fetch(message.author.id) can help here - but you need to await it since it's a promise.

harsh blade
#

im taking courses all the time

earnest phoenix
#

u can log _roles

#

so i don't think that's the problem

coral cave
#

I mean that's the only 2 I can think of

umbral zealot
#

TypeError: Cannot read property 'roles' of null cannot happen if message.member is defined as anything

#

so there's a confusion here on someone's part.

coral cave
#

Right

umbral zealot
#

This isn't about the role ID

#

this is literally about message.member being null.

coral cave
#

Well I just joined in so I'm in need of a little backing up here lol.

umbral zealot
#

Now, there's 2 reasons for this:

  1. it's not cached
  2. this is a DM.
coral cave
#

Right

earnest phoenix
#

and got it all

umbral zealot
#

Right, maybe it was fetched at one point when he logged it

harsh blade
#

it was working

#

for a second

umbral zealot
#

Right, but restarting means the member is now uncached.

#

So make sure to fetch it.

coral cave
#

Right

umbral zealot
#
if(!message.member) await message.guild.members.fetch(message.author.id);

There. that should fix it (assuming the function is async)

coral cave
#

Yeah if you have a command handler in the callback part of the exports just add async infront of it

earnest phoenix
umbral zealot
earnest phoenix
#

cuz i saw u didn't had it

#

to be like that client.on("message", async message => {

harsh blade
umbral zealot
#

no.

coral cave
#

It doesn't matter

earnest phoenix
pale vessel
earnest phoenix
#

but u can keep it in 1 line

coral cave
#

Right

umbral zealot
#

but it's certainly a step in the right direction 😄

pale vessel
#

it probably works, assuming that message.member is a getter

umbral zealot
#

But I remember discord.js re-assigning the collection on guild.members.fetch() so maybe it'll be automatic. maybe.

#

¯_(ツ)_/¯

wise umbra
#

Tried installing color-thief on windows, but it errors out for some reason..... 🤔

#

nvm the error explains what i need to do.. lemme try

harsh blade
#

Seems to be working

umbral zealot
harsh blade
#

Tysm for helpingg

coral cave
#

Not a problem

quaint wasp
#

whats this?

#

DiscordAPIError: Invalid Form Body DICT_TYPE_CONVERT: Only dictionaries may be used in a DictType at RequestHandler.execute (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:154:13) at processTicksAndRejections (node:internal/process/task_queues:93:5) at async RequestHandler.push (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:39:14) { method: 'put', path: '/guilds/774085711791783998/bans/388452965884755970', code: 50035, httpStatus: 400 }

#

i

#

I kinda dont understand it.

green kestrel
#

check this out

#

someone trying to be SMRT and trying to take down my bot

misty sigil
#

is it happening?

umbral zealot
#

with a ping command? lol

misty sigil
#

no

green kestrel
#

yeah, 3 per second

misty sigil
#

lmao

#

3 per second is nothin

green kestrel
#

I have a per guild cooldown so it just dropped all those without reply

umbral zealot
#

Shame.

#

not answering on cooldowns - the smart thing most people forget is the smart thing to do

green kestrel
#

lol

misty sigil
#

i answer the first time

green kestrel
#

well it answers the first with a slow down embed

#

then any after the first it ignores silently

misty sigil
#

second time and above doesn't

#

^^ same

green kestrel
#

I've been looking into it to try and identify the reason for lag over the past 2 hours

#

anyone else noticing websocket lag?

quaint wasp
#

no

quaint wasp
#

?

umbral zealot
#

we'd need the code for your ban command to understand what's going on

quaint wasp
# umbral zealot we'd need the code for your ban command to understand what's going on
module.exports = {
  name: 'ban',
  execute: async (client, message, args) => {
    if (!message.member.hasPermission('BAN_MEMBERS')) return message.channel.send("You can't use that!");
    if (!message.guild.me.hasPermission('BAN_MEMBERS'))
      return message.channel.send("I don't have the right permissions.");

    const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);

    if (!args[0]) return message.channel.send('Please specify a user');

    if (!member) return message.channel.send("Can't seem to find this user. Sorry 'bout that :/");
    if (!member.bannable)
      return message.channel.send(
        "This user can't be banned. It is either because they are a mod/admin, or their highest role is higher than mine",
      );

    if (member.id === message.author.id) return message.channel.send("Bruh, you can't ban yourself!");

    let reason = args.slice(1).join(' ');

    if (!reason) reason = 'Unspecified';

    member.ban(`${reason}`).catch(err => {
      message.channel.send('Something went wrong');
      console.log(err);
    });
    const Discord = require('discord.js')
    const Embed = new Discord.MessageEmbed()
      .setColor('#FF0000')
      .setTitle('Member Banned')
      .setThumbnail(member.user.displayAvatarURL())
      .addField('User Banned', member)
      .addField('Kicked by', message.author)
      .addField('Reason', reason)
      .setFooter('Time banned', client.user.displayAvatarURL())
      .setTimestamp();

    message.channel.send(Embed);
    console.log("Ban command had been ran..")
  },
};```
#

(ping me)

pale vessel
#

@quaint wasp

quaint wasp
#

yes?

#

I meant ping me

pale vessel
#

you told me to ping you

quaint wasp
#

if you will help me

pale vessel
#

oh

#

ok

#

read docs

solemn latch
#

its this line thats causing the issue right?

      return message.channel.send(
        "This user can't be banned. It is either because they are a mod/admin, or their highest role is higher than mine",
      );
#

oh

quaint wasp
#

😐

pale vessel
#

reason should be inside an object