#development

1 messages · Page 1362 of 1

earnest phoenix
#

Any idea how to remove the prefix and my message?

#

How can I do it when someone uses the clear command and the messages are more than 2 weeks old, a message appears I cannot delete the message

#

@earnest phoenix I do not recommend saying command, because if someone puts a credit card, cpf, etc., your bot can be banned

#

wdym?

#

ohh

#

ty for the warning, imma delete the function

#

Message from - ${message.author}

#

put this

agile lance
#

Any idea how to remove the prefix and my message?
@earnest phoenix message.content.slice(1).join(“ “)

earnest phoenix
#

ty guys

agile lance
#

np

earnest phoenix
#

@agile lance u can help me?

agile lance
#

How can I do it when someone uses the clear command and the messages are more than 2 weeks old, a message appears I cannot delete the message
@earnest phoenix message.channel.bulkDelete(messagesHere).catch(err => {
message.reply(“Messages are 2 weeks old, OR I can not find messages to delete.”)
})

earnest phoenix
agile lance
#

its

earnest phoenix
#

wait

agile lance
#

message.content.slice(1).join(“ “)

earnest phoenix
#

i sent the wrong one

agile lance
#

try this

earnest phoenix
#

@earnest phoenix message.channel.bulkDelete(messagesHere).catch(err => {
message.reply(“Messages are 2 weeks old, OR I can not find messages to delete.”)
})
@agile lance thanks

agile lance
#

message.content.slice(client.prefix).split(“ “)

earnest phoenix
#

but what if you make another mistake

agile lance
#

@agile lance thanks
@earnest phoenix np

faint prism
#

So just spoonfeeding going on here?

earnest phoenix
#

So I'm making anti spam and not sure what is the best way of storing message amount of a user , like a map? But it can only store 50 keys i believe

agile lance
#

So just spoonfeeding going on here?
@faint prism im just helping

faint prism
#

Are you explaining what the JavaScript snippet does? It looks like you're just feeding the solution to them

agile lance
#

So I'm making anti spam and not sure what is the best way of storing message amount of a user , like a map? But it can only store 50 keys i believe
@earnest phoenix database quick.db, mongo, etc

earnest phoenix
#

mhh

agile lance
#

Weird

earnest phoenix
#

i don't think its a good idea to store in a db cuz if someone really spams its gonna be a lot of requests to the db

agile lance
#

i don't think its a good idea to store in a db cuz if someone really spams its gonna be a lot of requests to the db
@earnest phoenix That is true, But it’s probably the best option

#

Look at those popular bots constantly having a Work command ran

earnest phoenix
#

what about set?

#

I was thinking of setting if (err === message.content.include(14 days)) { message.channel.send("14 days')}

#

@agile lance

#

that would work?

#

incorrect

#

.includes returns a boolean

#

r u comparing a boolean?

#

oh

#

no

agile lance
#

That wouldn’t work because your checking the content of the message not the date it was created + it returns boolean

earnest phoenix
#

I was thinking if there is an error that contains 14 days he sends this message

#

.createdTimestamp exists 👀

#

Understood

#

something like that i don't remember the exact property name

agile lance
#

^

earnest phoenix
#

see djs docs if ur using it

#

createdTimestamp > 14

#

this?

rocky hearth
#

How much space do I need for window 10 backup??

earnest phoenix
#

Look at those popular bots constantly having a Work command ran
Wdym "work command"?

boreal iron
#

Min. the amount of space you're using right now.

earnest phoenix
#

How much space do I need for window 10 backup??
@rocky hearth not discord bot development related

#

see djs docs if ur using it
ok

pale vessel
#

it's fine @earnest phoenix

#

bot's just the main topic

earnest phoenix
#

Ok sry

rocky hearth
#

Any good place to ask these type of questions??

pale vessel
earnest phoenix
#

createdTimestamp > 14
Doesn't return a number of days, i believe you can check using ms
<timestamp> > (14 Days In ms)

boreal iron
#

Create a backup of your personal data, not Windows at all... It's always better to reinstall Windows if set up (again).

pale vessel
#

timestamp is the milliseconds after the unix epoch

#

not time in milliseconds

earnest phoenix
pale vessel
#

no dont do that

boreal iron
#

lmao

earnest phoenix
#

Bot still says !say

#

It worked

pale vessel
#

because it IS over 14

boreal iron
#

(current_timestamp - message.createdTimestamp > 14)

earnest phoenix
#

Doesn't return a number of days, i believe you can check using ms
<timestamp> > (14 Days In ms)
ok sir

#

@earnest phoenix you didn't slice say 👀

#

i did before

#

but it was sending each word every line

pale vessel
#

current_timestamp - message.createdTimestamp > 14
@boreal iron 14 milliseconds?

earnest phoenix
#

lol

boreal iron
#

what... createdTimestamp is in ms?

pale vessel
#

yeah

boreal iron
#

haha djs... is just trash

pale vessel
#

js uses ms as a standard

#

not djs, js in general

boreal iron
#

well than *1000 no big deal

faint prism
#

How much space do I need for window 10 backup??
@rocky hearth This really depends on how much data you have. Usually takes at least a couple of gigabytes. If you have a pretty full hard drive, it'll take quite a bit more. The maximum would potentially be your current hard drive utilization. So I recommend backing it up on an external drive

pale vessel
#

wait they wanted 14 days

#

well, do the math yourself

boreal iron
#

huh thought 14 s

earnest phoenix
#

wait what

#

Are you talking to me?

#

tbh they don't understand much in js, i suggest learning it

boreal iron
earnest phoenix
#

14d

boreal iron
#

that still, doesn't make sense

earnest phoenix
#

later I decrease the number

boreal iron
#

It's always true

#

u need to calcuate the difference between current timestamp and message timestamp

#

and check if that's > 14 days

earnest phoenix
#

oh

#

so is db the best way to store amount of messages of a user for anti spam?

pale vessel
#

of course

#

what else, a json file?

boreal iron
#

why storing the whole message? just store the message count of the user, per minute, hour, day, week etc.

earnest phoenix
#

I'm using mongodb, hope not too much requests

#

why storing the whole message? just store the message count of the user, per minute, hour, day, week etc.
I said amount of messages

boreal iron
#

I see u changed that 1 min ago lmao

earnest phoenix
#

um instead of amount of message i changed to amount of messages

pale vessel
#

I see u changed that 1 min ago lmao
@boreal iron you misread

boreal iron
#

shhh... that's impossible KEKW

earnest phoenix
#

it is

pale vessel
#

i have an edit snipe command lmfao

boreal iron
#

@pale vessel It's once more ur fault u didn't tell me

pale vessel
#

i wasnt paying attention pepehands

boreal iron
earnest phoenix
boreal iron
#

so, yes a database is probably the best solution, depending how much users u manage

#

but for scaling, yes it is

prisma bramble
#

Which database so you think is the best

earnest phoenix
#

I'm using mongo

prisma bramble
#

I'm really getting my head around it for a while

boreal iron
#

hmm still working with (MySQL/)MariaDB for more than 10 y

#

I can't complain...

earnest phoenix
#

idk, i have lots of maps and recently have been getting lots out of memory errors so I'm moving most stuff that i cache to db

#

don't ask me why i used maps

prisma bramble
#

MongoDB can hold quite a load ryt?

earnest phoenix
#

hmm i don't have much experience with it

#

thats why I'm asking here

boreal iron
#

Well just take a look out there and choose what's the best one for ur needs

#

not gonna recommend MySQL anymore, since Oracle doesn't give a fuck anyways

earnest phoenix
#

I heard bad reviews about it

#

well guess i gotta try and see what happens

#

just avoid mysql in modern day stack development

distant jewel
#

its not really that deep using mysql of smaller projects, its a decent database

boreal iron
#

not gonna recommend MySQL anymore, since Oracle doesn't give a fuck anyways

earnest phoenix
#

I'm not gonna switch to mysql anyway since the bot is written and setup to work with mongodb

solemn jolt
#

I have a collection in mongoDB like this

{
    "_id": {
        "$oid": "5fa0186b686604af2886e09e"
    },
    "worldWhitelist": [{
        "type": "712906491635695647"
    }, {
        "type": "737611247989686333"
    }, {
        "type": "282859044593598464"
    }, {
        "type": "565962204327968769"
    }, {
        "type": "735874386200100974"
    }],
    "ownerCode": "735874386200100974",
    "__v": {
        "$numberInt": "0"
    }
}

How i can create a query or list for worldWhitelist in array

pale vessel
#

uwotm8

feral arch
#

Hi! (: How could i obtain the collector instance inside the filter function?

sudden geyser
#
  1. What library are you using?
  2. You may be able to access it by its variable since you're calling it within the function, which isn't evaluated until later.

May I ask why you need the collector instance? In most cases, you probably don't.

solemn latch
#

Make an invite link

earnest phoenix
#

@earnest phoenix every db has its + and - there isnt somethint called the perfect db

#

i'm aware

#

mysql has more cons than pros lol

solemn latch
#

My perfect db, sql, instant, compresses everything perfectly as possible instantly.

The perfect db everyone.

#

Just make it someone 5head.

earnest phoenix
#

store data in light BigBrain

tardy hornet
#
case 'p':
              if (!message.content.includes('https://www.youtube.com/watch?v')) return message.channel.send('please put a URL link like so: `a!play https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=OfficialRickAstleyOfficialRickAstley` https://cdn.discordapp.com/attachments/765271029882683433/765277628981837844/ffffffffffffffffffffffffffffffffffffffff.png ')
              if(!args[1]) return message.channel.send('please put a URL link like so: `a!play https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=OfficialRickAstleyOfficialRickAstley` https://cdn.discordapp.com/attachments/765271029882683433/765277628981837844/ffffffffffffffffffffffffffffffffffffffff.png ')

              if(!message.member.voice.channel) return message.channel.send('please join a voice channel first.')
            
              message.member.voice.channel.join().then(connection => {
                connection.play(ytdl(`${args.slice(1).join(' ')}`, { quality: 'highestaudio' }));
                message.channel.send(`![yt](https://cdn.discordapp.com/emojis/765298587432255588.webp?size=128 "yt") now playing \`${args[1]}\` requested by **${message.author.tag}**`)
              });
              break;
``` why its not working?
solemn latch
#

Whats not working

tardy hornet
#

its not playing the music

compact briar
#

any errors?

tardy hornet
#

no

#

wait

#

i know how

#

how do i download @discordjs/opus?

#

npm i @discordjs/opus

#

?

pale vessel
#

yes

tardy hornet
#

k

pale vessel
#

also, use startsWith() instead of includes()

neon heart
#

why in djs v12+ i can't get instagram account information but in djs v11 i can?

earnest phoenix
#

how in the literal fuck is djs related to instagram lol

pale vessel
#

🧠

neon heart
#

idk, i get error when i upgrade djs to v12

pale vessel
#

what error homie

#

how are we supposed to know

neon heart
#

cannot find that username

pale vessel
#

have you tried reading the error

neon heart
#

no error detect in console

#
const { MessageEmbed } = require('discord.js')
const axios = require('axios')
exports.run = async (client, message, args) => {
  try {
    const username = args[0];
    const response = await axios.get(`https://www.instagram.com/${username}/?__a=1`);
    const { data } = response;

    const get = data.graphql.user
    const userig = get.username
    const fullname = get.full_name
    const bio = get.biography

    let e = new MessageEmbed()
    .setColor(0x0099ff)
    .setTitle(`${fullname}`)
    .setDescription(`${userig} \n ${bio}`)

    await message.channel.send(e)
  } catch (error) {
    message.channel.send("Cannot find username");
  }
};``` this is my code
solemn latch
#

Log the error

#

Makes things 10x easier to debug.
Your not getting an error because on error your just sending "cannot find username"

#

Effectively voiding it

neon heart
#

ok wait

#

TypeError: Cannot read property 'username' of undefined

umbral zealot
#

so data.graphql.user returned undefined

#

maybe log data and see what shape it actually has.

earnest phoenix
#

Is it worth learning WebGL

neon heart
#

ahh, the command not get error now, i have some typo, thankyou

umbral zealot
#

👍

solemn latch
#

I would also restructure the command to look at the status code rather than voiding all the errors

#

Will make debugging 10x easier and is a lot cleaner

neon heart
#

ok :)

earnest phoenix
#

is there a ways t know what perm someone have using this number 285240504

#

(this is a exemple of nubmer btw)

#

i would like a ways that work on any numbe

solemn latch
#

Most bot libraries have a way to do it aswell.

earnest phoenix
#

well i tryed with a api request and its give me a streight number

solemn latch
#

Yeah, the api does it

earnest phoenix
#

i saw somewhere there is an equation

#

and didnt rly understood it

solemn latch
#

Its just a bitwise operation

earnest phoenix
#

and its possible to recover permission with that operation?

solemn latch
#

Yep

earnest phoenix
#

like can a number have 2 permission combo?

#

or its 1 number per permission combo

#

ok let me see about bitwise operation thingy

#

or can you explain me how we recover,

pale vessel
#

&

earnest phoenix
#

rly,

#

its just

#

number & 0x02 == true?

#

even with an api request?

solemn latch
#

On the permission numbers yeah

earnest phoenix
#

oh well nice thx

#

gonna tes that as soon as i go home

quick ridge
#

How can I take the dominant color of a photo

solemn latch
#

You could add up all the color values of the photo, then divide by the number of pixels @quick ridge

quick ridge
#

Is there a module to facilitate this or should we do it ourselves?

solemn latch
#

@earnest phoenix
Your defining messages after the code awaits.

#

@quick ridge could be, I dont know what language your developing in.
If you look around online theres probably one.

quick ridge
#

js

#

I found a module called color-thief. It says it captures the dominant color. It gives it by numbering it as r g b.

solemn latch
#
let msgs = await message.channel.awaitMessages(
// everything after await runs before the await
// so 
let msgs
// is undefined while
message.channel.awaitMessages(...
// is running
earnest phoenix
#
@bot.command()
@commands.check(owner_ID)
async def blacklist(ctx, member: discord.Member):
    sqlA = "INSERT INTO BlacklistedUser_IDs(User_IDs) VALUES(?);"
    cursor.execute(sqlA, (member.id))
    db.commit()
    embed = discord.Embed(title="", description="", colour=discord.Color.red())
    embed.set_author(name="Blacklisted!")
    embed.add_field(name="Success", value=f"{member.name}#{member.discriminator} -- {member.id} Has been Blacklisted from Using commands!")
    await ctx.send(embed=embed)```
#

does the SQL Look correct?

fervent goblet
#

anyone know a way to get an Instagram feed to post on a discord channel?

floral rune
#

If your table has a single non-null row User_IDs of type VARCHAR it should be correct

earnest phoenix
#

"User_IDs" INTEGER,
PRIMARY KEY("User_IDs")

floral rune
#

INTEGER is too small for a discord ID

#

You probably want to convert to a string and use VARCHAR

earnest phoenix
#

Finally! An asnwer !!! ILY ❤️

floral rune
hardy ermine
#

Bonjour, j'aurait besoins d'aide sur quelque chose que je ne comprend pas, voilà j'ai un système de validation qui est fait par reaction, quand je met la reaction je reçois bien le role de validation mais si quelqu'un le fait il ne reçois pas le rôle et je ne reçois aucune erreur sur la commande esque qu'elqu'un peut m'aider ?
328/5000
Hello, I would need help on something that I do not understand, here I have a validation system which is done by reaction, when I put the reaction I do receive the validation role but if someone does did it not get the role and i get no error on the esque command that someone can help me?

client.on('messageReactionAdd', (reaction, user)=> {
    if(user.bot) return;
    const reactions = require("./bdd/reaction.json")
    const message = reaction.message
    const validationrole = message.guild.roles.cache.get(reactions.validationrole);

    if(reaction.message.channel.id === "758772029892722738") {
        if(reaction.emoji.name === "accepte") {
            var member = reaction.message.guild.members.cache.find(member => member.id === user.id);
            member.roles.add(validationrole).then(mbr => {
                console.log(`${mbr.displayName} à accepté le réglement`)
            }).catch(err => {
                console.log(`Le rôle ${validationrole.name} n'a pu être attribué : ${err}`);
           });
        };
    };
}
floral rune
#

try replacing reaction.message.guild.members.cache.find(member => member.id === user.id); with reaction.message.guild.member(user)

#

@hardy ermine

quick ridge
#

what can i get this error

solemn latch
#

I'm confused, are you putting in a url in a readfilesync?

hardy ermine
#

try replacing reaction.message.guild.members.cache.find(member => member.id === user.id); with reaction.message.guild.member(user)
@floral rune it didn't change anything

quick ridge
#

¯_(ツ)_/¯

#

They said that you can shoot this way on the internet and I took an example from them.

solemn latch
#

If you have the file locally.
I have never seen readfilesync used this way, 99% sure its only for files you have locally.

#

If you want to get a file online you'll have to request it via the proper method.

earnest phoenix
#

in https://discordapp.com/api/v8/users/@me/guildswhat permissions is?

warm agate
#

@hereHi, I'm a new developer and need help with the command handler in discord.js. Can anyone help me?

earnest phoenix
#

like if a user have admin perm its would tell it there?

warm agate
#

I'm not admin

earnest phoenix
#

its was for my question

warm agate
#

hahhaha

solemn latch
#

4th*

earnest phoenix
#

this one?

umbral zealot
#

@warm agate we can't help if you don't ask your question.

earnest phoenix
#

i troughtt admin was 0x8

solemn latch
#

2 is kick perms

#

I linked to the page, 4th one lists administrator

warm agate
#

@warm agate we can't help if you don't ask your question.
@umbral zealot i need help with command handler. i write the script don't work

earnest phoenix
#

0x00000008 or 0x8?

warm agate
#

and i'm not english

#

i'm italian

umbral zealot
#

Ok well we need to see the script, and for us to tell us what doesn't work with it.

warm agate
#

ok

solemn latch
#

Pretty sure 0x000000008
Whatever its listed as

warm agate
#

you can speek?

solemn latch
#

This is a primarily English channel

warm agate
#

ik

blissful coral
#
.bot-img {
background: transparent;
background-color: rgba(0, 0, 0, 0);
border-radius: 50%;
animation: bounce 1s infinite alternate;
-webkit-animation: bounce 1s infinite alternate;}
#

For some reason

#

My border-radius

#

Is not changing it to a circle

#

but everything else is

umbral zealot
#

@warm agate no, show your code here or paste it on https://hasteb.in/ , I don't do private support.

warm agate
#

ok

umbral zealot
#

Oh... you're using a rando npm module. I See.

warm agate
#

?

umbral zealot
#

yeahhhh that thing's not going to work, it hasn't been updated in 2 years, it's broken.

warm agate
#

i am new to programming, not some things

umbral zealot
#

Ned is also a pretty shit dev if you ask me so...

#

meh

blissful coral
#

Very shit dev

#

LMAO

solemn latch
#

Ouch, feels bad ned

blissful coral
slender thistle
#

@blissful coral dev tools gang

blissful coral
#

yessa

umbral zealot
warm agate
#

so can you give me a code that works?

slender thistle
#

See which rule overwrites yours

blissful coral
#

oh yeah

solemn latch
#

We don't spoonfeed here

blissful coral
#

smart

solemn latch
blissful coral
#

Damnit @slender thistle

slender thistle
#

Abuse !important

queen crescent
#

anyone know why its not actually saving but its responding with successful etc?

#

if i had an extra ../ to the ../../config.json it works but saves to my desktop

blissful coral
#

Luv you @slender thistle

slender thistle
#

ly2

blissful coral
#

wait

#

I forgot

#

What was the border white line thing again

#

Gotta remove that shit

solemn latch
#

Shadow?

blissful coral
#

Was it shadow?

#

the white line thing

#

I forgot

queen crescent
#

what white line

solemn latch
#

The one under the bots pfp

blissful coral
queen crescent
#

on the bots image? if so then ye its box-shadow

solemn latch
#

Hecking annoying that line

queen crescent
#

theres no errors

boreal iron
#

@blissful coral box-shadow: none !important;

blissful coral
#

thought so

#

thx

boreal iron
#

On #bot-img div

blissful coral
#

Yeah just forgot the name of it

floral rune
#

@floral rune it didn't change anything
@hardy ermine from what I can find online you need to make sure you cache the message before you can get events on it. Did the message already exist before the bot was restarted?

#

You can cache a message with client.channels.get(CHANNELID).fetchMessage(MESSAGEID);

hardy ermine
#

no the message it cache

floral rune
#

you're getting the event, right?

fervent goblet
#

anyone know about scraping fandom websites for data?

hardy ermine
#

you're getting the event, right?
@floral rune yes

floral rune
#

try switching out js const validationrole = message.guild.roles.cache.get(reactions.validationrole); for ```js
const validationrole = message.guild.roles.resolve(reactions.validationrole);

#

assuming reactions.validationrole is a RoleResolvable (an ID will do)

next knot
#

evening folks, just wondering how others go about this or any ideas.

I've recently updated one of my bots and would like to push out a notification to all servers it in or even to all server owners or something. is that possible?

sturdy gazelle
#

yes but i do not know if it is allowed. my bot has that except it requires each server to configure which channel to send to. There is also the option of creating a server and making an announcements channel which will do something very similar

next knot
#

yes but i do not know if it is allowed. my bot has that except it requires each server to configure which channel to send to. There is also the option of creating a server and making an announcements channel which will do something very similar
@sturdy gazelle cheers, jojo yeah have the server set up but dont think there is many subscribed to the announcement channel as of yet.

sturdy gazelle
#

what language r u working in?

next knot
#

i was using a bot a while ago that used to dm me directly as the server owner every time there was an update

#

node js

sturdy gazelle
#

me too!

#

code => commands => misc => announce.js

next knot
#

appreciate that i'll check it out

sturdy gazelle
#

i use server settings, but if you want you can forEach guilds in the cache and then send a message to guild.owner or u can send a message to guild.systemChannel

next knot
#

legend thank you

cedar gyro
#

Is anyone able to help me with passport and discord-passport

obtuse jolt
hasty cloak
#

hey guys can i have a probleme my bot is on two server [bot test server] and another community server but the bot gets the 2 guild but no user only the one on bot test server.https://puu.sh/GJnfi.png

opal plank
#

@hasty cloak discord intents

#

you need to have guild_member intents to be able to fetch guild list

hasty cloak
#

is it new ?

opal plank
#

about a couple weeks

#

so not quite

hasty cloak
#

oh okay thx ❤️

#

@opal plank have you a example or so ?

opal plank
#

depends on your lib

stone meteor
#

When I copy the widget code for status and paste it to my page it shows the complete (large widget)

hasty cloak
#

uffff okay on the discord dev portal

opal plank
#

i assume its discord.js

hasty cloak
#

yea

opal plank
#

then read that

hasty cloak
#

but thx

stone meteor
#

When I copy the widget code for status and paste it to my page it shows the complete (large widget)
@stone meteor
Ping me if you know please

hasty cloak
quick ridge
#

How do I make it cut corners softer

#

I using for cutting =
ctx.beginPath();
ctx.lineWidth = 7;
ctx.fill();
ctx.lineWidth = 7;
ctx.arc(150, 150, 180, 0, Math.PI * 2, true);
ctx.clip();

barren pumice
#

Hello, sorry to disturb but my bot is not working anymore. guild.presences.cache.array() is returning an empty array now. Do you know why ?

umbral zealot
#

You won't get presences if you don't have the Presence privileged intent

barren pumice
#

Crap, what is this >.<

#

Is this a server permission ?

umbral zealot
#

you have to enable the presence intent.

barren pumice
#

Oh ok I see

umbral zealot
#

Note, however, that relying on this for a feature, you should make damn sure you actually need it, as it's not always given when you verify the bot (it must be an important or unique feature)

earnest phoenix
barren pumice
#

Thanks I'll check it

hollow sedge
#

Is there a way to get the user object by their ID in d.py?

#

I know you can use get_user but it returns None sometimes

sudden geyser
#

If it returns None, it means the user wasn't found in the cache.

hollow sedge
#

that's what I thought but I'm not really sure how to fix it

solemn latch
#

fetch them rather than get

hollow sedge
#

yeah I have ten users to get though

#

I don't want to be making ten api calls

solemn latch
#

are they members or users?

hollow sedge
#

well all I have is their IDs

#

oo

#

that looks promising

solemn latch
#

are you trying to get the member object or the user object

#

is all i was asking

hollow sedge
#

oh i see

#

im just trying to get their username so member should be fine

#

thanks

solemn latch
#

np

hollow sedge
#

on second thought

#

it probably wont work for my case lol

#

i dont have a specific guild to fetch members from

solemn latch
#

yeah, didnt think so

whole knot
#

Hey, so I coded a ticket system and somehow my alias for "!ticket close" do not work but the ones for "!ticket open" do work. Does someone see what I did wrong in the "ticket close" aliases?

floral rune
#

@earnest phoenix what api are you talking about

earnest phoenix
#

its not working anymore

floral rune
#

what kind of images do you need

earnest phoenix
#

The endpoints are either not maintained or you're using incorrect code

floral rune
#

show us your code first and if that's ok then it would be good to look at different apis

earnest phoenix
#
client.command()
async def redpanda(ctx):
    async with aiohttp.ClientSession() as cs:
        async with cs.get("https://some-random-api.ml/img/red_panda") as r:
            res = await r.json()  # returns dict
        await ctx.send(res["link"])
```  (this is correct)
#

the website is down

floral rune
#
$ curl https://some-random-api.ml/img/red_panda
{"link":"https://i.imgur.com/5YN30zJ.png"}
``` oddly enough it seems to work for me
earnest phoenix
#

eh?

#

its up now

floral rune
#

i guess it may have just been down

earnest phoenix
#

They might have been just updating it or something

#

🗿

shy turret
solemn latch
#

what now what?

#

@oak cliff

earnest phoenix
#

Anyone know how to fix ? at FSReqCallback.oncomplete (fs.js:146:23)

solemn latch
#

thats not an error, its just the location of one

earnest phoenix
#

Can you help

#

The bot won't start because of it

solemn latch
#

no idea, dont know what the error is

drifting wedge
#

what does this erorr mean?

#
    itemname = getlooter["item"]
TypeError: tuple indices must be integers or slices, not str```
#

py

tight plinth
#

getlooter is a tuple

#

youre trying to use it as an object

#

@drifting wedge

drifting wedge
#

ummm i have a dict in a func

#

and the func gets a random dict from the nested dict

tight plinth
#

try to print getlooter

drifting wedge
#

and returns the stats

sudden geyser
#

@drifting wedge the error means when trying to access a tuple element by index, it should be an int

#

You're giving is a str ("item")

drifting wedge
#

i dont think so but i got it fixed

earnest phoenix
#

help Me !

#

whats happening tho

#

what are you trying to do

#

Music is not played

hollow sedge
#

@earnest phoenix help them !

earnest phoenix
astral birch
#

can someone help me, I'm making an application bot, and now, I want to make sure that if there are no questions, the bot doesn't ask it at all, but I don't know how, that is, it won't work for me somehow, and there is no terror

#

when I put this if (question2 === null) return; It's not working

#

but when I remove it then it works normally, just ask a question that says null

#

pitanja means questions, otvoreno - opened

hollow sedge
#

Shouldn't you be iterating over the questions anyway

astral birch
earnest phoenix
astral birch
#

ahh

earnest phoenix
#

New Error :/

#

help

astral birch
#

Shouldn't you be iterating over the questions anyway
@hollow sedge I want to make that if the question is not set, the bot does not ask it in the application at all

hollow sedge
#

@hollow sedge I want to make that if the question is not set, the bot does not ask it in the application at all
@astral birch first of all, the way your DB is set up is flawed and second, with that flawed set up you could use a while loop and break it whenever the question returns none

astral birch
#

can you help me how to fix that?

#

@hollow sedge

hollow sedge
#

sorry, no, you just need to find out the proper way to use a db

astral birch
#

ok

dry swan
#

Hello, I am new to making bots and I wanted to make my first one to invite to my server. When I used the link to try and invite it to my server, I got
500: Internal Server Error and it won't let me invite. Does anybody know how I can fix this?

blissful coral
#
box-shadow: none !important;
#

Not working to remove box shadow 🤔

honest perch
#

Borders none?

ionic dawn
#

If you trying to edit your top.gg bot page that shadow is tricky to remove

#

But you can simple put somethin above it, like z-index u know

shy rose
#

anyway with a non modded client (or dev tools) to easily find a roles permissions on a channel
(assuming a non admin rank)

quartz kindle
#

@blissful coral ```css
.columns .bot-img {
box-shadow: none !important;
}

blissful coral
#

Thx <3

main trench
#

Anyone know if their is a way to detect if a word you sent like in a set prefix command is over a certain number of letters?

hollow sedge
#

You can use str.length to get the length of a string in js or len(str) to get it in Python @main trench

main trench
#

Aight thanks

#

so in theory this should work @hollow sedge? if(String.length > 6) return message.channel.send("Please set a perfix that is under 6 letters")

hollow sedge
#

yes but the 6 letters would include the prefix to call the change prefix command

#

@main trench

main trench
#

hmm

slim umbra
#

has anyone had a issue w radix not publishing stuff when using its redis pub/sub client

#

and i verified the connection is there and booping

hollow sedge
#

you should be splitting the arguments to process them @main trench

main trench
#

hmm aight

rocky hearth
#

Does anyone has used Commando here?

quartz kindle
#

remove the break lol

faint prism
#

Looks like you broke the law. Tisk tisk

#

Jk, you probably put break outside a switch statement

#

Oh, you did

slim umbra
#

insert learnjs text block

#

guild is nto defined

#

bruh

#

fr

#

read what the error says lmao

#

how're we supposed to fix that

floral rune
#

your switch syntax is a bit screwed up

#
switch (args[0]) {
        case 'create':
    guild.createChannel("Test", {type: "voice"}).then((channel) => {
        //break;

        channel.setParent("630240260965793798");
    });
    break;
}```
#

probably what you were going for

#

as for guild is not defined im going to need to see more code

#

What event are you calling this in

#

on('message'? Or something else?

#

well the error is pretty straightforward

#

from args[0] im guessing you're following the tut on discordjs.guide, no?

#

if you're using the guide then the event would be onMessage

#

you can get a guild object from message.guild

#

createChannel is probably djs v11, they changed it in v12

blissful coral
#

message.guild.channels.create

#

and in your parameters just do parent: ''

floral rune
#
message.guild.channels.create('test', {
  type: 'voice',
  parent: '630240260965793798'
});
#

check if message.member.roles has the role you want

blissful coral
#
permissionOverwrites: [
            {
                id: '',
                allow:['VIEW_CHANNEL']
            },
            {
                id: message.guild.id,
                deny:['VIEW_CHANNEL']
            }
floral rune
#

ig the question is are you trying to restrict the command or the channel

blissful coral
#

channel pretty sure

floral rune
#

do you want it to be so that

  • only Hosts can execute the command but anyone can join the channel
  • anyone can execute the command but only Hosts may join
blissful coral
#
if(message.member.roles.cache.has(`id`))
quartz kindle
blissful coral
#
if(!message.member.roles.cache.has(`id`)) return message.channel.send(`You do not have permission to run this command!`) //Change if statement to this which will check if the member does not have roles and if they do not return a message```
opal plank
#

brazil is a fucking joke
@quartz kindle yikes, lab exams website down

#

lul

blissful coral
#

lul

opal plank
#

all .gov domains down when?

blissful coral
#

fuckkk

quartz kindle
#

i just realized wrong server lmao

opal plank
#

nah

quartz kindle
#

meant to post that elsewhere xd

opal plank
#

its dev related

#

all good

#

Tim has a pass

#

all gucci

quartz kindle
#

lmao

#

im on the waiting line on the phone for literally 1 hour

#

with another lab

opal plank
#

can we cancel brazil?

quartz kindle
#

yes

opal plank
#

funnily enough though

#

its up for me

#

at least the main page

blissful coral
#

@earnest phoenix then it is failing

opal plank
#

nvm

blissful coral
#
if(!message.member.roles.cache.find(r => r.id === "id") return message.channel.send(`You do not have permission to run this command!`) //Change if statement to this which will check if the member does not have roles and if they do not return a message
#

@earnest phoenix

#

Reread what I said

#

forgot cache

#

edited it

quartz kindle
#

lmfao

opal plank
#

omfg

#

website development at its finest

#

thats what you get for hiring whoever the fuck comes for the cheapest price

#

i MaKE WebSITe fOR CHeAP

drifting wedge
#

@quartz kindle u brazilian?

quartz kindle
#

more or less

trim saddle
#

naõ

sage bobcat
#

One message removed from a suspended account.

blissful coral
#

The fuck is this

drifting wedge
#

@drifting wedge iirc he lives in Portugal
@sage bobcat its brazlian portugese i think

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

blissful coral
#

anyone know what the fuck this is

#

on my screen

#

it is fuckin up my bot

sage bobcat
#

One message removed from a suspended account.

blissful coral
#

I did

#

5 times already

sage bobcat
#

One message removed from a suspended account.

blissful coral
#

Is it a rate limit?

#

Or something?

#

It isn't sharding

#

@sage bobcat

#

It is something with the dblapi

sage bobcat
#

One message removed from a suspended account.

blissful coral
sage bobcat
#

One message removed from a suspended account.

blissful coral
#

Time to look at my node modules

#
  _startWebhook() {
    this._server = createServer(this._handleRequest.bind(this));
    this._server.listen(this.port, this._emitListening.bind(this));
  }
#

Something to do with this

#

I changed the port to 6000

#

same error

#

Oh

#

Found it

#

@sage bobcat my bot just upped to 2 shards instead of the single shard

#

therefore it was trying to connect twice and send twice

quartz kindle
#

noob

blissful coral
#

it was already connected so it wouldn't let me connect again

#

LMAO

quartz kindle
#

lmao

dense patio
#

how do i manipulate a global variable in a local scope and keep that new value outside of the local scope? (javascript)

#

i know there's a way to do this but i can't figure it out for the life of me

quartz kindle
#

your problem is likely not scopes, but timing

dense patio
#

yeah i figured it had something to do with that

quartz kindle
#

are you trying get a value from inside a promise or callback?

slim umbra
#

when code u wrote works first try Stonks

dense patio
#

first it cycles through the guild members asynchronously to get some database information on them, and is supposed to append some info to a string to put in a message

slim umbra
#

rn im running a 12k guild bot on 6mb heap

quartz kindle
#

lmao nice

dense patio
#

i've tried awaiting the loop but i think i'm doing it wrong

slim umbra
#

finally finished my gateway thingy

#

was fucking hell to write

quartz kindle
#

@dense patio show code

slim umbra
#

but ive gotten rid of rabbitmq/amqp overhead

#

redis pub/sub >

quartz kindle
#

did you add voice?

slim umbra
#

nah

#

not yet atleast

#

and i dont really plan to tbh

quartz kindle
#

voice gateways are an even bigger hell

slim umbra
#

yea

quartz kindle
#

and zlib?

slim umbra
#

ye

quartz kindle
#

nice

#

zlib is bae

blissful coral
#

I am redoing my bot cuz I went from 1 shard to 30 and fucked up the whole bot

#

This is fun

quartz kindle
#

LOl

blissful coral
#

All new index and other shit

#

Fuck me
LMAO

dense patio
#

[--]

quartz kindle
#

how many guilds?

blissful coral
#

fucking 11k

#

idk why it is putting 30

quartz kindle
#

lmao

#

@dense patio you cannot await a forEach

blissful coral
#

^

#

lol

dense patio
#

hmm

#

so what am i to do

quartz kindle
#

you need to use a for loop

dense patio
#

oh alright

slim umbra
#

I am redoing my bot cuz I went from 1 shard to 30 and fucked up the whole bot
@blissful coral lmaoooo

blissful coral
#

Yeah...

#

So I just made a new workspace and am starting over

quartz kindle
#

the reason is that a forEach creates a function on each iteration, which creates a separate scope, so when you await, you are awaiting inside this function, not outside

slim umbra
#

sadly for const/let loops are slower than forEach

blissful coral
#

They took away my guild member intent aswell

#

LMAO

slim umbra
#

#BlameNodeJS

blissful coral
#

Fucking discord

slim umbra
#

lmaoo rip

quartz kindle
#

what

slim umbra
#

why?

dense patio
#

good to know

quartz kindle
#

for loops are faster than forEach wtf are you on

blissful coral
#

for loops are a lot faster

#

lol

dense patio
#

aren't they slower?

blissful coral
#

No

#

LMAO

#

for loops are faster than forEach wtf are you on
@quartz kindle

slim umbra
#

wait

#

it depends

blissful coral
#

not rlly

slim umbra
#

yeah it does

#

for bigger data sets

blissful coral
#

eh

slim umbra
#

.foreach is more speed

quartz kindle
#

x doubt

slim umbra
#

also depends what ur doing

quartz kindle
#

forEach creates an anonymous/lamba function on every single iteration, thats a lot of overhead

slim umbra
dense patio
#

ok it still doesn't work

slim umbra
#

i mean events not keys OMEGAlul

quartz kindle
#
// this doesnt work
// because this is creating a function on every iteration, so you are awaiting inside the function only
bla.forEach(async x => {
  await y();
})
// its the same as doing this
for(...) {
  (async function() {
    await y();
  })()
}
// the entire loop will complete super fast, and create a gazilion functions that will only be resolved later
// while the outside code continues normally without waiting for these functions
// you have to do this instead
for(...) {
  await y()
}
// this way the loop actually respects and awaits the promise before continuing to the next iteration
``` @dense patio
dense patio
#

i'll give this a try

slim umbra
#

urg compiling rust is horrible

dense patio
#

ok

#

still not working

blissful coral
#

Someone link me to discord support for getting intents after verification

#

I am to lazy to look it up

slim umbra
#

uh i just emailed them

blissful coral
#

send it

slim umbra
#

literally just sent to their support address

quartz kindle
#

@dense patio you will need to show more code then

dense patio
#

well this is pretty much everything besides the message
[---]
i tried awaiting the contents in the for loop but that did nothing, then i tried awaiting this entire piece of code and that did nothing

#

@quartz kindle

quartz kindle
#

what are you trying to access and where?

dense patio
#

what do you mean

quartz kindle
#

you said you were trying to get a variable outside of this

dense patio
#

in this part

if(totalPlays > 0) {
  songTxt += `${member.user.tag} - ${totalPlays} plays\n`;
}

i'm trying to add to the songTxt string to send as a message

#

but the string is empty when i try to send it

#

it sends it just below that chunk up there

quartz kindle
#

the songTxt variable is created inside the members.fetch().then()

#

where is the message sending code?

#

if its outside this .then() it wont work

dense patio
#

it is

#

i had it inside before but that didn't work so i moved it back outside

#

but that was also when something else was wrong

#

ok now it just does nothing

quartz kindle
#

show more code then

#

including where the message is sent

dense patio
#
let reqArtist = args.join(` `);
    let reqArtistCaps = [];
    args.forEach(arg => reqArtistCaps.push(toCapitalString(arg)));

    var songTxt = ``;
        message.guild.members.fetch().then( async members => {
            for(const member in members) {
                let dbUser = await User.findOne({ discordID: member.user.id });
                if(dbUser) {
                    let totalPlays = 0;

                    dbUser.songs.forEach(song => {
                        if(song.artist.toLowerCase() == reqArtist.toLowerCase()) {
                            totalPlays += song.plays;
                        }
                    });

                    if(totalPlays > 0) {
                        songTxt += `${member.user.tag} - ${totalPlays} plays\n`;
                    }
                }
            }
            console.log(songTxt.length)

            let embed = new Discord.MessageEmbed()
            .setAuthor(songTxt.length > 0 ? `Who Knows ${reqArtistCaps.join(` `)}` : `---`, message.guild.iconURL({ dynamic: true }))
            .setDescription(songTxt.length > 0 ? songTxt : `No record of this artist.`)
            .setColor(config.colors.primary)
            .setTimestamp(new Date());
        
            message.channel.send(embed);
        })

ok this is the entire command lol

quartz kindle
#

does console.log(songTxt.length) show anything?

dense patio
#

it logs 0

quartz kindle
#

ah, the for loop is wrong

#

for(const member of members.values())

#

since members is a collection which is basically a Map

dense patio
#

it still gets the data

#
  • i just tried that and no dice
quartz kindle
#

put a console.log inside it then

dense patio
#

yeah it works there

#

doing this

if(totalPlays > 0) {
  songTxt += `${member.user.tag} - ${totalPlays} plays\n`;
  console.log(songTxt.length)
}

logs the correct length after each iteration

quartz kindle
#

and the other console.log still shows 0?

dense patio
#

yep

quartz kindle
#

well the code looks correct

#

i dont see how that would be possible, unless its not updated or not saved correctly

dense patio
#

yeah these weird little quirks pop up every once in a while and it's infuriating

#

i just can't understand why it's not working

umbral zealot
#

you are... literally logging the line just after? there's nothing between?

dense patio
#

that's exactly what the code is in the command

dense patio
#

i can't tell if you're being serious

umbral zealot
#

oh I get it

dense patio
#

but i guess that just goes to show

#

it doesn't make sense

umbral zealot
#

No I'm sorry I was actually not reading the entire code correctly just your tidbit

#

hold up one sec, lemme be less of an asshole here and read the code

dense patio
#

lol ok

umbral zealot
#

Can you.. uhm... just for the fuck of it, because I'm genuinely curious... can you try to do let songTxt = ""; instead of var? The chances of this working are slim to none but.. I'm... just humor me, please?

dense patio
#

that's what i had before but i've changed a bunch of stuff so i'll try it

#

no dice

#

same result

umbral zealot
#

hmm.

dense patio
#

this is driving me crazy

#

i was expecting to make this command in like 10 minutes and call it a night

umbral zealot
#

yeah honestly... I don't see it either.

dense patio
#

it just doesn't make sense!

umbral zealot
#

No you're right. My brain can see ways to make this code better, but not to... fix it. I don't see what's wrong either.

#

I threw it at a beautifier to make sure the indent wasn't messing with my brain, it wasn't, your indent is fine, everything is inside the promise, you're not trying to use await inside a forEach, there's nothing else that needs to be awaited....

#

I mean if it's any comfort, I've been coding for 20 years and I'm as stumped as you are.

opal plank
dense patio
#

jeez

opal plank
#

is this passing at all?

dense patio
#

yes

opal plank
#

cuz otherwise it'd be an empty string

dense patio
#

if i log songTxt inside of that, it works fine for each iteration

opal plank
#

apologies beforehand since i absolutely did not read the whole thing

umbral zealot
opal plank
#

hmmm

umbral zealot
#

And to be clear when you say "logs the correct length after each iteration" you mean, "the lenght of the current iteration" or "the length of all the iterations put together"?

dense patio
#

the length of all of the iterations put together

umbral zealot
#

I...

dense patio
#

it works exactly as it's supposed to

#

in theory

umbral zealot
#

but the log after the loop is wrong?

dense patio
#

yep

umbral zealot
#

And it's showing that after all the loops have ended, right?

dense patio
#

according to what Tim said, yeah

#

before it was forEach which apparently works on a different timeline than the rest of the code so the rest ran before it finished looping

opal plank
#

i would run that but idk what you got

#

my recommendation is, well, user a debugger

#

do step debugging rather than randomly checkinbg everywhere

umbral zealot
#

Could you... try this just for the hell of it? ```js
let reqArtist = args.join( );
let reqArtistCaps = [];
args.forEach((arg) => reqArtistCaps.push(toCapitalString(arg)));

message.guild.members.fetch().then(async (members) => {
let songTxt = "";
for (const member in members) {
let dbUser = await User.findOne({ discordID: member.user.id });
if (dbUser) {
let totalPlays = 0;

  dbUser.songs.forEach((song) => {
    if (song.artist.toLowerCase() == reqArtist.toLowerCase()) {
      totalPlays += song.plays;
    }
  });

  if (totalPlays > 0) {
    songTxt += `${member.user.tag} - ${totalPlays} plays\n`;
    console.log(`Current length after ${member.user.tag}: ${songTxt.length}`);
  }
}

}
console.log(Total length after loop: ${songTxt.length});

let embed = new Discord.MessageEmbed()
.setAuthor(
songTxt.length > 0 ? Who Knows ${reqArtistCaps.join( )} : ---,
message.guild.iconURL({ dynamic: true })
)
.setDescription(songTxt.length > 0 ? songTxt : No record of this artist.)
.setColor(config.colors.primary)
.setTimestamp(new Date());

message.channel.send(embed);
});

opal plank
#

would still go for step debugging

#

you catch the error where its being produced

umbral zealot
#

yeah true, perhaps.

dense patio
umbral zealot
#

I've done one little change here though, that shouldn't matter but... eh. just in case. (moved the songTxt var)

opal plank
dense patio
#

alright

umbral zealot
#

Ok wait, that's only one single log isn't it?

#

where's the rest of them?

dense patio
#

that log is outside of the loop

grave sonnet
#

yo

umbral zealot
#

what about the log inside the loop

opal plank
#

u got one insde too

grave sonnet
#

i need a mass dm bot

#

for my server

opal plank
#

no

umbral zealot
#

@grave sonnet no, fuck off

opal plank
#

against TOS

umbral zealot
#

nobody's going to help you spam.

dense patio
#

if i do this:

if(totalPlays > 0) {
  songTxt += `${member.user.tag} - ${totalPlays} plays\n`;
  console.log(songTxt.length)
}
opal plank
#

use step debugging my man

#

you follow the code on the go

dense patio
#

wait a second

opal plank
#

rather than randomly picking somewhere and trying to figure this out

#

F5, add a breakpoint, and step in, thats it

umbral zealot
#

yeah go with that 😄

quartz kindle
#

reminding of what i said before, for in doesnt work on collections, so the loop is being entirely skipped

#

you have to use for of .values() as members is a collection

zenith knoll
#

yo

#

uh it cant send a msg to a user and theres no error

quartz kindle
#

show code

keen drift
#

@quartz kindle Regarding the inquiry yesterday:

it looks with Discord v8 gateway, there's a concurrency of N (max_concurrency) per 5 seconds identify limit. Each N is split into buckets, and buckets must be identified in order (0-15 prior to 16-32).

rate_limit_key = shard_id % max_concurrency

This change made the decision for me, for the across machine coordination.

leaden berry
#

@gilded plank

umbral zealot
#

Hey, leave Luca alone!

earnest phoenix
#

how do you create a invite

#

like with the bot

umbral zealot
#

There should be a method to create an invite using your library

earnest phoenix
#

idk how

umbral zealot
#

if you tell us what library you're using maybe we can direct you to the right documentation

earnest phoenix
#

discord.js

umbral zealot
#

Note that it's not recommended to create invites on guilds that have not specifically requested the bot to do so.

earnest phoenix
#

ty

earnest phoenix
#

.

faint prism
#

Dot

sturdy star
#

how to do a ping command in javascript?

tribal siren
#
  if (message.content === '+ping') {  
    message.channel.send(`🏓Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
  }
});```
Here
sturdy star
#

Thank you

tribal siren
stray nebula
#

how can i invite my bot in my server

tribal siren
#

so lemme explain it to you real quick

#

choose your bot

#

then put the link in browser

#

hope this was helpful ^^

sturdy star
#

@tribal siren it doesn't work

tribal siren
#

huh

#

why tho

#

what's the error

sturdy star
#
    
    let role = message.guild.roles.cache.get('ROLE_ID_HERE');
    const member = message.mentions.members.first();

    member.roles.add(role);
    message.channel.send('Role Added');
}

module.exports.config = {
    name: "addrole",
    description: "",
    usage: "!addrole",
    accessableby: "Members",
    aliases: []
}```
#

what's an error here?

tribal siren
#

well what's an error here

sturdy star
tribal siren
#

bruh never tried doing the addrole command

#

wait for someone else i guess

sturdy star
#

ok

#
    
    let role = message.guild.roles.cache.get('ROLE_ID_HERE');
    const member = message.mentions.members.first();

    member.roles.add(role);
    message.channel.send('Role Added');
}

module.exports.config = {
    name: "addrole",
    description: "",
    usage: "!addrole",
    accessableby: "Members",
    aliases: []
}```
#

so what's wrong in this?

pale vessel
#

ROLE_ID_HERE

#

it's not a snowflake/id

sturdy star
#

so what am i supposed to put in there?

#

@pale vessel

young flame
#

okay

#

@sturdy star heres one way

#
var role= member.guild.roles.cache.find(role => role.name === "role name");
restive furnace
#

dont spoonfeed though

#

and vars on nodejs code uhh

young flame
#

what

#
  1. i'm giving an example
#

he wants an id not a role name

restive furnace
#

kk but still he could google that

young flame
#

okay

#

but he asked in development

#

so i'm going to help

#

k thanks

#

anyways

sturdy star
#

i tried it

young flame
#

did it wokr?

#

work*

sturdy star
#

code looks like this

#
    
    var role= member.guild.roles.cache.find(role => role.name === "role name");
    const member = message.mentions.members.first();

    member.roles.add(role);
    message.channel.send('Role Added');
}

module.exports.config = {
    name: "addrole",
    description: "",
    usage: "!addrole",
    accessableby: "Members",
    aliases: []
}```
young flame
#

because

#

you need to put const member above role

#

like this

#
module.exports.run = async (bot, message, args) => {
    
    const member = message.mentions.members.first();
    var role= member.guild.roles.cache.find(role => role.id === "ROLE-ID-HERE");

    member.roles.add(role);
    message.channel.send('Role Added');
}

module.exports.config = {
    name: "addrole",
    description: "",
    usage: "!addrole",
    accessableby: "Members",
    aliases: []
}
sturdy star
#

ok let's try this

#

also how did you colour the code?

young flame
#

like

#

hh

sturdy star
young flame
#

okay

#

are you trying to add a spesific role

sturdy star
#

yea

rocky hearth
young flame
#

or be like !addrole @young flame admin

#

@rocky hearth reachall isnt a thing

#

wait what are you coding in?

#

c# js py ts

sturdy star
#

!addrole @sturdy star 740980085099724952

young flame
#

ruby rustt

rocky hearth
#

ik, that's y im structuring it

young flame
#

hmm

sturdy star
#

that's how i want it to do

young flame
#

okay

#

hold oon

crisp fable
#

@sturdy star you gotta retrieve the role id from the arguments

young flame
#

i got it

#

hhh

#

@crisp fable can you help basant please

rocky hearth
#

The msg is of type Message. That's y its originating this. And I want to return this either

crisp fable
#

i don't know much about classes

sturdy star
#

so what do i have to do now

young flame
#

@sturdy star add (args[0])

#

i think

crisp fable
#

replace "ROLE-ID-HERE" with args[1]

young flame
#

The msg is of type Message. That's y its originating this. And I want to return this either
@rocky hearth show the code again

crisp fable
#

the member would be the first argument

young flame
#

^

rocky hearth
#

its still there

sturdy star
#

replace "ROLE-ID-HERE" with args[1]
@crisp fable ok

young flame
#

not you

#

wait

#

hh

#

sorry

#

wrong person

#

sorry i don't usual help out with coding lmao

rocky hearth
#

So any luck for me?

young flame
#

what are you coding it in

rocky hearth
#

to me??

young flame
#

yes

crisp fable
#

looks like nodejs

young flame
#

i can't tell if it's nodejs or c#

pale vessel
young flame
#

hhhhhhh

#

FLAZE

#

HALP

#

PLLS

pale vessel
#

no i have homework

rocky hearth
#

for the button method I want to send a message and then react the same message

young flame
#

hhh

#

for the button method I want to send a message and then react the same message
@rocky hearth hm

pale vessel
#

i lied, i just finished it but you handle it sure2

crisp fable
#

i have school :^)

young flame
#
message.react();
#

if its js

rocky hearth
#

But <Channel>.send() returns a Message, which I'm structuring here

#

so Message is the parent of this here

young flame
#

mhm

rocky hearth
#

so I can't access reactAll from Message

halcyon pecan
#

I can't code

young flame
#

h

#

i don't think you can use react all as a function

rocky hearth
#

Yes, that's y I'm asking for work around for it

#

reactAll takes an array of emojies and react them to the message asynchronously/insequence

young flame
#

hhhhh

#

that sounds

#

complicated

rocky hearth
#

Have you worked with Structures?

young flame
#

no

#

i dont use structures

#

hhhh

rocky hearth
#

Structures lets the dev to extend the built in classes of djs. And djs will use the extended classes

sturdy star
#

is it else if or elif on JavaScript?

rocky hearth
#

else if

sturdy star
#

ok

#

thank you

pale sapphire
#

I maded a kick and ban command but everyone can use it.
How to fix this?

sturdy star
#

show your script

rocky hearth
#

Who do You want to restrict it to?

sturdy star
#

did you set up the permissions?

#

@pale sapphire please show your script

#

okay, so my script for banning members looks like this

#
    if(!message.member.hasPermission('BAN_MEMBERS')) 
        message.channel.send("You don't have following permissions: ``BAN_MEMBERS``");
    else {
        let bannedMember = await message.guild.members.ban(args);
        if(bannedMember){

        try {
            console.log(bannedMember.tag + " is banned.");
            message.channel.send (`${bannedMember} has been banned!`)
        }
            catch(err) {
            console.log(err);
        }
    }
}
}

module.exports.config = {
    name: "ban",
    description: "Bans a Users",
    usage: "!ban",
    accessableby: "Admins",
    aliases: []
}```
pale sapphire
#

Okie

#

Wait i am showing

#
    if (!message.guild) return;
    if (message.content.startsWith('>kick')) {
      const user = message.mentions.users.first();
      if (user) {
        const member = message.guild.member(user);
        if (member) {
          member
            .kick({
              reason: 'They were bad!',
            })
            .then(() => {
              message.reply(`Successfully kicked ${user.tag}`);  
              console.error(err);
            });
        } else {  
          message.reply("That user isn't in this guild!");
        }
      } else {
        message.reply("you didn't mentioned user to kick");
      }   
    }    
}); ```
#

@sturdy star mine looks this

#

I am figuring

#

Where to add
message.member.hasPermission('KICK_MEMBERS')

#

This one

sturdy star
#

you didn't put the permissions

#

@pale sapphire you have to do like this

pale sapphire
#

Yea i know

#

I tried to fit it

#

But then it had errors

sturdy star
#

use that code

#

i showed before

young flame
#

@pale sapphire ok

#

here

#

your doing ban right

#

discord.js?

pale sapphire
#

Can i get the right one code pls

young flame
#
await member.ban({ days: 7, reason: `${(reason)}` })
      .catch(error => message.reply({ embed: { color: ('RANDOM'), description: (`Sorry ${message.author} I couldn't kban because of : ${error}`) } }));
#

they did a mini update

#

but thats mines

#

you can take reason out

#

if you want

pale sapphire
#

@young flame thanks moon

young flame
#

np

rocky hearth
#

hey Moon-Chan, I fixed my problem

young flame
#

o

#

das good

pale sapphire
#

@young flame hey can you just do a small favour

#

Just write

#

And in end of code```

young flame
#

For future references for code errors or problems moon's dev help hours are all the time so just dm me lmao

#
before code

and in of code
pale sapphire
#

Lol

young flame
#

???

pale sapphire
#

Yes like this

young flame
#

wait my code

pale sapphire
#

Send me code like this

young flame
#

like my full code lmao

#

oh okay

earnest phoenix
#

@young flame dont spoonfeed btw

young flame
#

i'm not bruh

#

if i was spoonfeeding you would see alot more that that

earnest phoenix
#

Well eh

pale sapphire
#

Wat is spoonfeeding?

young flame
#

when instead of letting them develop it on there own you just give them what there needing

pale sapphire
#

I made the btw