#development

1 messages · Page 1458 of 1

delicate shore
#

Nvm

#

Wait

#

what

earnest phoenix
#
const str = `\`gay\``;
delicate shore
#

OHH

#

umm

#

Why don't my bot wait

#

for user to reply first

earnest phoenix
#

what is your code

delicate shore
#

ok

earnest phoenix
#

ok what

#

He asked for your code

#

Just show the code

delicate shore
#

Let me paste on hastebin bruh

earnest phoenix
#

Ok, do it.

#

Wt

#

No

#

With links

#

Without links

delicate shore
#

what

earnest phoenix
#

Just paste it on your chat

#

no

delicate shore
#

Its 2k+ char cant

earnest phoenix
#

Or send ScreenShot

#

Oh

#

Uh

#

people prefer using bin services

#

Ok

#

@delicate shore is that your own collector

delicate shore
#

nah

#

npm

earnest phoenix
#

why not just use the official one

delicate shore
#

official one?

#

wha

earnest phoenix
delicate shore
#

wait what

summer torrent
#

lol

pale vessel
#

Probably easier to use awaitMessages for your use case

earnest phoenix
#

that too

earnest phoenix
#

yes it is

#

it's native to the library, so yes, it's official

delicate shore
pale vessel
earnest phoenix
#

Like all discord librarys it's made by other people, not discord.

#

libraries*

pale vessel
#

Are you high?

earnest phoenix
#

Ya

#

also

#

Sorry, i'm still learning english lol

delicate shore
#

Thanks

#

flapeze and cry

pale vessel
#

He's talking about the class

earnest phoenix
#

the context here is discord.js, not multiple libraries
we understand it's discord.js that's being talked about

saying "use the official one" is equivalent of saying "use the official discord.js MessageCollector"

#

but that would be pleonasm

#

because we're aware of the context and our subject

#

Oh

#

Ok

#

start a petition to get a new english teacher

#

xD

#

I learn by myself

#

Wait

#

I'm the most advanced of my class

#

🤔

earnest phoenix
#

Hey

#

Is there a way to sort Collections

#

I want the keys in bot.commands to be sorted in alphabetical order

#

@pale vessel uwu

pale vessel
#

collection.sort();

earnest phoenix
#

does it work in the same way as Array.sort

pale vessel
#

Yes

earnest phoenix
#

🆗

edgy tapir
earnest phoenix
#

@edgy tapir you're sending the embed wrongly

edgy tapir
#

wdym ?

earnest phoenix
#

it's message.channel.send({ embed: p}); not message.channel.send({ p });

edgy tapir
#

oh

earnest phoenix
#

See line 41

edgy tapir
#

i haven't code since v11, lot's of things changed

#

but other commands work with just message.channel.send(embed)

earnest phoenix
#

@edgy tapir because there are no braces

edgy tapir
#

still don't work

#

even with ({ embed: p })

earnest phoenix
#

..

edgy tapir
earnest phoenix
#

@edgy tapir

this:

let result = Math.floor((Math.random() * raspunsuri.length));

It literally just returns a number not a random element from the array

#

(Doesn't have anything to do with the embed not working)

edgy tapir
#

Ok, but why the bot is not sending any message?

earnest phoenix
#

idk

#

the code seems correct

#

ask @pale vessel

pale vessel
#

is there an error

#

Show your code

delicate shore
#

My code is

let channel = reply.mentions.channels.first().id || client.guilds.cache.get(reply.content).id || reply.channel.id
#

Bruh

#

Screenshot cropped wrong way

#

Here

earnest phoenix
#

uhh how da fuk is client.guilds.cache undefined

delicate shore
#

Idk

earnest phoenix
#

@delicate shore u sure that's discord.js v12

delicate shore
#

Yes mate

earnest phoenix
delicate shore
#

12.5.1

pale vessel
#

are you sure that's where the error came from

delicate shore
#

Yes

pale vessel
#

Debug

#

console.log(client.guilds);

midnight viper
#

What happened to guildMemberAdd it doesnt work for me but it worked before and I didnt touch the code

pale vessel
#

You need the guild members intent to receive that event

midnight viper
#

ty

feral aspen
#
if(message.content.includes("@feral aspen")) {
        if(message.guild.id !== "721372685275234436") return;

        const muterole = message.guild.roles.cache.find(role => role.name === "Muted")
        const mutee = message.author;

        mutee.roles.add(muterole)

        const embed = new Discord.MessageEmbed()
        .setColor(colors.cyan)
        .setDescription("You have been muted for pinging the owner.")

        return message.channel.send(embed)
    }
```Im trying to make something where if someone pings me on my server, it returns.. didn't work.
earnest phoenix
#

I sorted my commands by basically cheating

bot.commands.sort((a, b) => {
	let arr = [a.name, b.name];
	
	arr.sort();
	
	return arr.indexOf(a.name) - arr.indexOf(b.name);
});
summer torrent
#

@feral aspen use message.mentions.users.first()

midnight viper
#

aaaaaaa I know how to type what does guild members intent mean

pale vessel
#

Go to your bot developer portal

earnest phoenix
#

@feral aspen rude you're muting people for pinging you

feral aspen
#

No, I'm not making a mute command, I'm making a message event where if someone random goes to ping me on my server, it would mute him by adding him the mute role, but it doesn't work...

#

Mind helping?

earnest phoenix
summer torrent
feral aspen
#

Why would I need args?

pale vessel
feral aspen
#

I'm not trying to do something like !mute <user>

pale vessel
#

client.commands.sort((x, y) => sortAZ(x.name, y.name))

earnest phoenix
#

sorry what

#

math operations on strings tfw

feral aspen
#

code913, you can help please?

feral aspen
#

I want to do something like if someone random pings me, he will get muted.

summer torrent
#

it is not an args

#

it is message's mentions collection

#

you can find your id in this collection

pale vessel
#

if (mentions.has("528256079101034506")) slapMute();

summer torrent
#

:slap:

earnest phoenix
#

slap moot kek

feral aspen
#

I'll try above.

#

It yet didn't work to mute.

#
if(mentions.has("@feral aspen")) {
        if(message.guild.id !== "721372685275234436") return;

        const muterole = message.guild.roles.cache.find(role => role.name === "Muted")
        const mutee = message.mentions.users.first()

        mutee.roles.add(muterole)

        const embed = new Discord.MessageEmbed()
        .setColor(colors.cyan)
        .setDescription("You have been muted for pinging the owner.")

        return message.channel.send(embed)
    }
earnest phoenix
#

I don't get the point why you want to mute people for pinging

You're the bot dev of course people will ping you for help

pale vessel
#

Replace mentions with message.mentions

#

and use your ID, not your mention

#

Just 528256079101034506

earnest phoenix
#

@pale vessel message.mentions.users bruh

pale vessel
#

Both work bruh

#

Try it

earnest phoenix
#

smh

austere herald
#

I wonder if you can throw it from the v12 help menu special?

feral aspen
#

It didn't work yet...

#

whatever, I'll leave it now.

earnest phoenix
feral aspen
#

And I'm not only wanting to do mute, I want it to make send a message example don't ping owner or somthing

earnest phoenix
#

even the team members and mods here of this 140k members server have ping notifs enabled

trim badger
#

Can someone explain the new "slash commands"

summer torrent
delicate shore
#

Yes they are pretty easy

earnest phoenix
#

@summer torrent

#

where can I report a raider

#

i have proofs

summer torrent
#

DM a mod

proven ivy
#

how to refresh cache?

earnest phoenix
#

which cache

novel snow
#

how would i be able to get discord.js to send a message to a specific channel via its id when a user joins the server?

delicate shore
#

Ok guys

#
[
  {
    "artists": [
      {
        "external_urls": {
          "spotify": "https://open.spotify.com/artist/5a2w2tgpLwv26BYJf2qYwu"
        },
        "href": "https://api.spotify.com/v1/artists/5a2w2tgpLwv26BYJf2qYwu",
        "id": "5a2w2tgpLwv26BYJf2qYwu",
        "name": "SOPHIE",
        "type": "artist",
        "uri": "spotify:artist:5a2w2tgpLwv26BYJf2qYwu"
      }
    ],
    "duration_ms": 188520,
    "episode": false,
    "explicit": false,
    "external_urls": {
      "spotify": "https://open.spotify.com/track/18yTgk0VgjB9XDj8h2q6Td"
    },
    "href": "https://api.spotify.com/v1/tracks/18yTgk0VgjB9XDj8h2q6Td",
    "id": "18yTgk0VgjB9XDj8h2q6Td",
    "name": "JUST LIKE WE NEVER SAID GOODBYE",
    "popularity": 34,
    "preview_url": "https://p.scdn.co/mp3-preview/d5790004de973f83756311075125ffc965e522c8?cid=a46f5c5745a14fbf826186da8da5ecc3",
    "type": "track",
    "uri": "spotify:track:18yTgk0VgjB9XDj8h2q6Td"
  }
]```
#

I have an array like this

#

for each song

#

I want to get Name of each one

#

Like I don't wanna get artist

#
var s = require("spotify-url-info")
 s.getTracks("https://open.spotify.com/playlist/3Q4cPwMHY95ZHXtmcU2xvH").then(a => {
 a.forEach(song => {console.log(song.name)})
 })
#

It gives artist not song

analog imp
#

like you want to get this?

"name": "JUST LIKE WE NEVER SAID GOODBYE",
delicate shore
#

yes

analog imp
#

i would use a forEach loop

delicate shore
#

It returns me SOPHIE

#

That is the artist

#

But i want song's name

#

oh wait

#

Nvm

#

Thanks for answering tho

analog imp
#

ohhhh

#

gotcha

proven ivy
earnest phoenix
#

why would you want to do that though

#

djs automatically updates the cache as the events come

delicate shore
#

Guys how do I push an array in mongoose

#

I have an array [ url, url ,url , uek]

#

first I added an object song: array in my schema

pale vessel
#

Use push xd

#

Like js model.updateOne(filter, { $push: { songs: url } });

gusty quest
#



error is here:
let money = await db.fetch(`money_${message.author.id}`);```
earnest phoenix
#

@gusty quest message.author is undefined

gusty quest
#

lol i found problem in index.js

#

now i have this problem

#

but its defined here:

let amount = await db.fetch(`money_${difarr[i].id}`);```
earnest phoenix
#

amout

gusty quest
#

Omg

#

IM dumb

#

sry

#

ty @earnest phoenix lol

drowsy epoch
#

How do u make a djs bot show the shards its in on the status

quartz kindle
#

.setActivity("bla", { type "WATCHING", shardID: YOUR SHARDID HERE })

delicate shore
#
0|index  | TypeError: Cannot read property 'replace' of undefined
0|index  |     at Client.<anonymous> (/root/Black Sheep/bot.js:239:35)
0|index  |     at runMicrotasks (<anonymous>)
0|index  |     at processTicksAndRejections (internal/process/task_queues.js:97:5) Unhandled Rejection at Promise Promise {
0|index  |   <rejected> TypeError: Cannot read property 'replace' of undefined
0|index  |       at Client.<anonymous> (/root/Black Sheep/bot.js:239:35)
0|index  |       at runMicrotasks (<anonymous>)
0|index  |       at processTicksAndRejections (internal/process/task_queues.js:97:5)
0|index  | }

#
client.on('guildMemberAdd', async(member) => {
// mention , usertag , memberCount
  const welcome = await welcomeinfo.findOne({
    GuildID: member.guild.id
  })
  if(!welcome) return
  if(welcome){
    if(welcome.status !== "yes") return
    let channel2 = await member.guild.channels.cache.get(welcome.channel)
    let message2 = welcome.message
    let message3 = await message2.replace("{mention}", member);
    let message4 = await message3.replce("{usertag}" , `${member.user.username}#${member.user.discriminator}`)
    let finalmsg = await message4.replace("${memberCount}", member.guild.memberCount)
    channel2.send(finalmsg)
  }
})```
#

Line 239 is let message3 = await message2.replace("{mention}", member);

carmine summit
#

message2 is an object?

delicate shore
#

It's a str

carmine summit
#

Try logging welcome

delicate shore
#

ok

#

@carmine summit

0|index    | {
0|index    |   _id: 5fd9a346c693a6c4900f41ce,
0|index    |   GuildID: '690557545965813770',
0|index    |   status: 'yes',
0|index    |   channel: '783585413406654464',
0|index    |   __v: 0
0|index    | }
#

It logged this

#

there is no message

#

why

carmine summit
#

There ya have it

#

No message

delicate shore
#

But how

pale vessel
delicate shore
#

I don't get it

pale vessel
#

replce

carmine summit
#

replce

delicate shore
#

lol

#

That's why you don't use mongoose

#

I am going back to quick.db

#

WHY IS THERE NO MESSAGE

#
const mongoose = require('mongoose');

const setwelcome = new mongoose.Schema({
    status: {
        type: String
    },
    channel: {
        type: String
    },
    message: {
        type: String
    },
    GuildID: String
});

const MessageModel = module.exports = mongoose.model('welcome setting', setwelcome);```
#

This is my welcome.js

#
 let newData = new welcomeinfo({
          GuildID: reply2.guild.id,
          status: "yes" , 
          channel: channel , 
          message: welcomemsg
      })
      newData.save()
#

How I save my data

#

Any idea?

old cliff
#

Se mongoose socs

pale vessel
#

specify the database name

old cliff
#

^docs

pale vessel
#

It's probably trying to save it to the welcome settings database

trim atlas
#

@Nekomaki#0001

delicate shore
#

what do you mean?

pale vessel
#

That's your database name?

#

With the s?

delicate shore
#

?

#

It's welcome settings

pale vessel
#

???

delicate shore
#

Yes

#

with the s

pale vessel
#

Hmm

delicate shore
#

See this Flazepe

pale vessel
#

What is the problem? Message not updating?

delicate shore
#

It doesnt save message

#

you can see in schema

#

But in db message isnt ther

old cliff
#

Whats that cluster thingy ?

tight plinth
#

so i'm trying to make a slash command with some args. for now, i use this json code but the it returns "invalid form body" because of the options field (works fine w/o), and i dont see where is my error

old cliff
#

Interface thingy

tight plinth
#

the command appears bc i already created so im trying to edit it for it to do smth w/ args

#

oh wait is options an array or smth

#

alright figured out how to create a command, imma do the webhook thingy after that

earnest phoenix
#

@delicate shore u still need help?

delicate shore
#

I will figure it out

#

Thanks

young olive
#

i heard I can use CSS on my bots page but I dont know how lol

I only want to change my BG color Xd

zenith terrace
#
<style>
body {
  background-color: hexCode
}
</style>```

@Skipper#4904
#

@young olive

#

Should be it

#

Hopefully

young olive
#

oook thx

pale vessel
#

@tight plinth It's r.d.id I'm assuming

tight plinth
#

k

pale vessel
#

r is the raw data and d is the payload object

tight plinth
#

only the first console.log works aka after the if

pale vessel
#

The data needs to be in stringified JSON

#

you also have to send the content type header

#

Not sure how it works in axios, I use node fetch

novel snow
#

I been keying with this shitty system for the past 3 hours, How on earth do I get a discord.js bot to send a message to a channel specified by an id?

tight plinth
#

so from the data field

pale vessel
tight plinth
#

the problem is not from that

#

axios "JSONifies" it

cinder patio
#

um, maybe you want to rename the data field to body? Never used axios so maybe it's data though

pale vessel
#

Oh

#

Pretty sure it's data in axios

#

I've never used it either

#

Axios seems like a pain

#

I made my own wrapper of node's http(s) request that works almost same way as node-fetch

#

It's so easy to use

cinder patio
#

I don't understand why people you use it... and node-fetch also comes with discord.js by default

cinder patio
#

like why install axios when node-fetch does the same thing and it's already in your node_modules folder

pale vessel
#

tru

#

Fetch gives me control of what I'm requesting

tight plinth
pale vessel
#

What about the headers?

#

"content-type": "application/json"

tight plinth
#

that's automatic

pale vessel
#

hm

#

oh wait

#

you need to use { data: { type, data: { } } }

tight plinth
#

oh?

pale vessel
#

did you read docs

#

you need to give type too

tight plinth
#

yes i did

pale vessel
#

Axios seems so trash

tight plinth
#

nah im just bad at http requests

#

aand fixed

#

thanks

earnest phoenix
mellow kelp
#

Nah axios pretty gud

earnest phoenix
#

it's two lines of code and thats it PGamerX

delicate shore
#

It was that there were many record with same server id because I forgot to delete than after testing

#

So it was getting confused

#

I removed all except one and it worked

#

And I was using guildID instead of GuildID in my bot code

#

Fixed that

earnest phoenix
#

oh ok

tight plinth
#

the code to create global slash commands only has to be executed one time, right?

pale vessel
#

Yes

tight plinth
#

ok

#

well time to wait one hour for it to be available ig

#

and if the app gets added to a new server and that the slash command already exists do i have to redo the creation process or it's created instantly

pale vessel
#

What do you mean?

#

For global commands?

amber badge
#

hey there

#

i just have coded a faq bot, now i want to add one more feature for our staff

#

that´s what i want to add

If a player with the roleID 755841728950566994 types !promote, then the player gets a rank and the bot writes an embed in a channel with the ID 762384738270838815 and tells something like: The Player "" has been promoted to Architect

If a player with the roleID 755850280704278581 types !promote, then he has two choises. He can either write !promote Supporter [Player] or even !promote Moderator [Player]. Then the bot writes an embed in a channel with the ID 762384738270838815 and tells something like: The Player "" has been promoted to Supporter or Moderator

If a player with the roleID 755864075623202896 types !promote, then the player gets a rank and the bot writes an embed in a channel with the ID 762384738270838815 and tells something like: The Player "" has been promoted to Developer

If a player with the roleID 755850280704278581 types !promote, then he has several choises. He can either write !promote Supporter [Player], !promote Moderator [Player], !promote Sr.Moderator [Player], !promote Sr.Architekt [Player], !promote Dev [Player] or even !promote Sr.Dev [Player]. Then the bot writes an embed in a channel with the ID 762384738270838815 and tells something like: The Player "" has been promoted to that rank

In all cases the bot even reacts with an emoji at the message he sent in 762384738270838815

I just started coding that but don´t know further, may someone help me?

past needle
#

(that's

mellow kelp
#

you can check the user's roles

past needle
#

really

pale vessel
#

Gosh I thought this was a copy pasta

past needle
#

complicated

#
if(message.member.roles.cache.has("role id")){
// smt
} else if(message.member.roles.cache.has("role id")){

} // etc..
pale vessel
#

if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if () else if ()

mellow kelp
#

sad switch case noises

earnest phoenix
#

omg yandev!! please sign my body pillow!!

pale vessel
#

Kinda cringe

#

sent this and got banned instantly

mellow kelp
#

lmfao

#

some guy entered as "TheCumChalice"

pale vessel
#

Typical lol

mellow kelp
#

got banned instantly

pale vessel
#

They must have a nice ban list

earnest phoenix
#

how come that anyone who tried to make something in the direction of yansim is never mentally stable

#

probably because the idea of yansim wouldn't come to a mentally stable person

mellow kelp
#

probably

#

but i mean the game actually had a lot of potential

earnest phoenix
#

there was also love letter

#

i had high hopes

#

but the lead dev was a pedo furry

mellow kelp
#

oh yea that happened to that?

#

ah shoot

earnest phoenix
#

and the project fell apart

#

they were acting superior

#

but the game had SNES game graphics lol

mellow kelp
#

lmfao

#

hey tried out advent of code?

earnest phoenix
#

i did first two days then gave up because i'm too lazy

mellow kelp
#

understandable, have a great day

earnest phoenix
#

lmfao

#

croatia is having a second wave

#

so we're basically under lockdown again

mellow kelp
#

oh dang

earnest phoenix
#

and i lost the feel for time and space

mellow kelp
#

here the second wave is almost there

quartz kindle
#

this is not the second wave, its the third

mellow kelp
#

just gotta wait for some more stupid people to keep partying and drinking

quartz kindle
#

actually, we're starting to enter the 4th wave

earnest phoenix
#

ooof

mellow kelp
#

darn

#

big oof

quartz kindle
#

well, more like third wave part 2

crimson vapor
#

you guys are past the first one?

south sinew
#

we passed our first one in june, but now we are seeing a spike almost 3 times that of the initial

hasty mulch
#
@commands.command(name='embed-weather-crash')
@commands.has_permissions(manage_guild=True)
@commands.guild_only()
async def _weatherembedcrash(self, ctx):
    if self.weatherembed_loop.is_running():
        channel = ctx.bot.get_channel(742179037643800596)
        embed=discord.Embed(
            type='rich',
            colour=discord.Color(0xFF0000),
            description=f'''
**WEATHER LOOP CRASHED:**
#city-information

**CRASHED BY:**
{ctx.author.mention}
'''
                )
        embed.set_footer(text=f'ID: {ctx.author.id}')
        embed.timestamp=datetime.datetime.utcnow()
        embed.set_author(name=ctx.guild.name, icon_url=str(ctx.guild.icon_url))
        await channel.send(embed=embed)
        if ctx.channel.id == 741735054010482769 or ctx.guild.id == 717441612757729300:
            await ctx.send("Loop stopped!")
            self.weatherembed_loop.cancel()
        elif ctx.channel.id == 771353867694506026:
            channel2 = ctx.bot.get_channel(741735054010482769)
            await ctx.message.delete()
            await channel.send(f'{ctx.author.mention}: Loop Stopped!')
            self.weatherembed_loop.cancel()
        elif ctx.channel.category_id in [740622346800463974, 741754307216408656, 741750821871550562]:
            await ctx.send(':x: | This command can only be used in [#741735054010482769](/guild/264445053596991498/channel/741735054010482769/)')
            print(f'Command r!{ctx.command} used in #{ctx.channel} by {ctx.author.name}')
        else:
            await ctx.message.delete()
            await ctx.send('(This command can only be used in [#741735054010482769](/guild/264445053596991498/channel/741735054010482769/))', delete_after=7)
            print(f'Command r!{ctx.command} used in #{ctx.channel} by {ctx.author.name}')
        print('Loop has been crashed')
        pass
    pass
#

If statement doesn’t work in Python

earnest phoenix
crimson vapor
#

what does it return?

earnest phoenix
#

Nothing yet, but it should still appear

hasty mulch
#

The bots need to be re-invited for slash commands to work

earnest phoenix
#

What

crimson vapor
#

I thought they just needed perms

#

hmmm

hasty mulch
#

Nope, that’s what people are saying

earnest phoenix
#

It would make no sense for them to be re invited for them to work

hasty mulch
restive furnace
#

or wait to jan 2021 @earnest phoenix

novel snow
#

I been keying with this shitty system for the past 3 hours, How on earth do I get a discord.js bot to send a message to a channel specified by an id?

mellow kelp
#

the bot has a channel cache

pale vessel
mellow kelp
#

you get the channel you want by id and send the message

pale vessel
#

and you don't need to reinvite the bot every time, only once for the aplications.commands scope

wooden ember
dire obsidian
#

Well so, somebody know to how get data from a file in a <input type="file">?

pale vessel
#

A backend

dire obsidian
#

thanks

earnest phoenix
#

you don't need a backend for that 🤔

mellow kelp
#

document.getElementById('your-input').files

earnest phoenix
#

Yea i already got it

hasty mulch
#

Alright

earnest phoenix
#

Gotta authorize that scope

#

Man these slash commands are

#

Loggers

hasty mulch
#

Do you need to apply for it?

earnest phoenix
#

Nope

hasty mulch
#

Ok

earnest phoenix
#

Create a slash command
Authorize the bot with the applications.commands scope
Listen to the INTERACTION_CREATE event and send a callback

#

Pretty loggers

hasty mulch
#

Meh, not worth it for me

earnest phoenix
#

slash commands suck anyways lol

#

they're so restrictive

#

using them is equivalent of comparing your dick size

#

you'd only use them to show you can use them

#

hey

pale vessel
#

LMAO

mellow kelp
#

what an epic comparison

pale vessel
#

epic

earnest phoenix
#

how can i make my bot DM me when someone made a suggestion?

mellow kelp
#

you can get your user by id

#

and send a message

pale vessel
#

Calling it right now

#

Just don't do it

#

Drop the idea

earnest phoenix
#

the suggestion command is for bot suggestions

pale vessel
#

Redirect the user to your support server

#

Don't make a command for it

earnest phoenix
#

here's a better idea, remove the command and do that instead ^

#

ok so

#

how can i make my bot send a message to a specific channel

#

lmfao

crimson vapor
#

fetch the channel and send a message

mellow kelp
#

client.channels.cache

earnest phoenix
#

I actually have a suggestion command that goes into a suggestion channel in my support server

pale vessel
#

yike

earnest phoenix
#

people are going to abuse things like that

earnest phoenix
pale vessel
#

Use client.channels.fetch(id)

earnest phoenix
#

oh right

#

It has a cooldown, to prevent spam, and the channel doesnt allow everyone to see the channel history, so I think it's fine

#

always design your code as if a 4chaner is going to abuse it

mellow kelp
#

yea

#

prepare for the worst

earnest phoenix
#

never assume the end user has good intentions

#

yup

#

wait

#

the ID must be with ""

#

?

pale vessel
#

Yes

earnest phoenix
#

ok thx

edgy tapir
crimson vapor
earnest phoenix
#

@pale vessel you alive?

pale vessel
#

yeah

crimson vapor
#

its 10 pm for him

earnest phoenix
#

is this ok?

pale vessel
#

await it

earnest phoenix
#

okay

pale vessel
#

channels.fetch() returns a promise

crimson vapor
#

or use .then but await is cleaner

pale vessel
#

if you use .then() you must love callbacks

#

well maybe because the function isn't async

#

but you can easily make it async

#

i guess rare use cases

earnest phoenix
#

i made it async

crimson vapor
#

flaze what else should I try to store data in? so far we have files and file names

pale vessel
#

your balls

crimson vapor
#

lol

earnest phoenix
#

what he said

crimson vapor
#

why didn't you just reply and say this

earnest phoenix
#

YEAH

earnest phoenix
#

it works

#

@pale vessel thx!

crimson vapor
#

nice

boreal iron
#

Now, pay the bill!

#

support is not for free okeh

crimson vapor
#

I think it is

earnest phoenix
#

not

#

wait

#

also, how can i make it DM someone

#

after a command

#

(an specific user)

#

<Member>.send('shush')

earnest phoenix
#

<Member> being the user

#

but

#

what about if the command is used on another guild

#

i want to make it DM me

#

?

pale vessel
#

client.users.fetch(id)

earnest phoenix
#

oh thx

pale vessel
#

Fetch the user (you) and send a message

earnest phoenix
#

with await, right?

earnest phoenix
pale vessel
#

yeah

earnest phoenix
#

thx for help guys

#

❤️

#

np

brittle copper
#

I stepped away for 2 minutes and this channel blows up lol

pale vessel
earnest phoenix
#

i don't see any explosives

brittle copper
#

Speaking of bots

#

Where do you people get motivation/inspiration for new commands?

mellow kelp
#

i have no idea KEKW

brittle copper
#

'Cuz I want to make new commands for my bot so it isn't absolutely barebones (and drowned out by more useful bots), but I don't want to copy other bots, either

#

hence why I'm not gonna ask for 'what commands should I add'

cinder patio
#

find a niche

brittle copper
#

I mean

#

not many bots offer a universal item system that's used across shops, games, and a custom scripting language

#

But I doubt the average person really cares all that much

cinder patio
#

the average person is stupid, if the feature is even a little complex, they'll start searching for alternatives

mellow kelp
#

kinda agreed

#

example of "work smart, not hard"

brittle copper
#

But I mean, there are some technically inclined people that do care, and those that take interest (or appreciation for the tens of thousands of man hours that're put into development) in relevant features :p

novel snow
#

Am I dumb or does this not work?

client.on('guildMemberAdd', (member) => {
  const mainChannel = client.channels.cache.get('776209259196711017');
  mainChannel.send('Welcome ' + member + '!');
});
mellow kelp
#

maybe the channel is not in cache

novel snow
#

how would I be able to send a message to a channel that is not in the cache?

pale vessel
#

No errors?

novel snow
#

No errors

pale vessel
#

You fetch the channel

#

Ah, that means that the event didn't trigger

#

Do you have the guild members intent?

mellow kelp
#

yea maybe that

novel snow
#

How do you mean?

pale vessel
#

Enable that intent under the bot section in your developer portal

novel snow
#

aight, ill test it in a sec

main trench
#

@hollow sedge after like half the night figuring this out i learned that quick.db cannot be used for a bl command

pale vessel
#

It can

crimson vapor
#

why could it not?

#

quick.db allows you to use arrays right

pale vessel
#

Yeah

#

Even has a push method

crimson vapor
#

just push the user's id to a blacklist array

young olive
#

I wanted to know how I my bot page can have an floating pfp too :)

boreal iron
#

Use CSS in your bot's edit description to animate the picture.

burnt wraith
#

So, I'm trying to make a server where whenever someone posts something in a specific channel, their message is deleted and reposted as a message from an NPC automatically.
The background is basically just that I want people to make official statements as news outlets without having to change nicknames and shit.

Does anyone know how to do this??? Please help. Thanks.

young olive
#

yeah but what do i have to use Xd

boreal iron
#

to manipulate the existing elements on the top.gg site

young olive
#

im not really into CSS

crimson vapor
#

no one is

boreal iron
#

no one is

mellow kelp
#

css hurts my brain

boreal iron
#

I wonder why.

novel snow
burnt wraith
#

you think css is bad try html boi

crimson vapor
#

html makes sense

mellow kelp
#

html is easier lmao

#

css is just

burnt wraith
#

lmao

mellow kelp
#

instant stroke

burnt wraith
#

So, I'm trying to make a server where whenever someone posts something in a specific channel, their message is deleted and reposted as a message from an NPC automatically.
The background is basically just that I want people to make official statements as news outlets without having to change nicknames and shit.

Does anyone know how to do this??? Please help. Thanks.

novel snow
pale vessel
#

Yes

boreal iron
#

First of all, stop repeating it over and over again

boreal iron
#

lmao

#

saw that

burnt wraith
#

what do you mean webhooks

crimson vapor
#

webhooks!

burnt wraith
#

thanks

#

lmao

pale vessel
#

Reverse API

#

basically

novel snow
#

Webhooks are the only way to have messages being sent as someone else, or someone custom,

crimson vapor
#

IPA === Webhook

pale vessel
#

instead of you making a request, the API does that to you

novel snow
#
client.on('guildMemberAdd', (member) => {
  const mainChannel = client.channels.cache.get('776209259196711017');
  mainChannel.send('Welcome ' + member + '!');
});

idk why this doesnt work though...

pale vessel
#

try adding a console.log("test") to the first line

crimson vapor
#

no

pale vessel
#

a

crimson vapor
#

a > test

novel snow
#

b > *

crimson vapor
#

you already have your hand on a

boreal iron
#

wow geniuses... how about console log the mainChannel var?

crimson vapor
#

nah

boreal iron
#

would be to easy, aye

earnest phoenix
#

How about logging both member and mainChannel

pale vessel
#

what about delete the fucking bot

earnest phoenix
#

🧠

novel snow
#

good idea

boreal iron
pale vessel
#

They would have gotten an error otherwise

crimson vapor
#

eval js if (logic) process.exit()

boreal iron
#

nope, throw error

earnest phoenix
#

this.developmentChannel.setForbidden.bind(this)(this.logic)

boreal iron
#

channel crashed

dire obsidian
#

if i want to make a "enable dark mode" i should change every object propety using object.style.propety = "propety"?

earnest phoenix
crimson vapor
#

is that betterdiscord?

earnest phoenix
#

ye

#

i mean the bot

crimson vapor
#

betterdiscord is against tos

earnest phoenix
#

aight

crimson vapor
#

better to not post pictures

wet dove
#

@crimson vapor we dont moderate for that

crimson vapor
#

you don't but im sure there are kids who do

outer perch
#

So, a question about organizing files:
I have a couple of JSON files in the root directory, but commands, iamges, fonts and languages have their own folders. Should I create a folder for the JSON files or keep them at the root directory?

earnest phoenix
#

im not using better discord to be malicious lmao, it just looks better

outer perch
#

If so, any idea on what the folder's name should be?

boreal iron
#

src

outer perch
#

alright

crimson vapor
#

I am just saying be careful

boreal iron
#

following common data structures

novel snow
#

@pale vessel well, been keying around some more, but it doesn't log anything in the console either when the event is called...

outer perch
#

sure, a programmer should always be organized

#

ty

pale vessel
#

Are you sure you enabled the intent

novel snow
#

brb

crimson vapor
#

is there an article about folder structure for nodejs?

boreal iron
#

yeah, makes your life easier

mellow kelp
crimson vapor
#

I havn't been able to find common ones

novel snow
outer perch
pale vessel
#

Did you define intents under clientoptions?

outer perch
#

that's why I asked by myself here

novel snow
pale vessel
#

It's not mandatory in api v7 but you should try it

#

wait

outer perch
#

btw, should config.json be in src too?

pale vessel
#

Select the events you need in https://ziad87.net/intents/ and get the number. Put the number in your ClientOptions under ws new Discord.Client({ ws: { intents: <number here> } });

mellow kelp
pale vessel
#

You can give an array too but number is easier

earnest phoenix
novel snow
#

ight brb

earnest phoenix
#

which are the examples

outer perch
mellow kelp
#

wut

outer perch
#

config.json has the Token and the Prefix

#

most of tutorials leave it at the root directory

#

even though we can all put it in a folder

mellow kelp
#

maybe

novel snow
mellow kelp
#

in my case its because typescript

#

because it also moves the json files to the out folder

#

i just leave my token as an env variable

outer perch
#

yo epic pfp
same for yours, now that I'm thinking xD

crimson vapor
#

I leave tokens and stuff in config.json

mellow kelp
#

indeed KEKW

mellow kelp
#

same here except for the token

novel snow
outer perch
#

I still gotta know the difference between .env and just data as .json

crimson vapor
#

LOL

odd berry
#

Lol

#

🤣

crimson vapor
#

.env is more secure I want to say

mellow kelp
#

yea

#

its part of the enviroment itself

#

that way you can commit config.json without leaking anything important

outer perch
#

I commit my bot privately

mellow kelp
#

well k

crimson vapor
#

same but no reason to upload the token

mellow kelp
#

yea true

#

and its not that hard anyways

#

you just need dotenv and a .env file with your token

#

and add .env to .gitignore

outer perch
#

but my uploads to heroku are from github

mellow kelp
#

yea

#

in heroku you can set env variables in settings

outer perch
mellow kelp
#

ye

outer perch
#

that means I can now add config.json to the .gitignore file

#

🤔

mellow kelp
#

hmm

#

not quite

outer perch
#

how so?

mellow kelp
#

you can change where you put the token

#

instead of config.json

#

in .env

#

and add it to the heroku env variables

#

that way you can do process.env.TOKEN

outer perch
#

but, couldn't I get the whole data from config to .env?

mellow kelp
#

meh it might become less readable

#

i just use .env for private stuff

outer perch
#

sure

#

let me send something

novel snow
#
UnhandledPromiseRejectionWarning: Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

How imma fix this?

mellow kelp
#

hmm

sterile lantern
#

go to discord dev page

#

and switch on the intent you need on your bot

novel snow
#

brb

sterile lantern
#

if it’s 100+ servers you need to be verified and whitelisted

#

any discord

outer perch
#

from here I should choose to get inside .env just the tokens

novel snow
outer perch
#

right?

mellow kelp
#

yea

outer perch
mellow kelp
#

private stuff

outer perch
#

aight chief

novel snow
mellow kelp
#

on the bot section of your app

sterile lantern
outer perch
novel snow
night socket
#

Дайте бота

outer perch
#

those 2 intents are "open" until u get to 100 servers without whitelist @novel snow

sterile lantern
#

im pretty sure in the bot page

#

you can turn on the intent

night socket
#

Ауу

sterile lantern
#

i havent been on the page in a while so yea

night socket
#

Ррррпп

novel snow
umbral zealot
night socket
#

You speak Russian language

pale vessel
#

Well if it didn't work then it's something else other than intents

pale vessel
novel snow
#

UnhandledPromiseRejectionWarning: Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

umbral zealot
#

ARe you sure you have the right bot token

#

And your bot isn't verified, right?

#

just to be sure

pale vessel
#

They are toggleable so I'd assume no

umbral zealot
#

They'd show the same if they were on in a verified bot though

novel snow
#

It isnt verified, But it isnt in 100+ servers

#

Since the one I am working on now is one thats only on 1

pale vessel
umbral zealot
#

Then are you 100% sure you have the right token for the right bot

novel snow
#

Yes

earnest phoenix
#

i don't know if i should feel sad that that image had to be made

umbral zealot
# novel snow Yes

You're mistaken somewhere. Unverified bots would not get that warning with the intents enabled on the portal.

earnest phoenix
#

as if the switches weren't intuitive enough

novel snow
#

Ahahaha

#

guess what

umbral zealot
#

They're not actually intuitive tbh

novel snow
#

My dumb fucking ass missspelled the intents

umbral zealot
#

HAH.

novel snow
#

so it was calculating the entire permission wrong

outer perch
#

xD

terse finch
#

Is it possible to give users a role based on their other servers they are in? Like we have a sister server, and we wanted to show support for our sister users by giving them a role based on that server is there any feasible way to do that?

umbral zealot
novel snow
#

I am fucking stupid lmfaooo

pale vessel
#

nice

novel snow
outer perch
#

but you need their Roles ID @terse finch

terse finch
outer perch
#

and get their Guild onto ya bot

outer perch
terse finch
#

So the bot needs to be in both servers. Gotcha

#

I figured as much but wasn't sure if any of y'all knew a jank way of doing it instead

outer perch
terse finch
#

Thanks

mellow kelp
#

yo they finally got rid of those 3 steps on a new server's main channel

outer perch
#

let me show you a bit @terse finch:
message.channel.id == '787661396652589077' ? language = 'en' : language = await languages[message.guild.id];

#

this is an example that u can just get the ID, and do what you need

earnest phoenix
#

Why await?

umbral zealot
earnest phoenix
#

Accessing an array index is syncronous

umbral zealot
#

about damn time

outer perch
#
if (!languages[message.guild.id]) {
        const doc = await ref.get();
        languages[message.guild.id] = doc.get('language') || config.language;
    }
    let language;
    message.channel.id == '787661396652589077' ? language = 'en' : language = await languages[message.guild.id];
    const lang = require(`./languages/${language}.json`);
mellow kelp
#

imagine if accessing arrays was asynchronous

#

oh no

umbral zealot
outer perch
#

thought await would actually WAIT for the above code to execute

mellow kelp
#

ternary is pretty cool for certain stuff

outer perch
mellow kelp
#

unless you start nesting it

umbral zealot
#

it's what you did very wrong though

earnest phoenix
#

await only resolves a promise prototype

outer perch
umbral zealot
#

I just did 😛

#

const res = condition ? truevalue : falsevalue;

outer perch
#

I did that

#

message.channel.id == '787661396652589077' ? language = 'en' : language = await languages[message.guild.id];

#

I'll remove await tho

earnest phoenix
#

On assigning the value directly to the variable

umbral zealot
#

do you see the difference between the two though

#

mine's actually using the ternary as it's intended , for variable assignment directly

#

yours is... a... funky way, at best.

outer perch
#

hmmm

earnest phoenix
#

He does the same thing with extra steps

outer perch
#

🤦🏻‍♂️

umbral zealot
#
    let language;
    message.channel.id == '787661396652589077' ? language = 'en' : language = await languages[message.guild.id];

vs ```js
const language = message.channel.id == '787661396652589077' ? 'en' : languages[message.guild.id];

Which is cleaner?
outer perch
#

I could just define the variable directly

#

yeah I know

#

👍🏻 👍🏻 👍🏻 👍🏻 👍🏻

earnest phoenix
#

Also use strict equality operator instead of non-strict

outer perch
earnest phoenix
#

Yes

outer perch
#

can I ask what's the difference, just to make sure

boreal iron
#

in the context of how you're using it, it won't matter

#

but Voltrex will never be happy if things aren't like he wants them to be

earnest phoenix
#

Non strict one is unsafe and it tries to convert the first given value to compare to the instance of the second value to compare in primitive types, but the strict one only checks for direct value type comparison

outer perch
#

👍🏻 Java didn't have that

#

I actually tried once, it said to remove the = token xD

cinder patio
#

it doesn't have it cause it's a strongly typed language

#

=== in javascript is == in java

outer perch
#

👌🏻

mellow kelp
#

yea

#

== in javascript sucks

outer perch
#

so, when should I use == in JS?

boreal iron
#

shh... don't start the war again

mellow kelp
#

um

#

well == is pretty weird

earnest phoenix
mellow kelp
#

yea

#

23 == '23'

#

null == undefined

outer perch
#

ah

boreal iron
outer perch
mellow kelp
#

yeah kinda

earnest phoenix
#

Something about JS is that,
[] == []
false

mellow kelp
#

i find it confusing so i never use it

outer perch
#

it'll save from some problems

mellow kelp
#

i just convert types manually

outer perch
earnest phoenix
#

Yes

mellow kelp
#

i mean .toString() isn't that much effort

outer perch
outer perch
#

or .isNumber

mellow kelp
#

yeah

cinder patio
earnest phoenix
#

isInteger

mellow kelp
#

so i'd say never use == unless its a really strict case lmao

mellow kelp
#

wasn't it about memory allocation or something?

#

like

mellow kelp
#

perhaps

outer perch
#

big case

earnest phoenix
mellow kelp
#

understandable

earnest phoenix
#

Huge brain

boreal iron
#

Imagine saving any property of an obj as integer and changing that later into a string, using that property value in a statement in strict mode will fail, after being changed into a string

cinder patio
#

no, two different arrays can never be the same

mellow kelp
#

because they point to different memory addresses or something

outer perch
#

even though they have same values

earnest phoenix
#

I meant 2 arrays both with the same elements

outer perch
#

that's true

mellow kelp
#

like objects

#

objects cant be equal either

cinder patio
#

[1] === [1] will yield false

mellow kelp
#

thats because arrays are objects KEKW

#

im pretty sure { 0: 'foo', 1: 'bar'} is technically the same as ['foo', 'bar']

outer perch
#

tecnically

earnest phoenix
#

Wait, objects never equal to the other

outer perch
#

not logically

mellow kelp
#

nope

outer perch
#

but u can compare object values

#

can't u?

cinder patio
#

arrays and objects are optimized differently

earnest phoenix
outer perch
#

like

const obj1 = {0: '100', 1: '200'};
const obj2 = {0: '200', 1: '300'};

if I do obj1[1] === obj2[0], will be true, right?

cinder patio
#

of course

earnest phoenix
#

Pretty sure it will

cinder patio
#

depends on the type of the value...

outer perch
#

so what if

const obj1 = {0: '100', 1: '200'};
const array1 = ['200', '300'];

then obj1[1] === array1[0]?

earnest phoenix
#

Still yes

mellow kelp
#

yeah

#

but like

outer perch
#

that's all I need to assure

mellow kelp
#

an array would be an object with that

#

but also with its push(), pop() methods

#

etc

#
const array = {
  0: 'foo',
  1: 'bar',
  length: 2,
  push(element) {
    this[this.length] = element;
    this.length++
  }
};
#

yes

cinder patio
#

except that the interpreter optimizes arrays and objects differently

mellow kelp
#

yeah

outer perch
#

yea

mellow kelp
#

but thats the general idea i guess

outer perch
#

each day I come here, I love even more this channel

#

jeez, this is better than school

mellow kelp
#

indeed

opal plank
#

no need to be hasty mmulu this channel can be cancerous quite a few times a day

mellow kelp
#

im not paying attention to online classes rn for this

pale vessel
#

any time million mentions "jason"

crimson vapor
#

yes

mellow kelp
#

yes

pale vessel
#

it can get pretty chaotic

crimson vapor
#

no one has rated FileNameDB

#

makes me sad

brittle copper
mellow kelp
#

y

crimson vapor
#

nah very few real devs are here

#

maybe like 1/15

pale vessel
#

Tim 💯

crimson vapor
#

when will Tim get a Tim role?

misty sigil
#

tim

mellow kelp
#

tim

river peak
#

tim

#

tiiiiiiim

past needle
#

tim

river peak
#

timimimim

past needle
#

wait what am i doing on this channel

river peak
#

developing

#

duh

honest perch
#

I think tim doesn't like ts

pale vessel
#

no he said "fuck ts" once

honest perch
mellow kelp
#

y

#

ts is love

#

ts is life

#

he looks like hes having a mental breakdown lmfao

misty sigil
#

ourcord code is making Tim have a mental breakdown

#

lMao

earnest phoenix
#

Tim is contributing but he's gonna be a whitename after seeing all the spaghetti TS

outer perch
crimson vapor
#

@quartz kindle you ok after coding in ts?

#

no one here wants to see you get hurt

quartz kindle
#

im getting help from erwin and he said your entire lib is bad so its not my fault

#

lmao

#

btw your lib doesnt install on node 15

crimson vapor
#

LMFAO

mellow kelp
#

oh dang

outer perch
#

what about that library to just send 5

mellow kelp
#

we should convert it to ts lmao

crimson vapor
#

no he means ourcord

#

not jason.db

mellow kelp
#

o

#

lmfao every time i hear ourcord i think of the soviet union

outer perch
#

hahaha

mellow kelp
#

my ourcord

earnest phoenix
#

Because we got so many contributors, communism

mellow kelp
#

beautiful

crimson vapor
#

I wanna get in on this

#

what should I do?

#

I have no idea how to do much in ts

#

especially ws and fetches

earnest phoenix
#

Just open a PR and get it merged, you'll be a contributor then

crimson vapor
#

but what should I change?

mellow kelp
#

the readme is always the reliable option

crimson vapor
#

because I can add a few

earnest phoenix
#

Just add missing dots KEKW

mellow kelp
opal plank
#

im kinkshaming every single one of yas btw

mellow kelp
#

whats the repo again?

crimson vapor
#

ourcord/ourcord

earnest phoenix
#

ourcord/ourcord

mellow kelp
#

k

opal plank
#

ngl, unironically, that lib turning into a meme

earnest phoenix
#

Erwin

opal plank
#

bad is an understatement

earnest phoenix
#

Stop and just contribute smh my head

opal plank
#

hell naw

#

i got my own shit libs to take care of

#

made this yesterday in 6h

crimson vapor
#

should I pr that @earnest phoenix

earnest phoenix
#

Go ahead

edgy tapir
#
message.channel.bulkDelete(args[0]).then(() => {
    const amsters = new Discord.MessageEmbed()
    .setColor("#0FDCC9")
    .setDescription(`:white_check_mark: **Am sters ${args[0]} mesaje!**`);

    message.channel.send(amsters).then(msg => msg.delete({ timeout: 10000 }));
  });

Why the bot is not deleting the number i said in args[0] ?

crimson vapor
#

ok

opal plank
#

duplicate types, npm v1 and its not working, commit names like this , bruh, this is a troll lib @pure lion @earnest phoenix

mellow kelp
#

yo i made a pr

opal plank
#

who the heck publishes something that is not working?

#

and in v1 too

mellow kelp
#

lmao instantly closed

crimson vapor
#

LOL

#

closed or accepted?

mellow kelp
#

closed KEKW

crimson vapor
#

response?

mellow kelp
#

I added my name in the colaborators in the readme since that makes me a colaborator

hard ivy